@reltio/components 1.4.1262 → 1.4.1264
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/DataTypeValue/DataTypeValue.d.ts +1 -1
- package/cjs/components/DataTypeValue/DataTypeValue.js +3 -1
- package/cjs/components/Highlighter/Highlighter.d.ts +2 -1
- package/cjs/components/Highlighter/Highlighter.js +15 -7
- package/cjs/components/SearchHighlighter/SearchHighlighter.d.ts +6 -0
- package/cjs/components/SearchHighlighter/SearchHighlighter.js +35 -0
- package/cjs/components/SearchHighlighter/styles.d.ts +1 -0
- package/cjs/components/SearchHighlighter/styles.js +9 -0
- package/cjs/components/attributes/readMode/ComplexAttribute/ComplexAttribute.js +2 -2
- package/cjs/components/attributes/readMode/NestedAttribute/NestedAttribute.js +3 -1
- package/cjs/components/attributes/readMode/ReferenceAttribute/ReferenceAttribute.js +4 -2
- package/cjs/contexts/SearchValueContext/index.d.ts +2 -0
- package/cjs/contexts/SearchValueContext/index.js +9 -0
- package/cjs/contexts/index.d.ts +1 -0
- package/cjs/contexts/index.js +3 -1
- package/esm/components/DataTypeValue/DataTypeValue.d.ts +1 -1
- package/esm/components/DataTypeValue/DataTypeValue.js +3 -1
- package/esm/components/Highlighter/Highlighter.d.ts +2 -1
- package/esm/components/Highlighter/Highlighter.js +15 -7
- package/esm/components/SearchHighlighter/SearchHighlighter.d.ts +6 -0
- package/esm/components/SearchHighlighter/SearchHighlighter.js +11 -0
- package/esm/components/SearchHighlighter/styles.d.ts +1 -0
- package/esm/components/SearchHighlighter/styles.js +6 -0
- package/esm/components/attributes/readMode/ComplexAttribute/ComplexAttribute.js +2 -2
- package/esm/components/attributes/readMode/NestedAttribute/NestedAttribute.js +3 -1
- package/esm/components/attributes/readMode/ReferenceAttribute/ReferenceAttribute.js +4 -2
- package/esm/contexts/SearchValueContext/index.d.ts +2 -0
- package/esm/contexts/SearchValueContext/index.js +3 -0
- package/esm/contexts/index.d.ts +1 -0
- package/esm/contexts/index.js +1 -0
- package/package.json +3 -3
|
@@ -10,6 +10,7 @@ var mdm_module_1 = __importDefault(require("@reltio/mdm-module"));
|
|
|
10
10
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
11
11
|
var react_redux_1 = require("react-redux");
|
|
12
12
|
var Link_1 = __importDefault(require("@material-ui/core/Link"));
|
|
13
|
+
var SearchHighlighter_1 = __importDefault(require("../SearchHighlighter/SearchHighlighter"));
|
|
13
14
|
var DataTypeValue = function (_a) {
|
|
14
15
|
var _b = _a.value, value = _b === void 0 ? null : _b, dataTypeDefinition = _a.dataTypeDefinition, _c = _a.rich, rich = _c === void 0 ? true : _c;
|
|
15
16
|
var attributePresentations = react_redux_1.useSelector(mdm_module_1.default.selectors.getAttributePresentations);
|
|
@@ -18,7 +19,8 @@ var DataTypeValue = function (_a) {
|
|
|
18
19
|
var dateMask = react_redux_1.useSelector(mdm_module_1.default.selectors.getDateMask) || localeDateFormat;
|
|
19
20
|
var dateTimeMask = react_redux_1.useSelector(mdm_module_1.default.selectors.getDateTimeMask) || localeDateFormat + ' ' + localeTimeFormat;
|
|
20
21
|
var formattedValue = mdm_sdk_1.formatDataTypeValue({ attributePresentations: attributePresentations, dataTypeDefinition: dataTypeDefinition, dateMask: dateMask, dateTimeMask: dateTimeMask }, value);
|
|
21
|
-
return rich && mdm_sdk_1.isAttributeValueLink(dataTypeDefinition, value) ? (react_1.default.createElement(Link_1.default, { target: "_blank", href: mdm_sdk_1.addProtocolToLink(formattedValue), underline: "none" },
|
|
22
|
+
return rich && mdm_sdk_1.isAttributeValueLink(dataTypeDefinition, value) ? (react_1.default.createElement(Link_1.default, { target: "_blank", href: mdm_sdk_1.addProtocolToLink(formattedValue), underline: "none" },
|
|
23
|
+
react_1.default.createElement(SearchHighlighter_1.default, { text: formattedValue }))) : (react_1.default.createElement(SearchHighlighter_1.default, { text: formattedValue }));
|
|
22
24
|
};
|
|
23
25
|
DataTypeValue.propTypes = {
|
|
24
26
|
value: prop_types_1.default.any,
|
|
@@ -3,6 +3,7 @@ declare type Props = {
|
|
|
3
3
|
text?: string;
|
|
4
4
|
highlight?: string;
|
|
5
5
|
className?: string;
|
|
6
|
+
multiTerm?: boolean;
|
|
6
7
|
};
|
|
7
|
-
declare const Highlighter: ({ text, highlight, className }: Props) => JSX.Element;
|
|
8
|
+
declare const Highlighter: ({ text, highlight, className, multiTerm }: Props) => JSX.Element;
|
|
8
9
|
export default Highlighter;
|
|
@@ -4,15 +4,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
var react_1 = __importDefault(require("react"));
|
|
7
|
+
var ramda_1 = require("ramda");
|
|
7
8
|
var styles_1 = require("./styles");
|
|
8
9
|
var Highlighter = function (_a) {
|
|
9
|
-
var
|
|
10
|
+
var text = _a.text, highlight = _a.highlight, className = _a.className, _b = _a.multiTerm, multiTerm = _b === void 0 ? false : _b;
|
|
10
11
|
var styles = styles_1.useStyles();
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
var hasHighlights = text && highlight;
|
|
13
|
+
if (!hasHighlights) {
|
|
14
|
+
return react_1.default.createElement(react_1.default.Fragment, null, text);
|
|
15
|
+
}
|
|
16
|
+
var REG_SPACES = new RegExp(/\s+/);
|
|
17
|
+
var getMultiTerms = ramda_1.pipe(ramda_1.trim, ramda_1.split(REG_SPACES), ramda_1.map(ramda_1.toLower), ramda_1.sort(ramda_1.ascend), ramda_1.reverse);
|
|
18
|
+
var highlightedValues = multiTerm ? getMultiTerms(highlight) : [ramda_1.toLower(highlight)];
|
|
19
|
+
var regValues = highlightedValues.map(function (item) { return item.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); });
|
|
20
|
+
var parts = text.split(new RegExp("(" + regValues.join('|') + ")", 'gi'));
|
|
21
|
+
return (react_1.default.createElement("span", null, parts.map(function (part, i) {
|
|
22
|
+
var isHighlightedText = highlightedValues.includes(part.toLocaleLowerCase());
|
|
23
|
+
return isHighlightedText ? (react_1.default.createElement("span", { key: i, className: className || styles.highlight }, part)) : (part);
|
|
24
|
+
})));
|
|
17
25
|
};
|
|
18
26
|
exports.default = Highlighter;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
var react_1 = __importStar(require("react"));
|
|
26
|
+
var contexts_1 = require("../../contexts");
|
|
27
|
+
var Highlighter_1 = __importDefault(require("../Highlighter/Highlighter"));
|
|
28
|
+
var styles_1 = require("./styles");
|
|
29
|
+
var SearchHighlighter = function (_a) {
|
|
30
|
+
var text = _a.text;
|
|
31
|
+
var styles = styles_1.useStyles();
|
|
32
|
+
var keywordValue = react_1.useContext(contexts_1.SearchValueContext);
|
|
33
|
+
return react_1.default.createElement(Highlighter_1.default, { text: text, highlight: keywordValue, className: styles.highlightedText, multiTerm: true });
|
|
34
|
+
};
|
|
35
|
+
exports.default = SearchHighlighter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"highlightedText">;
|
|
@@ -0,0 +1,9 @@
|
|
|
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 = styles_1.makeStyles({
|
|
6
|
+
highlightedText: {
|
|
7
|
+
background: 'rgb(255, 235, 203)'
|
|
8
|
+
}
|
|
9
|
+
});
|
|
@@ -41,10 +41,10 @@ var Typography_1 = __importDefault(require("@material-ui/core/Typography"));
|
|
|
41
41
|
var AttributesList_1 = __importDefault(require("../AttributesList/AttributesList"));
|
|
42
42
|
var ArrowExpandButton_1 = __importDefault(require("../../../ArrowExpandButton/ArrowExpandButton"));
|
|
43
43
|
var CommentsContainer_1 = __importDefault(require("../../../CommentsContainer/CommentsContainer"));
|
|
44
|
-
var classnames_2 = require("../../../../constants/classnames");
|
|
45
|
-
var styles_1 = require("./styles");
|
|
46
44
|
var contexts_1 = require("../../../../contexts");
|
|
47
45
|
var commonStyles_1 = require("../helpers/commonStyles");
|
|
46
|
+
var classnames_2 = require("../../../../constants/classnames");
|
|
47
|
+
var styles_1 = require("./styles");
|
|
48
48
|
var ComplexAttribute = function (_a) {
|
|
49
49
|
var _b;
|
|
50
50
|
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, RightSlot = _a.RightSlot;
|
|
@@ -52,6 +52,7 @@ var contexts_1 = require("../../../../contexts");
|
|
|
52
52
|
var historyAppearance_1 = require("../helpers/historyAppearance");
|
|
53
53
|
var ComplexAttribute_1 = __importDefault(require("../ComplexAttribute/ComplexAttribute"));
|
|
54
54
|
var PivotingTooltip_1 = require("../../PivotingAttributes/PivotingTooltip");
|
|
55
|
+
var SearchHighlighter_1 = __importDefault(require("../../../SearchHighlighter/SearchHighlighter"));
|
|
55
56
|
var styles_1 = __importDefault(require("./styles"));
|
|
56
57
|
var NestedAttribute = function (_a) {
|
|
57
58
|
var attributeValue = _a.attributeValue, attributeType = _a.attributeType, otherProps = __rest(_a, ["attributeValue", "attributeType"]);
|
|
@@ -64,7 +65,8 @@ var NestedAttribute = function (_a) {
|
|
|
64
65
|
? attributeValue.label
|
|
65
66
|
: mdm_sdk_1.evaluateDeepEntityLabel(attributeValue, attributeType.dataLabelPattern);
|
|
66
67
|
return (react_1.default.createElement(PivotingTooltip_1.PivotingTooltip, { className: styles.pivotingTooltip, value: attributeValue, attributeType: attributeType },
|
|
67
|
-
react_1.default.createElement(Box_1.default, { component: "span", className: classnames_1.default(styles[historyAttributesClassName], styles.label) },
|
|
68
|
+
react_1.default.createElement(Box_1.default, { component: "span", className: classnames_1.default(styles[historyAttributesClassName], styles.label) },
|
|
69
|
+
react_1.default.createElement(SearchHighlighter_1.default, { text: mdm_sdk_1.getLabel(label) }))));
|
|
68
70
|
}, [appearance, styles, attributeValue, attributeType]);
|
|
69
71
|
return (react_1.default.createElement(ComplexAttribute_1.default, __assign({ label: attributeLabel, attributeValue: attributeValue, attributeTypesList: mdm_sdk_1.getAttributeTypeSubAttributes({}, attributeType), attributeType: attributeType }, otherProps)));
|
|
70
72
|
};
|
|
@@ -51,6 +51,7 @@ var contexts_1 = require("../../../../contexts");
|
|
|
51
51
|
var ComplexAttribute_1 = __importDefault(require("../ComplexAttribute/ComplexAttribute"));
|
|
52
52
|
var historyAppearance_1 = require("../helpers/historyAppearance");
|
|
53
53
|
var InternalLink_1 = __importDefault(require("../../../InternalLink/InternalLink"));
|
|
54
|
+
var SearchHighlighter_1 = __importDefault(require("../../../SearchHighlighter/SearchHighlighter"));
|
|
54
55
|
var commonStyles_1 = require("../helpers/commonStyles");
|
|
55
56
|
var styles_1 = __importDefault(require("./styles"));
|
|
56
57
|
var ReferenceAttribute = function (_a) {
|
|
@@ -70,8 +71,9 @@ var ReferenceAttribute = function (_a) {
|
|
|
70
71
|
return (react_1.default.createElement(InternalLink_1.default, { href: mdm_sdk_1.isEmptyValue(appearance) ? mdm_sdk_1.getEntityLink({ uiPath: uiPath, uri: refEntityURI }) : undefined, className: classnames_1.default(styles[historyAttributesClassName], (_a = {},
|
|
71
72
|
_a[ovValueStyles.ovFalse] = !mdm_sdk_1.isOv(attributeValue),
|
|
72
73
|
_a)) },
|
|
73
|
-
mdm_sdk_1.getLabel(attributeValue.label),
|
|
74
|
-
attributeValue.relationshipLabel && (react_1.default.createElement("span", { className: styles.relationshipLabel },
|
|
74
|
+
react_1.default.createElement(SearchHighlighter_1.default, { text: mdm_sdk_1.getLabel(attributeValue.label) }),
|
|
75
|
+
attributeValue.relationshipLabel && (react_1.default.createElement("span", { className: styles.relationshipLabel },
|
|
76
|
+
react_1.default.createElement(SearchHighlighter_1.default, { text: attributeValue.relationshipLabel })))));
|
|
75
77
|
}, [attributeValue, appearance, uiPath, refEntityURI, styles, ovValueStyles.ovFalse]);
|
|
76
78
|
return (react_1.default.createElement(ComplexAttribute_1.default, __assign({ attributeTypesList: attributeTypeList, attributeValue: attributeValue, label: entityLabel, attributeType: attributeType }, otherProps)));
|
|
77
79
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
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.SearchValueContext = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
exports.SearchValueContext = react_1.default.createContext('');
|
|
9
|
+
exports.SearchValueContext.displayName = 'SearchValueContext';
|
package/cjs/contexts/index.d.ts
CHANGED
|
@@ -21,3 +21,4 @@ export { SearchFiltersContext } from './SearchFiltersContext';
|
|
|
21
21
|
export { SnackbarContext } from './SnackbarContext';
|
|
22
22
|
export { HighlightedValuesContext } from './HighlightedValuesContext';
|
|
23
23
|
export { InterceptHandlersContext } from './InterceptHandlersContext';
|
|
24
|
+
export { SearchValueContext } from './SearchValueContext';
|
package/cjs/contexts/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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.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");
|
|
@@ -54,3 +54,5 @@ var HighlightedValuesContext_1 = require("./HighlightedValuesContext");
|
|
|
54
54
|
Object.defineProperty(exports, "HighlightedValuesContext", { enumerable: true, get: function () { return HighlightedValuesContext_1.HighlightedValuesContext; } });
|
|
55
55
|
var InterceptHandlersContext_1 = require("./InterceptHandlersContext");
|
|
56
56
|
Object.defineProperty(exports, "InterceptHandlersContext", { enumerable: true, get: function () { return InterceptHandlersContext_1.InterceptHandlersContext; } });
|
|
57
|
+
var SearchValueContext_1 = require("./SearchValueContext");
|
|
58
|
+
Object.defineProperty(exports, "SearchValueContext", { enumerable: true, get: function () { return SearchValueContext_1.SearchValueContext; } });
|
|
@@ -5,6 +5,7 @@ import mdm from '@reltio/mdm-module';
|
|
|
5
5
|
import { formatDataTypeValue, isAttributeValueLink, addProtocolToLink } from '@reltio/mdm-sdk';
|
|
6
6
|
import { useSelector } from 'react-redux';
|
|
7
7
|
import Link from '@material-ui/core/Link';
|
|
8
|
+
import SearchHighlighter from '../SearchHighlighter/SearchHighlighter';
|
|
8
9
|
var DataTypeValue = function (_a) {
|
|
9
10
|
var _b = _a.value, value = _b === void 0 ? null : _b, dataTypeDefinition = _a.dataTypeDefinition, _c = _a.rich, rich = _c === void 0 ? true : _c;
|
|
10
11
|
var attributePresentations = useSelector(mdm.selectors.getAttributePresentations);
|
|
@@ -13,7 +14,8 @@ var DataTypeValue = function (_a) {
|
|
|
13
14
|
var dateMask = useSelector(mdm.selectors.getDateMask) || localeDateFormat;
|
|
14
15
|
var dateTimeMask = useSelector(mdm.selectors.getDateTimeMask) || localeDateFormat + ' ' + localeTimeFormat;
|
|
15
16
|
var formattedValue = formatDataTypeValue({ attributePresentations: attributePresentations, dataTypeDefinition: dataTypeDefinition, dateMask: dateMask, dateTimeMask: dateTimeMask }, value);
|
|
16
|
-
return rich && isAttributeValueLink(dataTypeDefinition, value) ? (React.createElement(Link, { target: "_blank", href: addProtocolToLink(formattedValue), underline: "none" },
|
|
17
|
+
return rich && isAttributeValueLink(dataTypeDefinition, value) ? (React.createElement(Link, { target: "_blank", href: addProtocolToLink(formattedValue), underline: "none" },
|
|
18
|
+
React.createElement(SearchHighlighter, { text: formattedValue }))) : (React.createElement(SearchHighlighter, { text: formattedValue }));
|
|
17
19
|
};
|
|
18
20
|
DataTypeValue.propTypes = {
|
|
19
21
|
value: PropTypes.any,
|
|
@@ -3,6 +3,7 @@ declare type Props = {
|
|
|
3
3
|
text?: string;
|
|
4
4
|
highlight?: string;
|
|
5
5
|
className?: string;
|
|
6
|
+
multiTerm?: boolean;
|
|
6
7
|
};
|
|
7
|
-
declare const Highlighter: ({ text, highlight, className }: Props) => JSX.Element;
|
|
8
|
+
declare const Highlighter: ({ text, highlight, className, multiTerm }: Props) => JSX.Element;
|
|
8
9
|
export default Highlighter;
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { ascend, map, pipe, reverse, sort, split, toLower, trim } from 'ramda';
|
|
2
3
|
import { useStyles } from './styles';
|
|
3
4
|
var Highlighter = function (_a) {
|
|
4
|
-
var
|
|
5
|
+
var text = _a.text, highlight = _a.highlight, className = _a.className, _b = _a.multiTerm, multiTerm = _b === void 0 ? false : _b;
|
|
5
6
|
var styles = useStyles();
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
var hasHighlights = text && highlight;
|
|
8
|
+
if (!hasHighlights) {
|
|
9
|
+
return React.createElement(React.Fragment, null, text);
|
|
10
|
+
}
|
|
11
|
+
var REG_SPACES = new RegExp(/\s+/);
|
|
12
|
+
var getMultiTerms = pipe(trim, split(REG_SPACES), map(toLower), sort(ascend), reverse);
|
|
13
|
+
var highlightedValues = multiTerm ? getMultiTerms(highlight) : [toLower(highlight)];
|
|
14
|
+
var regValues = highlightedValues.map(function (item) { return item.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); });
|
|
15
|
+
var parts = text.split(new RegExp("(" + regValues.join('|') + ")", 'gi'));
|
|
16
|
+
return (React.createElement("span", null, parts.map(function (part, i) {
|
|
17
|
+
var isHighlightedText = highlightedValues.includes(part.toLocaleLowerCase());
|
|
18
|
+
return isHighlightedText ? (React.createElement("span", { key: i, className: className || styles.highlight }, part)) : (part);
|
|
19
|
+
})));
|
|
12
20
|
};
|
|
13
21
|
export default Highlighter;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { SearchValueContext } from '../../contexts';
|
|
3
|
+
import Highlighter from '../Highlighter/Highlighter';
|
|
4
|
+
import { useStyles } from './styles';
|
|
5
|
+
var SearchHighlighter = function (_a) {
|
|
6
|
+
var text = _a.text;
|
|
7
|
+
var styles = useStyles();
|
|
8
|
+
var keywordValue = useContext(SearchValueContext);
|
|
9
|
+
return React.createElement(Highlighter, { text: text, highlight: keywordValue, className: styles.highlightedText, multiTerm: true });
|
|
10
|
+
};
|
|
11
|
+
export default SearchHighlighter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"highlightedText">;
|
|
@@ -17,10 +17,10 @@ import Typography from '@material-ui/core/Typography';
|
|
|
17
17
|
import AttributesList from '../AttributesList/AttributesList';
|
|
18
18
|
import ArrowExpandButton from '../../../ArrowExpandButton/ArrowExpandButton';
|
|
19
19
|
import CommentsContainer from '../../../CommentsContainer/CommentsContainer';
|
|
20
|
-
import { COMMENTS_CONTAINER_VISIBILITY_AREA } from '../../../../constants/classnames';
|
|
21
|
-
import { useStyles } from './styles';
|
|
22
20
|
import { HighlightedValuesContext } from '../../../../contexts';
|
|
23
21
|
import { useOvValueStyles } from '../helpers/commonStyles';
|
|
22
|
+
import { COMMENTS_CONTAINER_VISIBILITY_AREA } from '../../../../constants/classnames';
|
|
23
|
+
import { useStyles } from './styles';
|
|
24
24
|
var ComplexAttribute = function (_a) {
|
|
25
25
|
var _b;
|
|
26
26
|
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, RightSlot = _a.RightSlot;
|
|
@@ -28,6 +28,7 @@ import { HistoryDiffContext } from '../../../../contexts';
|
|
|
28
28
|
import { getHistoryAppearanceByUri, getHistoryAttributeClassName } from '../helpers/historyAppearance';
|
|
29
29
|
import ComplexAttribute from '../ComplexAttribute/ComplexAttribute';
|
|
30
30
|
import { PivotingTooltip } from '../../PivotingAttributes/PivotingTooltip';
|
|
31
|
+
import SearchHighlighter from '../../../SearchHighlighter/SearchHighlighter';
|
|
31
32
|
import useStyles from './styles';
|
|
32
33
|
var NestedAttribute = function (_a) {
|
|
33
34
|
var attributeValue = _a.attributeValue, attributeType = _a.attributeType, otherProps = __rest(_a, ["attributeValue", "attributeType"]);
|
|
@@ -40,7 +41,8 @@ var NestedAttribute = function (_a) {
|
|
|
40
41
|
? attributeValue.label
|
|
41
42
|
: evaluateDeepEntityLabel(attributeValue, attributeType.dataLabelPattern);
|
|
42
43
|
return (React.createElement(PivotingTooltip, { className: styles.pivotingTooltip, value: attributeValue, attributeType: attributeType },
|
|
43
|
-
React.createElement(Box, { component: "span", className: classnames(styles[historyAttributesClassName], styles.label) },
|
|
44
|
+
React.createElement(Box, { component: "span", className: classnames(styles[historyAttributesClassName], styles.label) },
|
|
45
|
+
React.createElement(SearchHighlighter, { text: getLabel(label) }))));
|
|
44
46
|
}, [appearance, styles, attributeValue, attributeType]);
|
|
45
47
|
return (React.createElement(ComplexAttribute, __assign({ label: attributeLabel, attributeValue: attributeValue, attributeTypesList: getAttributeTypeSubAttributes({}, attributeType), attributeType: attributeType }, otherProps)));
|
|
46
48
|
};
|
|
@@ -27,6 +27,7 @@ import { HistoryDiffContext } from '../../../../contexts';
|
|
|
27
27
|
import ComplexAttribute from '../ComplexAttribute/ComplexAttribute';
|
|
28
28
|
import { getHistoryAppearanceByUri, getHistoryAttributeClassName } from '../helpers/historyAppearance';
|
|
29
29
|
import InternalLink from '../../../InternalLink/InternalLink';
|
|
30
|
+
import SearchHighlighter from '../../../SearchHighlighter/SearchHighlighter';
|
|
30
31
|
import { useOvValueStyles } from '../helpers/commonStyles';
|
|
31
32
|
import useStyles from './styles';
|
|
32
33
|
var ReferenceAttribute = function (_a) {
|
|
@@ -46,8 +47,9 @@ var ReferenceAttribute = function (_a) {
|
|
|
46
47
|
return (React.createElement(InternalLink, { href: isEmptyValue(appearance) ? getEntityLink({ uiPath: uiPath, uri: refEntityURI }) : undefined, className: classnames(styles[historyAttributesClassName], (_a = {},
|
|
47
48
|
_a[ovValueStyles.ovFalse] = !isOv(attributeValue),
|
|
48
49
|
_a)) },
|
|
49
|
-
getLabel(attributeValue.label),
|
|
50
|
-
attributeValue.relationshipLabel && (React.createElement("span", { className: styles.relationshipLabel },
|
|
50
|
+
React.createElement(SearchHighlighter, { text: getLabel(attributeValue.label) }),
|
|
51
|
+
attributeValue.relationshipLabel && (React.createElement("span", { className: styles.relationshipLabel },
|
|
52
|
+
React.createElement(SearchHighlighter, { text: attributeValue.relationshipLabel })))));
|
|
51
53
|
}, [attributeValue, appearance, uiPath, refEntityURI, styles, ovValueStyles.ovFalse]);
|
|
52
54
|
return (React.createElement(ComplexAttribute, __assign({ attributeTypesList: attributeTypeList, attributeValue: attributeValue, label: entityLabel, attributeType: attributeType }, otherProps)));
|
|
53
55
|
};
|
package/esm/contexts/index.d.ts
CHANGED
|
@@ -21,3 +21,4 @@ export { SearchFiltersContext } from './SearchFiltersContext';
|
|
|
21
21
|
export { SnackbarContext } from './SnackbarContext';
|
|
22
22
|
export { HighlightedValuesContext } from './HighlightedValuesContext';
|
|
23
23
|
export { InterceptHandlersContext } from './InterceptHandlersContext';
|
|
24
|
+
export { SearchValueContext } from './SearchValueContext';
|
package/esm/contexts/index.js
CHANGED
|
@@ -21,3 +21,4 @@ export { SearchFiltersContext } from './SearchFiltersContext';
|
|
|
21
21
|
export { SnackbarContext } from './SnackbarContext';
|
|
22
22
|
export { HighlightedValuesContext } from './HighlightedValuesContext';
|
|
23
23
|
export { InterceptHandlersContext } from './InterceptHandlersContext';
|
|
24
|
+
export { SearchValueContext } from './SearchValueContext';
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1264",
|
|
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.1264",
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1264",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|