@reltio/components 1.4.1125 → 1.4.1129

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/InternalLink/InternalLink.d.ts +3 -0
  2. package/cjs/components/InternalLink/InternalLink.js +39 -0
  3. package/cjs/components/InternalLink/styles.d.ts +1 -0
  4. package/cjs/components/InternalLink/styles.js +10 -0
  5. package/cjs/components/VerticalHeadingsTable/TableCell/TableCell.js +2 -1
  6. package/cjs/components/VerticalHeadingsTable/TableCellWithDnd/TableCellWithDnd.js +2 -1
  7. package/cjs/components/VerticalHeadingsTable/TableRow/TableRow.js +1 -1
  8. package/cjs/components/VerticalHeadingsTable/TableRowWithDnd/TableRowWithDnd.js +1 -1
  9. package/cjs/components/VerticalHeadingsTable/VerticalHeadingsTable.js +4 -3
  10. package/cjs/components/attributes/inline/ReferenceAttribute/ReferenceAttribute.js +2 -1
  11. package/cjs/components/attributes/inline/ReferenceAttribute/styles.d.ts +1 -1
  12. package/cjs/components/attributes/inline/ReferenceAttribute/styles.js +0 -4
  13. package/cjs/components/attributes/readMode/AttributeValuesBlock/AttributeValuesBlock.d.ts +5 -1
  14. package/cjs/components/attributes/readMode/AttributeValuesBlock/AttributeValuesBlock.js +2 -2
  15. package/cjs/components/attributes/readMode/AttributesPager/SpecialRenderer.js +1 -1
  16. package/cjs/components/attributes/readMode/ComplexAttribute/ComplexAttribute.d.ts +3 -1
  17. package/cjs/components/attributes/readMode/ComplexAttribute/ComplexAttribute.js +29 -12
  18. package/cjs/components/attributes/readMode/ReferenceAttribute/ReferenceAttribute.js +2 -2
  19. package/cjs/components/attributes/readMode/ReferenceAttribute/styles.d.ts +1 -1
  20. package/cjs/components/attributes/readMode/ReferenceAttribute/styles.js +0 -4
  21. package/cjs/components/attributes/readMode/SimpleAttribute/SimpleAttribute.js +11 -5
  22. package/cjs/components/attributes/readMode/SpecialAttributes/Tags/Tag.js +2 -2
  23. package/cjs/contexts/HighlightedValuesContext/index.d.ts +5 -0
  24. package/cjs/contexts/HighlightedValuesContext/index.js +12 -0
  25. package/cjs/contexts/index.d.ts +1 -0
  26. package/cjs/contexts/index.js +3 -1
  27. package/cjs/hooks/useAPI/API.js +3 -3
  28. package/cjs/hooks/useAPI/types.d.ts +3 -1
  29. package/cjs/hooks/useAPI/types.js +1 -0
  30. package/cjs/hooks/useAPI/useAPI.d.ts +2 -1
  31. package/cjs/hooks/useAPI/useAPI.js +27 -16
  32. package/cjs/hooks/useMatchesLoader.d.ts +2 -1
  33. package/cjs/hooks/useMatchesLoader.js +3 -1
  34. package/esm/components/InternalLink/InternalLink.d.ts +3 -0
  35. package/esm/components/InternalLink/InternalLink.js +34 -0
  36. package/esm/components/InternalLink/styles.d.ts +1 -0
  37. package/esm/components/InternalLink/styles.js +7 -0
  38. package/esm/components/VerticalHeadingsTable/TableCell/TableCell.js +2 -1
  39. package/esm/components/VerticalHeadingsTable/TableCellWithDnd/TableCellWithDnd.js +2 -1
  40. package/esm/components/VerticalHeadingsTable/TableRow/TableRow.js +1 -1
  41. package/esm/components/VerticalHeadingsTable/TableRowWithDnd/TableRowWithDnd.js +1 -1
  42. package/esm/components/VerticalHeadingsTable/VerticalHeadingsTable.js +4 -3
  43. package/esm/components/attributes/inline/ReferenceAttribute/ReferenceAttribute.js +2 -1
  44. package/esm/components/attributes/inline/ReferenceAttribute/styles.d.ts +1 -1
  45. package/esm/components/attributes/inline/ReferenceAttribute/styles.js +0 -4
  46. package/esm/components/attributes/readMode/AttributeValuesBlock/AttributeValuesBlock.d.ts +5 -1
  47. package/esm/components/attributes/readMode/AttributeValuesBlock/AttributeValuesBlock.js +2 -2
  48. package/esm/components/attributes/readMode/AttributesPager/SpecialRenderer.js +1 -1
  49. package/esm/components/attributes/readMode/ComplexAttribute/ComplexAttribute.d.ts +3 -1
  50. package/esm/components/attributes/readMode/ComplexAttribute/ComplexAttribute.js +31 -14
  51. package/esm/components/attributes/readMode/ReferenceAttribute/ReferenceAttribute.js +2 -2
  52. package/esm/components/attributes/readMode/ReferenceAttribute/styles.d.ts +1 -1
  53. package/esm/components/attributes/readMode/ReferenceAttribute/styles.js +0 -4
  54. package/esm/components/attributes/readMode/SimpleAttribute/SimpleAttribute.js +11 -5
  55. package/esm/components/attributes/readMode/SpecialAttributes/Tags/Tag.js +2 -2
  56. package/esm/contexts/HighlightedValuesContext/index.d.ts +5 -0
  57. package/esm/contexts/HighlightedValuesContext/index.js +6 -0
  58. package/esm/contexts/index.d.ts +1 -0
  59. package/esm/contexts/index.js +1 -0
  60. package/esm/hooks/useAPI/API.js +3 -3
  61. package/esm/hooks/useAPI/types.d.ts +3 -1
  62. package/esm/hooks/useAPI/types.js +1 -0
  63. package/esm/hooks/useAPI/useAPI.d.ts +2 -1
  64. package/esm/hooks/useAPI/useAPI.js +29 -18
  65. package/esm/hooks/useMatchesLoader.d.ts +2 -1
  66. package/esm/hooks/useMatchesLoader.js +3 -1
  67. package/package.json +4 -3
@@ -12,7 +12,7 @@ var usePagingSimulator_1 = require("./usePagingSimulator");
12
12
  var useSafePromise_1 = require("./useSafePromise");
13
13
  var ramda_1 = require("ramda");
14
14
  var useMatchesLoader = function (_a) {
15
- var enabled = _a.enabled, entity = _a.entity, filter = _a.filter, onFinishLoading = _a.onFinishLoading, onStartLoading = _a.onStartLoading, options = _a.options, page = _a.page, rowsPerPage = _a.rowsPerPage, sorting = _a.sorting;
15
+ var enabled = _a.enabled, entity = _a.entity, filter = _a.filter, onFinishLoading = _a.onFinishLoading, onStartLoading = _a.onStartLoading, options = _a.options, page = _a.page, rowsPerPage = _a.rowsPerPage, sorting = _a.sorting, markMatchedValues = _a.markMatchedValues;
16
16
  var _b = sorting || {}, order = _b.order, field = _b.field;
17
17
  var _c = react_1.useState(0), total = _c[0], setTotal = _c[1];
18
18
  var _d = react_1.useState([]), matches = _d[0], setMatches = _d[1];
@@ -67,6 +67,7 @@ var useMatchesLoader = function (_a) {
67
67
  sort: field,
68
68
  order: order,
69
69
  force: force,
70
+ markMatchedValues: markMatchedValues,
70
71
  deep: options.showTransitiveMatches ? undefined : 1,
71
72
  activeness: activeness
72
73
  }))
@@ -90,6 +91,7 @@ var useMatchesLoader = function (_a) {
90
91
  entityUri,
91
92
  field,
92
93
  filter,
94
+ markMatchedValues,
93
95
  getPagedMatchesForDataTenantEntity,
94
96
  getTransitiveMatchesWithPaging,
95
97
  onFinishLoading,
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const InternalLink: (props: React.AnchorHTMLAttributes<HTMLAnchorElement>) => JSX.Element;
3
+ export default InternalLink;
@@ -0,0 +1,34 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import React from 'react';
24
+ import { useInRouterContext, Link } from 'react-router-dom';
25
+ import classnames from 'classnames';
26
+ import { useStyles } from './styles';
27
+ var InternalLink = function (props) {
28
+ var styles = useStyles();
29
+ var inRouterContext = useInRouterContext();
30
+ var href = props.href, className = props.className, otherProps = __rest(props, ["href", "className"]);
31
+ var linkClassName = classnames(styles.link, className);
32
+ return inRouterContext ? (React.createElement(Link, __assign({ to: href === null || href === void 0 ? void 0 : href.replace(window.location.origin, ''), className: linkClassName }, otherProps))) : (React.createElement("a", __assign({ href: href, className: linkClassName }, otherProps)));
33
+ };
34
+ export default InternalLink;
@@ -0,0 +1 @@
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"link">;
@@ -0,0 +1,7 @@
1
+ import { makeStyles } from '@material-ui/core/styles';
2
+ export var useStyles = makeStyles(function (theme) { return ({
3
+ link: {
4
+ color: theme.palette.primary.main,
5
+ textDecoration: 'none'
6
+ }
7
+ }); });
@@ -3,6 +3,7 @@ import { DefaultCellRenderer } from '../helpers';
3
3
  export var TableCell = function (_a) {
4
4
  var columnValue = _a.columnValue, rowData = _a.rowData, setHoveredColumn = _a.setHoveredColumn, resetHoveredColumn = _a.resetHoveredColumn;
5
5
  var CellRenderer = rowData.cellRenderer || DefaultCellRenderer;
6
- return (React.createElement("td", { onMouseOver: function () { return setHoveredColumn(columnValue); }, onMouseLeave: resetHoveredColumn },
6
+ var onMouseOver = setHoveredColumn ? function () { return setHoveredColumn(columnValue); } : undefined;
7
+ return (React.createElement("td", { onMouseOver: onMouseOver, onMouseLeave: resetHoveredColumn },
7
8
  React.createElement(CellRenderer, { value: columnValue[rowData.id] })));
8
9
  };
@@ -56,7 +56,8 @@ export var TableCellWithDnd = function (_a) {
56
56
  drop(dropRef);
57
57
  drag(dragRef);
58
58
  }, []);
59
- return (React.createElement("td", { style: { opacity: opacity }, ref: dropRef, className: styles.tableData, "data-source-id": sourceId, "data-target-id": targetId, onMouseOver: function () { return setHoveredColumn(columnValue); }, onMouseLeave: resetHoveredColumn },
59
+ var onMouseOver = setHoveredColumn ? function () { return setHoveredColumn(columnValue); } : undefined;
60
+ return (React.createElement("td", { style: { opacity: opacity }, ref: dropRef, className: styles.tableData, "data-source-id": sourceId, "data-target-id": targetId, onMouseOver: onMouseOver, onMouseLeave: resetHoveredColumn },
60
61
  shouldRenderDragIndicator && (React.createElement("div", { ref: dragRef, className: styles.dragIndicator },
61
62
  React.createElement(DragIndicatorIcon, { className: styles.dragIndicatorIcon }))),
62
63
  React.createElement(CellRenderer, { value: columnValue[rowData.id] })));
@@ -10,6 +10,6 @@ export var TableRow = function (_a) {
10
10
  columnsData.map(function (columnValue, index) {
11
11
  var isDraggableColumn = columnValue.isDraggable;
12
12
  var shouldRenderDragIndicator = isFirstRow && isDraggableColumn;
13
- return onMoveColumn ? (React.createElement(TableCellWithDnd, { key: columnValue.id, columnValue: columnValue, rowData: rowData, index: index, onMoveColumn: onMoveColumn, shouldRenderDragIndicator: shouldRenderDragIndicator, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn })) : (React.createElement(TableCell, { key: columnValue.id, rowData: rowData, columnValue: columnValue, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn }));
13
+ return onMoveColumn ? (React.createElement(TableCellWithDnd, { key: columnValue.id || index, columnValue: columnValue, rowData: rowData, index: index, onMoveColumn: onMoveColumn, shouldRenderDragIndicator: shouldRenderDragIndicator, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn })) : (React.createElement(TableCell, { key: columnValue.id || index, rowData: rowData, columnValue: columnValue, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn }));
14
14
  })));
15
15
  };
@@ -50,6 +50,6 @@ export var TableRowWithDnd = function (_a) {
50
50
  return (React.createElement("tr", { className: rowData.rowClassName, style: { opacity: opacity }, ref: dropRef, "data-target-id": targetId, "data-source-id": sourceId },
51
51
  React.createElement(TableHeadCell, { rowData: rowData, isDraggable: true, dragRef: dragRef }),
52
52
  columnsData.map(function (columnValue, index) {
53
- return onMoveColumn ? (React.createElement(TableCellWithDnd, { key: columnValue.id, columnValue: columnValue, rowData: rowData, index: index, onMoveColumn: onMoveColumn, shouldRenderDragIndicator: false, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn })) : (React.createElement(TableCell, { key: columnValue.id, columnValue: columnValue, rowData: rowData, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn }));
53
+ return onMoveColumn ? (React.createElement(TableCellWithDnd, { key: columnValue.id || index, columnValue: columnValue, rowData: rowData, index: index, onMoveColumn: onMoveColumn, shouldRenderDragIndicator: false, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn })) : (React.createElement(TableCell, { key: columnValue.id || index, columnValue: columnValue, rowData: rowData, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn }));
54
54
  })));
55
55
  };
@@ -7,12 +7,13 @@ var VerticalHeadingsTable = function (_a) {
7
7
  var className = _a.className, rowsData = _a.rowsData, columnsData = _a.columnsData, _c = _a.theadRowsNumber, theadRowsNumber = _c === void 0 ? 0 : _c, onMoveRow = _a.onMoveRow, onMoveColumn = _a.onMoveColumn, setHoveredColumn = _a.setHoveredColumn, resetHoveredColumn = _a.resetHoveredColumn;
8
8
  var tableRef = useRef(null);
9
9
  var tableHeight = (_b = tableRef === null || tableRef === void 0 ? void 0 : tableRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight;
10
+ var isDNDActive = !!onMoveRow || !!onMoveColumn;
10
11
  return (React.createElement(React.Fragment, null,
11
- React.createElement(TableColumnDragLayer, { columnHeight: tableHeight }),
12
+ isDNDActive && React.createElement(TableColumnDragLayer, { columnHeight: tableHeight }),
12
13
  React.createElement("table", { ref: tableRef, className: className },
13
- theadRowsNumber > 0 && (React.createElement("thead", null, rowsData.slice(0, theadRowsNumber).map(function (rowData, index) { return (React.createElement(TableRow, { key: rowData.id, rowData: rowData, columnsData: columnsData, index: index, onMoveColumn: onMoveColumn, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn })); }))),
14
+ theadRowsNumber > 0 && (React.createElement("thead", null, rowsData.slice(0, theadRowsNumber).map(function (rowData, index) { return (React.createElement(TableRow, { key: rowData.id || index, rowData: rowData, columnsData: columnsData, index: index, onMoveColumn: onMoveColumn, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn })); }))),
14
15
  React.createElement("tbody", null, rowsData.slice(theadRowsNumber).map(function (rowData, index) {
15
- return onMoveRow ? (React.createElement(TableRowWithDnd, { key: rowData.id, index: index + theadRowsNumber, rowData: rowData, columnsData: columnsData, onMoveRow: onMoveRow, onMoveColumn: onMoveColumn, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn })) : (React.createElement(TableRow, { key: rowData.id, index: index + theadRowsNumber, rowData: rowData, columnsData: columnsData, onMoveColumn: onMoveColumn, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn }));
16
+ return onMoveRow ? (React.createElement(TableRowWithDnd, { key: rowData.id || index, index: index + theadRowsNumber, rowData: rowData, columnsData: columnsData, onMoveRow: onMoveRow, onMoveColumn: onMoveColumn, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn })) : (React.createElement(TableRow, { key: rowData.id || index, index: index + theadRowsNumber, rowData: rowData, columnsData: columnsData, onMoveColumn: onMoveColumn, setHoveredColumn: setHoveredColumn, resetHoveredColumn: resetHoveredColumn }));
16
17
  })))));
17
18
  };
18
19
  export default memo(VerticalHeadingsTable);
@@ -27,6 +27,7 @@ import { findAttributeTypeByUri, getEntityLink, getLabel, getReferencedEntityUri
27
27
  import ComplexAttribute from '../ComplexAttribute/ComplexAttribute';
28
28
  import { isNil, map, pipe, reject } from 'ramda';
29
29
  import { ComplexAttributeLabel } from '../common/ComplexAttributeLabel';
30
+ import InternalLink from '../../../InternalLink/InternalLink';
30
31
  import { useStyles } from './styles';
31
32
  var ReferenceAttribute = function (_a) {
32
33
  var attributeValue = _a.attributeValue, attributeType = _a.attributeType, other = __rest(_a, ["attributeValue", "attributeType"]);
@@ -34,7 +35,7 @@ var ReferenceAttribute = function (_a) {
34
35
  var metadata = useSelector(mdmModule.selectors.getMetadata);
35
36
  var uiPath = useSelector(mdmModule.selectors.getUIPath);
36
37
  var entityLabel = (React.createElement(ComplexAttributeLabel, null,
37
- React.createElement("a", { href: getEntityLink({ uiPath: uiPath, uri: getReferencedEntityUriFromAttrValue(attributeValue) }), className: styles.label },
38
+ React.createElement(InternalLink, { href: getEntityLink({ uiPath: uiPath, uri: getReferencedEntityUriFromAttrValue(attributeValue) }) },
38
39
  getLabel(attributeValue.label),
39
40
  attributeValue.relationshipLabel && (React.createElement("span", { className: styles.relationshipLabel }, attributeValue.relationshipLabel)))));
40
41
  var attributeTypesList = pipe(getReferencedRelationAttrTypesUris, map(function (attrTypeUri) { return findAttributeTypeByUri(metadata, attrTypeUri); }), reject(isNil))(attributeType);
@@ -1 +1 @@
1
- export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "relationshipLabel">;
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"relationshipLabel">;
@@ -1,9 +1,5 @@
1
1
  import { makeStyles } from '@material-ui/core/styles';
2
2
  export var useStyles = makeStyles(function (theme) { return ({
3
- label: {
4
- color: theme.palette.primary.main,
5
- textDecoration: 'none'
6
- },
7
3
  relationshipLabel: {
8
4
  marginLeft: '4px',
9
5
  color: theme.palette.text.primary
@@ -5,6 +5,10 @@ declare type Props = {
5
5
  attributeType: AttributeType;
6
6
  expanded?: boolean;
7
7
  valueContainerClassName?: string;
8
+ LabelRenderer?: ({ attributeType: AttributeType, attributeValue: AttributeValue }: {
9
+ attributeType: any;
10
+ attributeValue: any;
11
+ }) => JSX.Element;
8
12
  };
9
- declare const _default: React.MemoExoticComponent<({ expanded, ...props }: Props) => JSX.Element>;
13
+ declare const _default: React.MemoExoticComponent<({ expanded, LabelRenderer, ...props }: Props) => JSX.Element>;
10
14
  export default _default;
@@ -30,12 +30,12 @@ var renderAttributesList = function (_a) {
30
30
  React.createElement(ReadOnlyAttribute, __assign({ attributeValue: attributeValue }, props)))); })));
31
31
  };
32
32
  var AttributeValuesBlock = function (_a) {
33
- var expanded = _a.expanded, props = __rest(_a, ["expanded"]);
33
+ var expanded = _a.expanded, LabelRenderer = _a.LabelRenderer, props = __rest(_a, ["expanded", "LabelRenderer"]);
34
34
  var attributeType = props.attributeType, values = props.values, valueContainerClassName = props.valueContainerClassName;
35
35
  switch (attributeType.type) {
36
36
  case DataTypes.TYPE_NESTED:
37
37
  case DataTypes.TYPE_REFERENCE: {
38
- return renderAttributesList(__assign({ expanded: expanded }, props));
38
+ return renderAttributesList(__assign({ expanded: expanded, LabelRenderer: LabelRenderer }, props));
39
39
  }
40
40
  case DataTypes.TYPE_IMAGE: {
41
41
  return (React.createElement("div", { className: valueContainerClassName },
@@ -22,7 +22,7 @@ var SpecialRenderer = function (_a) {
22
22
  return React.createElement(Roles, { className: className, values: values });
23
23
  }
24
24
  default: {
25
- //startDate, endDate
25
+ //startDate, endDate, "crosswalk" fake nested subattibutes
26
26
  return (React.createElement(Attribute, { className: className, attributeValue: { value: values[0] }, attributeType: attributeType, inlined: true }));
27
27
  }
28
28
  }
@@ -1,5 +1,5 @@
1
1
  export default ComplexAttribute;
2
- declare function ComplexAttribute({ attributeTypesList, attributeValue, label, expanded: expandedProp, children, showNonOv, attributeType }: {
2
+ declare function ComplexAttribute({ attributeTypesList, attributeValue, label, expanded: expandedProp, children, showNonOv, attributeType, LabelRenderer }: {
3
3
  attributeTypesList: any;
4
4
  attributeValue: any;
5
5
  label: any;
@@ -7,6 +7,7 @@ declare function ComplexAttribute({ attributeTypesList, attributeValue, label, e
7
7
  children: any;
8
8
  showNonOv: any;
9
9
  attributeType: any;
10
+ LabelRenderer: any;
10
11
  }): JSX.Element;
11
12
  declare namespace ComplexAttribute {
12
13
  namespace propTypes {
@@ -36,6 +37,7 @@ declare namespace ComplexAttribute {
36
37
  export const expanded: PropTypes.Requireable<boolean>;
37
38
  export const showNonOv: PropTypes.Requireable<boolean>;
38
39
  export { AttributeTypeType as attributeType };
40
+ export const LabelRenderer: PropTypes.Requireable<(...args: any[]) => any>;
39
41
  }
40
42
  }
41
43
  import PropTypes from "prop-types";
@@ -1,37 +1,53 @@
1
- import React, { useEffect, useMemo, useState } from 'react';
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import React, { useContext, useEffect, useMemo, useState } from 'react';
2
13
  import PropTypes from 'prop-types';
3
14
  import classnames from 'classnames';
4
- import { AttributeTypeType, isAnalyticAttribute, NestedAttributeValueType, ReferenceAttributeValueType, CollaborationObjectTypes, createRelatedObjectUris, isRelationAttrType } from '@reltio/mdm-sdk';
15
+ import { AttributeTypeType, areOneHierarchyUris, isAnalyticAttribute, NestedAttributeValueType, ReferenceAttributeValueType, CollaborationObjectTypes, createRelatedObjectUris, isRelationAttrType, isSpecialAttribute } from '@reltio/mdm-sdk';
5
16
  import Typography from '@material-ui/core/Typography';
6
17
  import AttributesList from '../AttributesList/AttributesList';
7
18
  import ArrowExpandButton from '../../../ArrowExpandButton/ArrowExpandButton';
8
19
  import CommentsContainer from '../../../CommentsContainer/CommentsContainer';
9
20
  import { COMMENTS_CONTAINER_VISIBILITY_AREA } from '../../../../constants/classnames';
10
21
  import { useStyles } from './styles';
22
+ import { HighlightedValuesContext } from '../../../../contexts';
11
23
  var ComplexAttribute = function (_a) {
12
- var attributeTypesList = _a.attributeTypesList, attributeValue = _a.attributeValue, label = _a.label, _b = _a.expanded, expandedProp = _b === void 0 ? false : _b, children = _a.children, showNonOv = _a.showNonOv, attributeType = _a.attributeType;
24
+ var _b;
25
+ var attributeTypesList = _a.attributeTypesList, attributeValue = _a.attributeValue, label = _a.label, _c = _a.expanded, expandedProp = _c === void 0 ? false : _c, children = _a.children, showNonOv = _a.showNonOv, attributeType = _a.attributeType, LabelRenderer = _a.LabelRenderer;
13
26
  var styles = useStyles();
14
27
  var uri = attributeValue.uri;
15
- var _c = useState(false), expanded = _c[0], setExpanded = _c[1];
28
+ var _d = useState(false), expanded = _d[0], setExpanded = _d[1];
29
+ var _e = useContext(HighlightedValuesContext), _f = _e.highlightedValuesUris, highlightedValuesUris = _f === void 0 ? [] : _f, highlightedClassName = _e.highlightedClassName;
16
30
  useEffect(function () {
17
31
  setExpanded(expandedProp);
18
32
  }, [expandedProp]);
19
33
  var hasAnalyticValue = (attributeTypesList || []).some(function (attributeType) { return isAnalyticAttribute(attributeType); });
20
- var attributeListEntity = useMemo(function () { return ({
21
- attributes: hasAnalyticValue ? null : attributeValue.value,
22
- analyticsAttributes: hasAnalyticValue ? attributeValue.value : null
23
- }); }, [attributeValue, hasAnalyticValue]);
34
+ var attributeListEntity = useMemo(function () { return (__assign({ attributes: hasAnalyticValue ? null : attributeValue.value, analyticsAttributes: hasAnalyticValue ? attributeValue.value : null }, (isSpecialAttribute(attributeType) ? attributeValue.value : {}))); }, [attributeValue, hasAnalyticValue, attributeType]);
24
35
  var objectType = isRelationAttrType(attributeType)
25
36
  ? CollaborationObjectTypes.RELATION_ATTRIBUTE
26
37
  : CollaborationObjectTypes.ENTITY_ATTRIBUTE;
27
38
  return (React.createElement("div", { className: styles.complexContainer },
28
39
  React.createElement("div", { className: classnames(styles.labelContainer, COMMENTS_CONTAINER_VISIBILITY_AREA) },
29
40
  React.createElement(ArrowExpandButton, { onClick: function () { return setExpanded(function (value) { return !value; }); }, expanded: expanded }),
30
- React.createElement(Typography, { component: "span", variant: "body2", classes: { body2: styles.label }, "data-reltio-id": "reltio-attribute-complex-label" }, label),
31
- React.createElement("div", { className: styles.spacer }),
32
- React.createElement(CommentsContainer, { uri: attributeValue.uri, relatedObjectUris: createRelatedObjectUris(objectType, {
33
- uri: attributeValue.uri
34
- }), objectType: objectType })),
41
+ LabelRenderer ? (React.createElement(LabelRenderer, { attributeType: attributeType, attributeValue: attributeValue })) : (React.createElement(React.Fragment, null,
42
+ React.createElement(Typography, { component: "span", variant: "body2", classes: { body2: styles.label }, className: classnames((_b = {},
43
+ _b[highlightedClassName] = highlightedValuesUris.some(function (uri) {
44
+ return areOneHierarchyUris(uri, attributeValue.uri);
45
+ }),
46
+ _b)), "data-reltio-id": "reltio-attribute-complex-label" }, label),
47
+ React.createElement("div", { className: styles.spacer }),
48
+ React.createElement(CommentsContainer, { uri: attributeValue.uri, relatedObjectUris: createRelatedObjectUris(objectType, {
49
+ uri: attributeValue.uri
50
+ }), objectType: objectType })))),
35
51
  expanded && (React.createElement(AttributesList, { attrTypes: attributeTypesList, entity: attributeListEntity, drawLines: true, parentUri: uri, showNonOv: showNonOv }, children))));
36
52
  };
37
53
  ComplexAttribute.propTypes = {
@@ -41,6 +57,7 @@ ComplexAttribute.propTypes = {
41
57
  attributeValue: PropTypes.oneOfType([NestedAttributeValueType, ReferenceAttributeValueType]),
42
58
  expanded: PropTypes.bool,
43
59
  showNonOv: PropTypes.bool,
44
- attributeType: AttributeTypeType
60
+ attributeType: AttributeTypeType,
61
+ LabelRenderer: PropTypes.func
45
62
  };
46
63
  export default ComplexAttribute;
@@ -21,11 +21,11 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import React, { memo, useContext, useMemo } from 'react';
24
- import classnames from 'classnames';
25
24
  import { getAttributeTypeSubAttributes, getEntityLink, getLabel, getReferencedEntityUriFromAttrValue, isEmptyValue, ReferenceAttributeType } from '@reltio/mdm-sdk';
26
25
  import { HistoryDiffContext } from '../../../../contexts';
27
26
  import ComplexAttribute from '../ComplexAttribute/ComplexAttribute';
28
27
  import { getHistoryAppearanceByUri, getHistoryAttributeClassName } from '../helpers/historyAppearance';
28
+ import InternalLink from '../../../InternalLink/InternalLink';
29
29
  import useStyles from './styles';
30
30
  var ReferenceAttribute = function (_a) {
31
31
  var attributeValue = _a.attributeValue, metadata = _a.metadata, attributeType = _a.attributeType, uiPath = _a.uiPath, otherProps = __rest(_a, ["attributeValue", "metadata", "attributeType", "uiPath"]);
@@ -39,7 +39,7 @@ var ReferenceAttribute = function (_a) {
39
39
  var entityLabel = useMemo(function () {
40
40
  var attributeAppearance = getHistoryAppearanceByUri(attributeValue.uri, appearance);
41
41
  var historyAttributesClassName = getHistoryAttributeClassName(attributeAppearance);
42
- return (React.createElement("a", { href: isEmptyValue(appearance) ? getEntityLink({ uiPath: uiPath, uri: refEntityURI }) : undefined, className: classnames(styles.label, styles[historyAttributesClassName]) },
42
+ return (React.createElement(InternalLink, { href: isEmptyValue(appearance) ? getEntityLink({ uiPath: uiPath, uri: refEntityURI }) : undefined, className: styles[historyAttributesClassName] },
43
43
  getLabel(attributeValue.label),
44
44
  attributeValue.relationshipLabel && (React.createElement("span", { className: styles.relationshipLabel }, attributeValue.relationshipLabel))));
45
45
  }, [
@@ -1,2 +1,2 @@
1
1
  export default styles;
2
- declare const styles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "relationshipLabel" | "updateAttribute" | "insertAttribute" | "deleteAttribute">;
2
+ declare const styles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"relationshipLabel" | "updateAttribute" | "insertAttribute" | "deleteAttribute">;
@@ -12,10 +12,6 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { makeStyles } from '@material-ui/core/styles';
13
13
  import { HistoryOperations, historyPalettes } from '../helpers/historyAppearance';
14
14
  var styles = makeStyles(function (theme) { return ({
15
- label: {
16
- color: theme.palette.primary.main,
17
- textDecoration: 'none'
18
- },
19
15
  relationshipLabel: {
20
16
  marginLeft: '4px',
21
17
  color: theme.palette.text.primary
@@ -8,10 +8,12 @@ import DataTypeValue from '../../../DataTypeValue/DataTypeValue';
8
8
  import { PivotingTooltip } from '../../PivotingAttributes/PivotingTooltip';
9
9
  import { getHistoryAppearanceByUri, getHistoryAttributeClassName } from '../helpers/historyAppearance';
10
10
  import { useStyles } from './styles';
11
+ import { HighlightedValuesContext } from '../../../../contexts';
11
12
  var SimpleAttribute = function (_a) {
12
- var _b;
13
- var className = _a.className, _c = _a.attributeType, attributeType = _c === void 0 ? null : _c, attributeValue = _a.attributeValue, inlined = _a.inlined;
13
+ var _b, _c, _d;
14
+ var className = _a.className, _e = _a.attributeType, attributeType = _e === void 0 ? null : _e, attributeValue = _a.attributeValue, inlined = _a.inlined;
14
15
  var styles = useStyles();
16
+ var _f = useContext(HighlightedValuesContext), _g = _f.highlightedValuesUris, highlightedValuesUris = _g === void 0 ? [] : _g, highlightedClassName = _f.highlightedClassName;
15
17
  var appearance = useContext(HistoryDiffContext).appearance;
16
18
  var attributeAppearance = getHistoryAppearanceByUri(attributeValue.uri, appearance);
17
19
  var historyClassName = getHistoryAttributeClassName(attributeAppearance);
@@ -19,9 +21,13 @@ var SimpleAttribute = function (_a) {
19
21
  var objectType = isRelationAttrType(attributeType)
20
22
  ? CollaborationObjectTypes.RELATION_ATTRIBUTE
21
23
  : CollaborationObjectTypes.ENTITY_ATTRIBUTE;
22
- return inlined || historyClassName ? (React.createElement("div", { className: className },
23
- React.createElement(PivotingTooltip, { value: attributeValue, attributeType: attributeType, key: attributeValue.uri, className: classnames((_b = {}, _b[styles.multilineAttribute] = !inlined, _b)) },
24
- React.createElement("span", { className: styles[historyClassName], "data-reltio-id": "reltio-attribute-value" }, dataTypeValue)))) : (React.createElement("div", { className: classnames(className, styles.root, COMMENTS_CONTAINER_VISIBILITY_AREA) },
24
+ return inlined || historyClassName ? (React.createElement("div", { className: classnames(className, (_b = {},
25
+ _b[highlightedClassName] = highlightedValuesUris.includes(attributeValue.uri),
26
+ _b)) },
27
+ React.createElement(PivotingTooltip, { value: attributeValue, attributeType: attributeType, key: attributeValue.uri, className: classnames((_c = {}, _c[styles.multilineAttribute] = !inlined, _c)) },
28
+ React.createElement("span", { className: styles[historyClassName], "data-reltio-id": "reltio-attribute-value" }, dataTypeValue)))) : (React.createElement("div", { className: classnames(className, styles.root, COMMENTS_CONTAINER_VISIBILITY_AREA, (_d = {},
29
+ _d[highlightedClassName] = highlightedValuesUris.includes(attributeValue.uri),
30
+ _d)) },
25
31
  React.createElement(PivotingTooltip, { value: attributeValue, attributeType: attributeType, key: attributeValue.uri },
26
32
  React.createElement("span", { className: styles.attributeValue, "data-reltio-id": "reltio-attribute-value" }, dataTypeValue)),
27
33
  React.createElement(CommentsContainer, { className: styles.commentsContainer, uri: attributeValue.uri, relatedObjectUris: createRelatedObjectUris(objectType, {
@@ -1,5 +1,5 @@
1
1
  import React, { useContext } from 'react';
2
- import Link from '@material-ui/core/Link';
2
+ import InternalLink from '../../../../InternalLink/InternalLink';
3
3
  import { useSelector } from 'react-redux';
4
4
  import mdmModule from '@reltio/mdm-module';
5
5
  import { getDataTenantEntityUri, getTagLink } from '@reltio/mdm-sdk';
@@ -16,7 +16,7 @@ var Tag = function (_a) {
16
16
  var attributeAppearance = getHistoryAppearanceBySpecialAttributeValue('tags', value, appearance);
17
17
  var historyClassName = getHistoryAttributeClassName(attributeAppearance);
18
18
  var entity = ownEntity || currentEntity;
19
- return (React.createElement(Link, { underline: "none", className: styles[historyClassName], href: getTagLink({
19
+ return (React.createElement(InternalLink, { className: styles[historyClassName], href: getTagLink({
20
20
  uiPath: uiPath,
21
21
  tag: value,
22
22
  entityUri: entity.dataTenant ? getDataTenantEntityUri(entity) : entity.uri
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export declare const HighlightedValuesContext: React.Context<{
3
+ highlightedValuesUris: string[];
4
+ highlightedClassName: string;
5
+ }>;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export var HighlightedValuesContext = React.createContext({
3
+ highlightedValuesUris: [],
4
+ highlightedClassName: ''
5
+ });
6
+ HighlightedValuesContext.displayName = 'HighlightedValuesContext';
@@ -19,3 +19,4 @@ export { SandboxAPIContext } from './SandboxAPIContext';
19
19
  export { useReloadAllFacets, ReloadFacetProvider, useReloadFacet } from './ReloadFacetContext';
20
20
  export { SearchFiltersContext } from './SearchFiltersContext';
21
21
  export { SnackbarContext } from './SnackbarContext';
22
+ export { HighlightedValuesContext } from './HighlightedValuesContext';
@@ -19,3 +19,4 @@ export { SandboxAPIContext } from './SandboxAPIContext';
19
19
  export { useReloadAllFacets, ReloadFacetProvider, useReloadFacet } from './ReloadFacetContext';
20
20
  export { SearchFiltersContext } from './SearchFiltersContext';
21
21
  export { SnackbarContext } from './SnackbarContext';
22
+ export { HighlightedValuesContext } from './HighlightedValuesContext';
@@ -178,15 +178,15 @@ export var processRequest = function (_a) {
178
178
  break;
179
179
  }
180
180
  case RequestAction.ALERT: {
181
- window.alert(paramObject.params.text);
181
+ worker.postMessage(__assign({ action: 'response', result: window.alert(paramObject.params.text) }, paramObject.params));
182
182
  break;
183
183
  }
184
184
  case RequestAction.CONFIRM: {
185
- window.confirm(paramObject.params.text);
185
+ worker.postMessage(__assign({ action: 'response', result: window.confirm(paramObject.params.text) }, paramObject.params));
186
186
  break;
187
187
  }
188
188
  case RequestAction.PROMPT: {
189
- window.prompt(paramObject.params.text, paramObject.params.defaultText || '');
189
+ worker.postMessage(__assign({ action: 'response', result: window.prompt(paramObject.params.text, paramObject.params.defaultText || '') }, paramObject.params));
190
190
  break;
191
191
  }
192
192
  case RequestAction.OPEN_WINDOW: {
@@ -41,6 +41,7 @@ export declare type Params = {
41
41
  defaultText?: string;
42
42
  text?: string;
43
43
  html?: string;
44
+ type?: string;
44
45
  };
45
46
  export declare type ProcessRequestParams = {
46
47
  name: RequestAction;
@@ -79,7 +80,8 @@ export declare enum CustomAction {
79
80
  SET_WIDTH = "setWidth",
80
81
  RETURN_PROCESSED_API_RESPONSE = "returnProcessedApiResponse",
81
82
  RETURN_PROCESSED_API_REQUEST = "returnProcessedApiRequest",
82
- REQUEST = "request"
83
+ REQUEST = "request",
84
+ EVENT = "event"
83
85
  }
84
86
  export declare type CustomActionTask = {
85
87
  action: CustomAction;
@@ -36,4 +36,5 @@ export var CustomAction;
36
36
  CustomAction["RETURN_PROCESSED_API_RESPONSE"] = "returnProcessedApiResponse";
37
37
  CustomAction["RETURN_PROCESSED_API_REQUEST"] = "returnProcessedApiRequest";
38
38
  CustomAction["REQUEST"] = "request";
39
+ CustomAction["EVENT"] = "event";
39
40
  })(CustomAction || (CustomAction = {}));
@@ -1,5 +1,5 @@
1
1
  import { CustomViewConfig } from '@reltio/mdm-sdk';
2
- export declare const useAPI: (config: CustomViewConfig) => {
2
+ export declare const useAPI: (config?: CustomViewConfig) => {
3
3
  html: HTMLElement;
4
4
  visible: boolean;
5
5
  tooltip: string;
@@ -10,4 +10,5 @@ export declare const useAPI: (config: CustomViewConfig) => {
10
10
  };
11
11
  message: string;
12
12
  onClosePopup: () => void;
13
+ onClick: () => void;
13
14
  };
@@ -9,23 +9,23 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { useContext, useEffect, useState } from 'react';
12
+ import { useCallback, useContext, useEffect, useRef, useState } from 'react';
13
13
  import { useDispatch, useSelector } from 'react-redux';
14
14
  import mdmModule, { ui } from '@reltio/mdm-module';
15
- import { initializeWebWorker } from '@reltio/mdm-sdk';
15
+ import { initializeWebWorker, isEmptyValue } from '@reltio/mdm-sdk';
16
16
  import { useWorkflowCheckPermission } from '../../components/workflow';
17
17
  import { SandboxAPIContext } from '../../contexts';
18
18
  import { processRequest } from './API';
19
19
  import { getWorkerURL } from './helpers';
20
20
  import { CustomAction } from './types';
21
21
  export var useAPI = function (config) {
22
- var _a = config.action, files = _a.files, permissions = _a.permissions;
23
- var _b = useState(), html = _b[0], setHtml = _b[1];
24
- var _c = useState([]), listenersToReset = _c[0], setListenersToReset = _c[1];
25
- var _d = useState(true), visible = _d[0], setVisible = _d[1];
26
- var _e = useState(null), tooltip = _e[0], setTooltip = _e[1];
27
- var _f = useState(null), customStyles = _f[0], setCustomStyles = _f[1];
28
- var _g = useState(''), message = _g[0], setMessage = _g[1];
22
+ if (config === void 0) { config = {}; }
23
+ var _a = useState(), html = _a[0], setHtml = _a[1];
24
+ var _b = useState([]), listenersToReset = _b[0], setListenersToReset = _b[1];
25
+ var _c = useState(true), visible = _c[0], setVisible = _c[1];
26
+ var _d = useState(null), tooltip = _d[0], setTooltip = _d[1];
27
+ var _e = useState(null), customStyles = _e[0], setCustomStyles = _e[1];
28
+ var _f = useState(''), message = _f[0], setMessage = _f[1];
29
29
  var dispatch = useDispatch();
30
30
  var metadata = useSelector(mdmModule.selectors.getMetadata) || {};
31
31
  var entity = useSelector(mdmModule.selectors.getEntity) || {};
@@ -39,8 +39,9 @@ export var useAPI = function (config) {
39
39
  var environment = useSelector(mdmModule.selectors.getWorkflowEnvironmentUrl);
40
40
  var qxApi = useContext(SandboxAPIContext);
41
41
  var workflowCheckPermission = useWorkflowCheckPermission();
42
- var _h = useSelector(mdmModule.selectors.getSearchProviderData) || {}, typeSearch = _h.type, search = _h.data;
42
+ var _g = useSelector(mdmModule.selectors.getSearchProviderData) || {}, typeSearch = _g.type, search = _g.data;
43
43
  var openSearch = function (search) { return dispatch(ui.actions.openSearch(search)); };
44
+ var workerRef = useRef();
44
45
  var process = function (task, worker, innerText) {
45
46
  if (task) {
46
47
  var handlersToReset_1 = [];
@@ -134,8 +135,7 @@ export var useAPI = function (config) {
134
135
  break;
135
136
  }
136
137
  case CustomAction.REQUEST: {
137
- processRequest(__assign({ name: task.params.name, paramObject: task, permissions: permissions,
138
- worker: worker,
138
+ processRequest(__assign({ name: task.params.name, paramObject: task, permissions: config.action.permissions, worker: worker,
139
139
  metadata: metadata, config: config, user: user,
140
140
  apiPath: apiPath,
141
141
  tenant: tenant,
@@ -150,20 +150,31 @@ export var useAPI = function (config) {
150
150
  }
151
151
  };
152
152
  useEffect(function () {
153
- var worker = initializeWebWorker(workerUrl, files, process);
154
- return function () {
155
- worker.terminate();
156
- };
157
- }, []);
153
+ if (!isEmptyValue(config.action)) {
154
+ workerRef.current = initializeWebWorker(workerUrl, config.action.files, process);
155
+ return function () {
156
+ workerRef.current.terminate();
157
+ };
158
+ }
159
+ }, [config]);
158
160
  useEffect(function () { return function () {
159
161
  listenersToReset.forEach(function (listener) { return listener(); });
160
162
  }; }, [listenersToReset]);
163
+ var onClick = useCallback(function () {
164
+ var _a;
165
+ (_a = workerRef.current) === null || _a === void 0 ? void 0 : _a.postMessage({
166
+ action: 'event',
167
+ type: 'execute',
168
+ data: null
169
+ });
170
+ }, [config]);
161
171
  return {
162
172
  html: html,
163
173
  visible: visible,
164
174
  tooltip: tooltip,
165
175
  customStyles: customStyles,
166
176
  message: message,
167
- onClosePopup: function () { return setMessage(''); }
177
+ onClosePopup: function () { return setMessage(''); },
178
+ onClick: onClick
168
179
  };
169
180
  };
@@ -15,8 +15,9 @@ declare type Props = {
15
15
  order: string;
16
16
  field: string;
17
17
  };
18
+ markMatchedValues?: boolean;
18
19
  };
19
- export declare const useMatchesLoader: ({ enabled, entity, filter, onFinishLoading, onStartLoading, options, page, rowsPerPage, sorting }: Props) => {
20
+ export declare const useMatchesLoader: ({ enabled, entity, filter, onFinishLoading, onStartLoading, options, page, rowsPerPage, sorting, markMatchedValues }: Props) => {
20
21
  total: number;
21
22
  matches: PotentialMatch[];
22
23
  entitiesMap: {