@reltio/components 1.4.1206 → 1.4.1209

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 (37) hide show
  1. package/cjs/components/DropDownMenuButton/DropDownMenuButton.d.ts +2 -2
  2. package/cjs/components/DropDownMenuButton/MenuItemRenderer.d.ts +2 -8
  3. package/cjs/components/DropDownMenuButton/MenuItemRenderer.js +3 -1
  4. package/cjs/components/MatchRulesBlock/MatchRulesBlock.js +2 -3
  5. package/cjs/components/MatchRulesBlock/SimpleMatchRulesBuilder/SimpleMatchRulesBuilder.js +3 -3
  6. package/cjs/components/MatchRulesBlock/types/index.d.ts +0 -2
  7. package/cjs/components/MatchRulesBlock/types/index.js +0 -2
  8. package/cjs/components/attributes/readMode/AttributeValuesBlock/AttributeValuesBlock.d.ts +1 -0
  9. package/cjs/components/attributes/readMode/ComplexAttribute/ComplexAttribute.js +3 -0
  10. package/cjs/components/attributes/readMode/ReferenceAttribute/ReferenceAttribute.js +8 -10
  11. package/cjs/components/attributes/readMode/SimpleAttribute/SimpleAttribute.js +9 -7
  12. package/cjs/components/attributes/readMode/helpers/commonStyles.d.ts +1 -0
  13. package/cjs/components/attributes/readMode/helpers/commonStyles.js +7 -0
  14. package/cjs/components/editors/DependentLookupEditor/DependentLookupEditor.d.ts +3 -1
  15. package/cjs/components/editors/DependentLookupEditor/DependentLookupEditor.js +30 -32
  16. package/cjs/components/editors/TypeaheadEditor/TypeaheadEditor.d.ts +3 -1
  17. package/cjs/components/editors/TypeaheadEditor/TypeaheadEditor.js +11 -10
  18. package/cjs/types/index.d.ts +17 -0
  19. package/esm/components/DropDownMenuButton/DropDownMenuButton.d.ts +2 -2
  20. package/esm/components/DropDownMenuButton/MenuItemRenderer.d.ts +2 -8
  21. package/esm/components/DropDownMenuButton/MenuItemRenderer.js +3 -1
  22. package/esm/components/MatchRulesBlock/MatchRulesBlock.js +2 -3
  23. package/esm/components/MatchRulesBlock/SimpleMatchRulesBuilder/SimpleMatchRulesBuilder.js +3 -3
  24. package/esm/components/MatchRulesBlock/types/index.d.ts +0 -2
  25. package/esm/components/MatchRulesBlock/types/index.js +0 -2
  26. package/esm/components/attributes/readMode/AttributeValuesBlock/AttributeValuesBlock.d.ts +1 -0
  27. package/esm/components/attributes/readMode/ComplexAttribute/ComplexAttribute.js +4 -1
  28. package/esm/components/attributes/readMode/ReferenceAttribute/ReferenceAttribute.js +9 -11
  29. package/esm/components/attributes/readMode/SimpleAttribute/SimpleAttribute.js +10 -8
  30. package/esm/components/attributes/readMode/helpers/commonStyles.d.ts +1 -0
  31. package/esm/components/attributes/readMode/helpers/commonStyles.js +4 -0
  32. package/esm/components/editors/DependentLookupEditor/DependentLookupEditor.d.ts +3 -1
  33. package/esm/components/editors/DependentLookupEditor/DependentLookupEditor.js +30 -32
  34. package/esm/components/editors/TypeaheadEditor/TypeaheadEditor.d.ts +3 -1
  35. package/esm/components/editors/TypeaheadEditor/TypeaheadEditor.js +11 -10
  36. package/esm/types/index.d.ts +17 -0
  37. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { MenuProps } from '@material-ui/core/Menu';
3
- import { Item } from './MenuItemRenderer';
3
+ import { DropDownMenuItem } from '../../types';
4
4
  declare type Props<T> = {
5
5
  className?: string;
6
6
  buttonComponent?: React.ElementType;
@@ -13,7 +13,7 @@ declare type Props<T> = {
13
13
  onMenuClose?: () => void;
14
14
  MenuItemRenderer?: (props: any) => JSX.Element;
15
15
  };
16
- declare function DropDownMenuButton<T = Item>({ className, menuId, buttonComponent, buttonContent, menuItems, buttonProps, popoverProps, onMenuOpen, onMenuClose, MenuItemRenderer }: Props<T>): JSX.Element;
16
+ declare function DropDownMenuButton<T = DropDownMenuItem>({ className, menuId, buttonComponent, buttonContent, menuItems, buttonProps, popoverProps, onMenuOpen, onMenuClose, MenuItemRenderer }: Props<T>): JSX.Element;
17
17
  declare namespace DropDownMenuButton {
18
18
  var displayName: string;
19
19
  }
@@ -1,13 +1,7 @@
1
1
  import React from 'react';
2
- export declare type Item = {
3
- text?: string;
4
- disabled?: boolean;
5
- tooltip?: string;
6
- id?: string;
7
- onClick?: (e: any) => void;
8
- };
2
+ import { DropDownMenuItem } from '../../types';
9
3
  declare type Props = {
10
- item: Item;
4
+ item: DropDownMenuItem;
11
5
  onMenuClose?: (e: any) => void;
12
6
  };
13
7
  declare const MenuItemRenderer: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLLIElement>>;
@@ -24,6 +24,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  var react_1 = __importStar(require("react"));
26
26
  var ramda_1 = require("ramda");
27
+ var Checkbox_1 = __importDefault(require("@material-ui/core/Checkbox"));
27
28
  var MenuItem_1 = __importDefault(require("@material-ui/core/MenuItem"));
28
29
  var Typography_1 = __importDefault(require("@material-ui/core/Typography"));
29
30
  var withTooltip_1 = __importDefault(require("../../HOCs/withTooltip/withTooltip"));
@@ -32,12 +33,13 @@ var MenuItemWithTooltip = withTooltip_1.default(MenuItem_1.default);
32
33
  var MenuItemRenderer = react_1.forwardRef(function (_a, ref) {
33
34
  var item = _a.item, _b = _a.onMenuClose, onMenuClose = _b === void 0 ? ramda_1.identity : _b;
34
35
  var styles = styles_1.useStyles();
35
- var disabled = item.disabled, text = item.text, tooltip = item.tooltip, onClick = item.onClick, _c = item.id, id = _c === void 0 ? '' : _c;
36
+ var disabled = item.disabled, text = item.text, tooltip = item.tooltip, onClick = item.onClick, _c = item.id, id = _c === void 0 ? '' : _c, selectable = item.selectable, selected = item.selected;
36
37
  var handleClick = function (e) {
37
38
  onMenuClose(e);
38
39
  onClick(e);
39
40
  };
40
41
  return (react_1.default.createElement(MenuItemWithTooltip, { tooltipTitle: tooltip, showForDisabled: true, classes: { root: styles.menuItem }, onClick: handleClick, disabled: disabled, ref: ref, "data-modal": true, "data-reltio-id": "reltio-search-menu-item" + id },
42
+ selectable && react_1.default.createElement(Checkbox_1.default, { checked: selected, color: "primary" }),
41
43
  react_1.default.createElement(Typography_1.default, { classes: { root: styles.menuText } }, text)));
42
44
  });
43
45
  MenuItemRenderer.displayName = 'MenuItemRenderer';
@@ -22,11 +22,10 @@ var MatchRulesBlock = function (_a) {
22
22
  return uri !== mdm_sdk_1.NOT_MATCH;
23
23
  });
24
24
  var hasNotMatch = rules.length !== matchRules.length;
25
- var showTransitive = isTransitive && variant !== types_1.MatchRuleVariant.ml;
26
25
  var showSimple = !isTransitive && !hasNotMatch;
27
- var showNotMatch = hasNotMatch && ![types_1.MatchRuleVariant.excludeNotMatch, types_1.MatchRuleVariant.ml].includes(variant);
26
+ var showNotMatch = hasNotMatch && variant !== types_1.MatchRuleVariant.excludeNotMatch;
28
27
  return (react_1.default.createElement(react_1.default.Fragment, null,
29
- showTransitive ? (react_1.default.createElement(TransitiveMatchBlock_1.default, { transitiveMatchRules: mdm_sdk_1.getTransitiveMatchRules(metadata, match, entitiesMap) })) : null,
28
+ isTransitive ? (react_1.default.createElement(TransitiveMatchBlock_1.default, { transitiveMatchRules: mdm_sdk_1.getTransitiveMatchRules(metadata, match, entitiesMap) })) : null,
30
29
  showSimple ? (react_1.default.createElement(SimpleMatchRulesBuilder_1.default, { variant: variant, matchRules: matchRules, Component: SimpleMatchRulesBlock_1.default })) : null,
31
30
  showNotMatch ? react_1.default.createElement(NotMatchRule_1.default, null) : null));
32
31
  };
@@ -33,9 +33,9 @@ var types_1 = require("../types");
33
33
  var SimpleMatchRulesBuilder = function (_a) {
34
34
  var matchRules = _a.matchRules, Component = _a.Component, _b = _a.variant, variant = _b === void 0 ? types_1.MatchRuleVariant.all : _b, otherProps = __rest(_a, ["matchRules", "Component", "variant"]);
35
35
  var _c = mdm_sdk_1.partitionByMlMatch(matchRules), MlMatchRules = _c[0], otherMatchRules = _c[1];
36
- var all = types_1.MatchRuleVariant.all, simple = types_1.MatchRuleVariant.simple, ml = types_1.MatchRuleVariant.ml, excludeML = types_1.MatchRuleVariant.excludeML, excludeNotMatch = types_1.MatchRuleVariant.excludeNotMatch;
37
- var showSimple = [all, simple, excludeML, excludeNotMatch].includes(variant) && !ramda_1.isEmpty(otherMatchRules);
38
- var showML = [all, ml, excludeNotMatch, excludeNotMatch].includes(variant) && !ramda_1.isEmpty(MlMatchRules);
36
+ var all = types_1.MatchRuleVariant.all, simple = types_1.MatchRuleVariant.simple, excludeNotMatch = types_1.MatchRuleVariant.excludeNotMatch;
37
+ var showSimple = [all, simple, excludeNotMatch].includes(variant) && !ramda_1.isEmpty(otherMatchRules);
38
+ var showML = [all, excludeNotMatch].includes(variant) && !ramda_1.isEmpty(MlMatchRules);
39
39
  return (react_1.default.createElement(react_1.default.Fragment, null,
40
40
  showSimple ? react_1.default.createElement(Component, __assign({ matchRules: otherMatchRules }, otherProps)) : null,
41
41
  showML ? react_1.default.createElement(Component, __assign({ isMlMatch: true, matchRules: MlMatchRules }, otherProps)) : null));
@@ -5,9 +5,7 @@ declare type MatchRule = {
5
5
  export declare type MatchRules = MatchRule[];
6
6
  export declare enum MatchRuleVariant {
7
7
  all = "all",
8
- ml = "ml",
9
8
  simple = "simple",
10
- excludeML = "excludeML",
11
9
  excludeNotMatch = "excludeNotMatch"
12
10
  }
13
11
  export declare type TransitiveMatchRules = Array<{
@@ -4,8 +4,6 @@ exports.MatchRuleVariant = void 0;
4
4
  var MatchRuleVariant;
5
5
  (function (MatchRuleVariant) {
6
6
  MatchRuleVariant["all"] = "all";
7
- MatchRuleVariant["ml"] = "ml";
8
7
  MatchRuleVariant["simple"] = "simple";
9
- MatchRuleVariant["excludeML"] = "excludeML";
10
8
  MatchRuleVariant["excludeNotMatch"] = "excludeNotMatch";
11
9
  })(MatchRuleVariant = exports.MatchRuleVariant || (exports.MatchRuleVariant = {}));
@@ -9,6 +9,7 @@ declare type Props = {
9
9
  attributeType: any;
10
10
  attributeValue: any;
11
11
  }) => JSX.Element;
12
+ showNonOv?: boolean;
12
13
  };
13
14
  declare const _default: React.MemoExoticComponent<({ expanded, LabelRenderer, ...props }: Props) => JSX.Element>;
14
15
  export default _default;
@@ -44,10 +44,12 @@ var CommentsContainer_1 = __importDefault(require("../../../CommentsContainer/Co
44
44
  var classnames_2 = require("../../../../constants/classnames");
45
45
  var styles_1 = require("./styles");
46
46
  var contexts_1 = require("../../../../contexts");
47
+ var commonStyles_1 = require("../helpers/commonStyles");
47
48
  var ComplexAttribute = function (_a) {
48
49
  var _b;
49
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;
50
51
  var styles = styles_1.useStyles();
52
+ var ovValueStyles = commonStyles_1.useOvValueStyles();
51
53
  var uri = attributeValue.uri;
52
54
  var _d = react_1.useState(false), expanded = _d[0], setExpanded = _d[1];
53
55
  var _e = react_1.useContext(contexts_1.HighlightedValuesContext), _f = _e.highlightedValuesUris, highlightedValuesUris = _f === void 0 ? [] : _f, highlightedClassName = _e.highlightedClassName;
@@ -67,6 +69,7 @@ var ComplexAttribute = function (_a) {
67
69
  _b[highlightedClassName] = highlightedValuesUris.some(function (uri) {
68
70
  return mdm_sdk_1.areOneHierarchyUris(uri, attributeValue.uri);
69
71
  }),
72
+ _b[ovValueStyles.ovFalse] = !mdm_sdk_1.isOv(attributeValue),
70
73
  _b)), "data-reltio-id": "reltio-attribute-complex-label" }, label),
71
74
  react_1.default.createElement("div", { className: styles.spacer }),
72
75
  react_1.default.createElement(CommentsContainer_1.default, { uri: attributeValue.uri, relatedObjectUris: mdm_sdk_1.createRelatedObjectUris(objectType, {
@@ -45,15 +45,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
45
45
  };
46
46
  Object.defineProperty(exports, "__esModule", { value: true });
47
47
  var react_1 = __importStar(require("react"));
48
+ var classnames_1 = __importDefault(require("classnames"));
48
49
  var mdm_sdk_1 = require("@reltio/mdm-sdk");
49
50
  var contexts_1 = require("../../../../contexts");
50
51
  var ComplexAttribute_1 = __importDefault(require("../ComplexAttribute/ComplexAttribute"));
51
52
  var historyAppearance_1 = require("../helpers/historyAppearance");
52
53
  var InternalLink_1 = __importDefault(require("../../../InternalLink/InternalLink"));
54
+ var commonStyles_1 = require("../helpers/commonStyles");
53
55
  var styles_1 = __importDefault(require("./styles"));
54
56
  var ReferenceAttribute = function (_a) {
55
57
  var attributeValue = _a.attributeValue, metadata = _a.metadata, attributeType = _a.attributeType, uiPath = _a.uiPath, otherProps = __rest(_a, ["attributeValue", "metadata", "attributeType", "uiPath"]);
56
58
  var styles = styles_1.default();
59
+ var ovValueStyles = commonStyles_1.useOvValueStyles();
57
60
  var refEntityURI = mdm_sdk_1.getReferencedEntityUriFromAttrValue(attributeValue);
58
61
  var attributeTypeList = react_1.useMemo(function () { return mdm_sdk_1.getAttributeTypeSubAttributes(metadata, attributeType); }, [
59
62
  attributeType,
@@ -61,20 +64,15 @@ var ReferenceAttribute = function (_a) {
61
64
  ]);
62
65
  var appearance = react_1.useContext(contexts_1.HistoryDiffContext).appearance;
63
66
  var entityLabel = react_1.useMemo(function () {
67
+ var _a;
64
68
  var attributeAppearance = historyAppearance_1.getHistoryAppearanceByUri(attributeValue.uri, appearance);
65
69
  var historyAttributesClassName = historyAppearance_1.getHistoryAttributeClassName(attributeAppearance);
66
- return (react_1.default.createElement(InternalLink_1.default, { href: mdm_sdk_1.isEmptyValue(appearance) ? mdm_sdk_1.getEntityLink({ uiPath: uiPath, uri: refEntityURI }) : undefined, className: styles[historyAttributesClassName] },
70
+ 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
+ _a[ovValueStyles.ovFalse] = !mdm_sdk_1.isOv(attributeValue),
72
+ _a)) },
67
73
  mdm_sdk_1.getLabel(attributeValue.label),
68
74
  attributeValue.relationshipLabel && (react_1.default.createElement("span", { className: styles.relationshipLabel }, attributeValue.relationshipLabel))));
69
- }, [
70
- attributeValue.uri,
71
- attributeValue.label,
72
- attributeValue.relationshipLabel,
73
- appearance,
74
- refEntityURI,
75
- styles,
76
- uiPath
77
- ]);
75
+ }, [attributeValue, appearance, uiPath, refEntityURI, styles, ovValueStyles.ovFalse]);
78
76
  return (react_1.default.createElement(ComplexAttribute_1.default, __assign({ attributeTypesList: attributeTypeList, attributeValue: attributeValue, label: entityLabel, attributeType: attributeType }, otherProps)));
79
77
  };
80
78
  ReferenceAttribute.propTypes = mdm_sdk_1.ReferenceAttributeType;
@@ -33,11 +33,13 @@ var PivotingTooltip_1 = require("../../PivotingAttributes/PivotingTooltip");
33
33
  var historyAppearance_1 = require("../helpers/historyAppearance");
34
34
  var styles_1 = require("./styles");
35
35
  var contexts_1 = require("../../../../contexts");
36
+ var commonStyles_1 = require("../helpers/commonStyles");
36
37
  var SimpleAttribute = function (_a) {
37
- var _b, _c, _d;
38
- var className = _a.className, _e = _a.attributeType, attributeType = _e === void 0 ? null : _e, attributeValue = _a.attributeValue, inlined = _a.inlined;
38
+ var _b, _c, _d, _e, _f;
39
+ var className = _a.className, _g = _a.attributeType, attributeType = _g === void 0 ? null : _g, attributeValue = _a.attributeValue, inlined = _a.inlined;
39
40
  var styles = styles_1.useStyles();
40
- var _f = react_1.useContext(contexts_1.HighlightedValuesContext), _g = _f.highlightedValuesUris, highlightedValuesUris = _g === void 0 ? [] : _g, highlightedClassName = _f.highlightedClassName;
41
+ var ovValueStyles = commonStyles_1.useOvValueStyles();
42
+ var _h = react_1.useContext(contexts_1.HighlightedValuesContext), _j = _h.highlightedValuesUris, highlightedValuesUris = _j === void 0 ? [] : _j, highlightedClassName = _h.highlightedClassName;
41
43
  var appearance = react_1.useContext(HistoryAppearanceContext_1.HistoryDiffContext).appearance;
42
44
  var attributeAppearance = historyAppearance_1.getHistoryAppearanceByUri(attributeValue.uri, appearance);
43
45
  var historyClassName = historyAppearance_1.getHistoryAttributeClassName(attributeAppearance);
@@ -49,11 +51,11 @@ var SimpleAttribute = function (_a) {
49
51
  _b[highlightedClassName] = highlightedValuesUris.includes(attributeValue.uri),
50
52
  _b)) },
51
53
  react_1.default.createElement(PivotingTooltip_1.PivotingTooltip, { value: attributeValue, attributeType: attributeType, key: attributeValue.uri, className: classnames_1.default((_c = {}, _c[styles.multilineAttribute] = !inlined, _c)) },
52
- react_1.default.createElement("span", { className: styles[historyClassName], "data-reltio-id": "reltio-attribute-value" }, dataTypeValue)))) : (react_1.default.createElement("div", { className: classnames_1.default(className, styles.root, classnames_2.COMMENTS_CONTAINER_VISIBILITY_AREA, (_d = {},
53
- _d[highlightedClassName] = highlightedValuesUris.includes(attributeValue.uri),
54
- _d)) },
54
+ react_1.default.createElement("span", { className: classnames_1.default(styles[historyClassName], (_d = {}, _d[ovValueStyles.ovFalse] = !mdm_sdk_1.isOv(attributeValue), _d)), "data-reltio-id": "reltio-attribute-value" }, dataTypeValue)))) : (react_1.default.createElement("div", { className: classnames_1.default(className, styles.root, classnames_2.COMMENTS_CONTAINER_VISIBILITY_AREA, (_e = {},
55
+ _e[highlightedClassName] = highlightedValuesUris.includes(attributeValue.uri),
56
+ _e)) },
55
57
  react_1.default.createElement(PivotingTooltip_1.PivotingTooltip, { value: attributeValue, attributeType: attributeType, key: attributeValue.uri },
56
- react_1.default.createElement("span", { className: styles.attributeValue, "data-reltio-id": "reltio-attribute-value" }, dataTypeValue)),
58
+ react_1.default.createElement("span", { className: classnames_1.default(styles.attributeValue, (_f = {}, _f[ovValueStyles.ovFalse] = !mdm_sdk_1.isOv(attributeValue), _f)), "data-reltio-id": "reltio-attribute-value" }, dataTypeValue)),
57
59
  react_1.default.createElement(CommentsContainer_1.default, { className: styles.commentsContainer, uri: attributeValue.uri, relatedObjectUris: mdm_sdk_1.createRelatedObjectUris(objectType, {
58
60
  uri: attributeValue.uri
59
61
  }), objectType: objectType })));
@@ -0,0 +1 @@
1
+ export declare const useOvValueStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"ovFalse">;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useOvValueStyles = void 0;
4
+ var styles_1 = require("@material-ui/core/styles");
5
+ exports.useOvValueStyles = styles_1.makeStyles(function (theme) { return ({
6
+ ovFalse: theme.inactive
7
+ }); });
@@ -1,6 +1,6 @@
1
1
  export const DEBOUNCE_INTERVAL: 400;
2
2
  export default DependentLookupEditor;
3
- declare function DependentLookupEditor({ multiple, value, lookupCode: lookupTypeCode, TextFieldProps, parents, onChange, getLookups, lookups, resolveLookups, fullWidth, disabled, placeholder, autopopulationId, ...otherProps }: {
3
+ declare function DependentLookupEditor({ multiple, value, lookupCode: lookupTypeCode, TextFieldProps, parents, onChange, getLookups, lookups, resolveLookups, fullWidth, disabled, placeholder, autopopulationId, max, ...otherProps }: {
4
4
  [x: string]: any;
5
5
  multiple: any;
6
6
  value: any;
@@ -15,6 +15,7 @@ declare function DependentLookupEditor({ multiple, value, lookupCode: lookupType
15
15
  disabled: any;
16
16
  placeholder: any;
17
17
  autopopulationId: any;
18
+ max?: number;
18
19
  }): JSX.Element;
19
20
  declare namespace DependentLookupEditor {
20
21
  namespace propTypes {
@@ -41,6 +42,7 @@ declare namespace DependentLookupEditor {
41
42
  const placeholder: PropTypes.Requireable<string>;
42
43
  const disabled: PropTypes.Requireable<boolean>;
43
44
  const autopopulationId: PropTypes.Requireable<string>;
45
+ const max: PropTypes.Requireable<number>;
44
46
  }
45
47
  }
46
48
  import PropTypes from "prop-types";
@@ -64,6 +64,7 @@ var useDefaultOptions_1 = __importDefault(require("./useDefaultOptions"));
64
64
  var useAutopopulation_1 = __importDefault(require("./useAutopopulation"));
65
65
  var useSavingFocus_1 = __importDefault(require("./useSavingFocus"));
66
66
  var LoadMoreButton_1 = __importDefault(require("../../commonReactSelectComponents/LoadMoreButton"));
67
+ var hooks_1 = require("../../../hooks");
67
68
  var SelectComponents = {
68
69
  IndicatorSeparator: utils_1.EmptyStub,
69
70
  LoadingIndicator: utils_1.EmptyStub,
@@ -76,7 +77,7 @@ var SelectComponents = {
76
77
  exports.DEBOUNCE_INTERVAL = 400;
77
78
  var MAX_DEPENDENT_LOOKUP_VALUES = 50;
78
79
  var DependentLookupEditor = function (_a) {
79
- var multiple = _a.multiple, value = _a.value, lookupTypeCode = _a.lookupCode, TextFieldProps = _a.TextFieldProps, parents = _a.parents, onChange = _a.onChange, getLookups = _a.getLookups, _b = _a.lookups, lookups = _b === void 0 ? {} : _b, resolveLookups = _a.resolveLookups, fullWidth = _a.fullWidth, disabled = _a.disabled, placeholder = _a.placeholder, autopopulationId = _a.autopopulationId, otherProps = __rest(_a, ["multiple", "value", "lookupCode", "TextFieldProps", "parents", "onChange", "getLookups", "lookups", "resolveLookups", "fullWidth", "disabled", "placeholder", "autopopulationId"]);
80
+ var multiple = _a.multiple, value = _a.value, lookupTypeCode = _a.lookupCode, TextFieldProps = _a.TextFieldProps, parents = _a.parents, onChange = _a.onChange, getLookups = _a.getLookups, _b = _a.lookups, lookups = _b === void 0 ? {} : _b, resolveLookups = _a.resolveLookups, fullWidth = _a.fullWidth, disabled = _a.disabled, placeholder = _a.placeholder, autopopulationId = _a.autopopulationId, _c = _a.max, max = _c === void 0 ? MAX_DEPENDENT_LOOKUP_VALUES : _c, otherProps = __rest(_a, ["multiple", "value", "lookupCode", "TextFieldProps", "parents", "onChange", "getLookups", "lookups", "resolveLookups", "fullWidth", "disabled", "placeholder", "autopopulationId", "max"]);
80
81
  var inputRef = react_1.useRef(null);
81
82
  var selectRef = react_1.useRef(null);
82
83
  var styles = styles_1.useStyles();
@@ -87,10 +88,10 @@ var DependentLookupEditor = function (_a) {
87
88
  onLookupsResolve: function (lookups) { return onChange(multiple ? lookups : lookups[0]); }
88
89
  });
89
90
  useSavingFocus_1.default(selectRef, inputRef, disabled);
90
- var _c = react_1.useState(''), inputValue = _c[0], setInputValue = _c[1];
91
- var _d = react_1.useState([]), options = _d[0], setOptions = _d[1];
92
- var _e = react_1.useState(1), pageNumber = _e[0], setPageNumber = _e[1];
93
- var _f = react_1.useState(false), nextPageIsLoading = _f[0], setNextPageIsLoading = _f[1];
91
+ var _d = react_1.useState(''), inputValue = _d[0], setInputValue = _d[1];
92
+ var _e = react_1.useState([]), options = _e[0], setOptions = _e[1];
93
+ var _f = react_1.useState(1), pageNumber = _f[0], setPageNumber = _f[1];
94
+ var _g = react_1.useState(false), optionsAreLoading = _g[0], setOptionsAreLoading = _g[1];
94
95
  var handleInputChange = function (value) {
95
96
  if (value !== inputValue) {
96
97
  setInputValue(value);
@@ -100,41 +101,35 @@ var DependentLookupEditor = function (_a) {
100
101
  };
101
102
  var loadOptions = react_1.useCallback(function (value, pageNumber) {
102
103
  if (pageNumber === void 0) { pageNumber = 1; }
104
+ setOptionsAreLoading(true);
103
105
  return getLookups({
104
106
  type: lookupTypeCode,
105
107
  parents: parents,
106
108
  displayNamePrefix: value,
107
- max: MAX_DEPENDENT_LOOKUP_VALUES + 1,
108
- offset: (pageNumber - 1) * MAX_DEPENDENT_LOOKUP_VALUES
109
- }).then(function (buildOptions) { return helpers_1.buildLookupOptions(buildOptions); });
110
- }, [lookupTypeCode, parents]);
111
- var loadMoreOptions = react_1.useCallback(function () {
112
- setNextPageIsLoading(true);
113
- loadOptions(inputValue, pageNumber + 1)
114
- .then(function (buildOptions) {
115
- setOptions(function (options) {
116
- return ramda_1.concat(options.slice(0, pageNumber * MAX_DEPENDENT_LOOKUP_VALUES), buildOptions);
117
- });
118
- setPageNumber(function (page) { return page + 1; });
109
+ max: max + 1,
110
+ offset: (pageNumber - 1) * max
119
111
  })
112
+ .then(function (buildOptions) { return helpers_1.buildLookupOptions(buildOptions); })
120
113
  .catch(function () { return []; })
121
- .finally(function () { return setNextPageIsLoading(false); });
122
- }, [loadOptions, inputValue, pageNumber]);
114
+ .finally(function () { return setOptionsAreLoading(false); });
115
+ }, [max, lookupTypeCode, parents]);
116
+ var loadMoreOptions = react_1.useCallback(function () {
117
+ loadOptions(inputValue, pageNumber + 1).then(function (buildOptions) {
118
+ setOptions(function (options) { return ramda_1.concat(options.slice(0, pageNumber * max), buildOptions); });
119
+ setPageNumber(function (page) { return page + 1; });
120
+ });
121
+ }, [max, loadOptions, inputValue, pageNumber]);
123
122
  var debouncedLoadOptions = react_1.useCallback(mdm_sdk_1.debounce(function (value, callback) {
124
- setNextPageIsLoading(true);
125
- loadOptions(value)
126
- .then(function (options) { return callback(options); })
127
- .catch(function () { return callback([]); })
128
- .finally(function () { return setNextPageIsLoading(false); });
123
+ loadOptions(value).then(function (options) { return callback(options); });
129
124
  }, exports.DEBOUNCE_INTERVAL), [loadOptions]);
130
- var _g = useDefaultOptions_1.default(loadOptions), defaultOptions = _g.defaultOptions, initialDefaultOptions = _g.initialDefaultOptions, isLoadingDefaultOptions = _g.isLoading;
125
+ var _h = useDefaultOptions_1.default(loadOptions), defaultOptions = _h.defaultOptions, initialDefaultOptions = _h.initialDefaultOptions, isLoadingDefaultOptions = _h.isLoading;
131
126
  react_1.useEffect(function () {
132
127
  setOptions(defaultOptions);
133
128
  }, [defaultOptions]);
134
- var displayedOptions = react_1.useMemo(function () { return options.slice(0, pageNumber * MAX_DEPENDENT_LOOKUP_VALUES); }, [
135
- options,
136
- pageNumber
137
- ]);
129
+ hooks_1.useDidUpdateEffect(function () {
130
+ setPageNumber(1);
131
+ }, [lookupTypeCode]);
132
+ var displayedOptions = react_1.useMemo(function () { return options.slice(0, pageNumber * max); }, [max, options, pageNumber]);
138
133
  var showMoreButton = options.length > displayedOptions.length;
139
134
  var isEmptyValue = multiple ? ramda_1.isEmpty(value) : !(value === null || value === void 0 ? void 0 : value.lookupCode) && !(value === null || value === void 0 ? void 0 : value.value);
140
135
  var markAsTouched = useAutopopulation_1.default({
@@ -147,10 +142,12 @@ var DependentLookupEditor = function (_a) {
147
142
  return (react_1.default.createElement(Select_1.default, __assign({}, otherProps, { isMulti: multiple, classes: styles, menuPortalTarget: document.body, menuPlacement: "auto", TextFieldProps: __assign(__assign({}, TextFieldProps), { ref: inputRef, disabled: (TextFieldProps === null || TextFieldProps === void 0 ? void 0 : TextFieldProps.disabled) || disabled }), inputRef: inputRef, innerRef: selectRef, styles: {
148
143
  menuPortal: function (base) { return (__assign(__assign({}, base), { zIndex: 1300 })); },
149
144
  container: function (base) { return (__assign(__assign({}, base), (fullWidth ? { width: '100%' } : {}))); }
150
- }, loadingMessage: function () { return ui_i18n_1.default.text('Loading...'); }, noOptionsMessage: function () { return ui_i18n_1.default.text('No results found'); }, components: SelectComponents, isClearable: true, isSearchable: true, inputValue: inputValue, onInputChange: handleInputChange, isLoading: !inputValue && isLoadingDefaultOptions, hideSelectedOptions: false, placeholder: placeholder || '', isDisabled: disabled, options: displayedOptions, getOptionValue: ramda_1.either(ramda_1.prop('value'), ramda_1.prop('lookupCode')), getOptionLabel: helpers_1.getOptionLabel, onChange: function (value) {
145
+ }, noOptionsMessage: function () {
146
+ return optionsAreLoading && !showMoreButton ? ui_i18n_1.default.text('Loading...') : ui_i18n_1.default.text('No results found');
147
+ }, components: SelectComponents, isClearable: true, isSearchable: true, inputValue: inputValue, onInputChange: handleInputChange, loadingMessage: function () { return ui_i18n_1.default.text('Loading...'); }, isLoading: !inputValue && isLoadingDefaultOptions, hideSelectedOptions: false, placeholder: placeholder || '', isDisabled: disabled, options: displayedOptions, getOptionValue: ramda_1.either(ramda_1.prop('value'), ramda_1.prop('lookupCode')), getOptionLabel: helpers_1.getOptionLabel, onChange: function (value) {
151
148
  markAsTouched();
152
149
  onChange(value);
153
- }, value: ramda_1.defaultTo(multiple ? [] : null, value), menuListFooter: showMoreButton && react_1.default.createElement(LoadMoreButton_1.default, { loading: nextPageIsLoading, onClick: loadMoreOptions }) })));
150
+ }, value: ramda_1.defaultTo(multiple ? [] : null, value), menuListFooter: showMoreButton && react_1.default.createElement(LoadMoreButton_1.default, { loading: optionsAreLoading, onClick: loadMoreOptions }) })));
154
151
  };
155
152
  DependentLookupEditor.propTypes = {
156
153
  multiple: prop_types_1.default.bool,
@@ -169,6 +166,7 @@ DependentLookupEditor.propTypes = {
169
166
  fullWidth: prop_types_1.default.bool,
170
167
  placeholder: prop_types_1.default.string,
171
168
  disabled: prop_types_1.default.bool,
172
- autopopulationId: prop_types_1.default.string
169
+ autopopulationId: prop_types_1.default.string,
170
+ max: prop_types_1.default.number
173
171
  };
174
172
  exports.default = DependentLookupEditor;
@@ -1,7 +1,8 @@
1
1
  export default TypeaheadEditor;
2
- declare function TypeaheadEditor({ value, getSuggestions, onChange, multiple, fullWidth, InputProps, ...inputProps }: {
2
+ declare function TypeaheadEditor({ value, max, getSuggestions, onChange, multiple, fullWidth, InputProps, ...inputProps }: {
3
3
  [x: string]: any;
4
4
  value: any;
5
+ max?: number;
5
6
  getSuggestions: any;
6
7
  onChange: any;
7
8
  multiple: any;
@@ -17,6 +18,7 @@ declare namespace TypeaheadEditor {
17
18
  const onChange: PropTypes.Validator<(...args: any[]) => any>;
18
19
  const getSuggestions: PropTypes.Validator<(...args: any[]) => any>;
19
20
  const InputProps: PropTypes.Requireable<object>;
21
+ const max: PropTypes.Requireable<number>;
20
22
  }
21
23
  }
22
24
  import PropTypes from "prop-types";
@@ -70,13 +70,13 @@ var hooks_1 = require("../../../hooks");
70
70
  var FETCH_DEBOUNCE_INTERVAL = 300;
71
71
  var PAGE_SIZE = 50;
72
72
  var TypeaheadEditor = function (_a) {
73
- var value = _a.value, getSuggestions = _a.getSuggestions, onChange = _a.onChange, multiple = _a.multiple, fullWidth = _a.fullWidth, _b = _a.InputProps, InputProps = _b === void 0 ? {} : _b, inputProps = __rest(_a, ["value", "getSuggestions", "onChange", "multiple", "fullWidth", "InputProps"]);
74
- var _c = react_1.useState([]), suggestions = _c[0], setSuggestions = _c[1];
75
- var _d = react_1.useState(false), isPlaceholderVisible = _d[0], setPlaceholderVisibility = _d[1];
76
- var _e = react_1.useState(1), pageNumber = _e[0], setPageNumber = _e[1];
77
- var _f = react_1.useState(false), nextPageIsLoading = _f[0], setNextPageIsLoading = _f[1];
78
- var pageSizeForRequest = PAGE_SIZE + 1;
79
- var _g = react_1.useState(''), currentValue = _g[0], setCurrentValue = _g[1];
73
+ var value = _a.value, _b = _a.max, max = _b === void 0 ? PAGE_SIZE : _b, getSuggestions = _a.getSuggestions, onChange = _a.onChange, multiple = _a.multiple, fullWidth = _a.fullWidth, _c = _a.InputProps, InputProps = _c === void 0 ? {} : _c, inputProps = __rest(_a, ["value", "max", "getSuggestions", "onChange", "multiple", "fullWidth", "InputProps"]);
74
+ var _d = react_1.useState([]), suggestions = _d[0], setSuggestions = _d[1];
75
+ var _e = react_1.useState(false), isPlaceholderVisible = _e[0], setPlaceholderVisibility = _e[1];
76
+ var _f = react_1.useState(1), pageNumber = _f[0], setPageNumber = _f[1];
77
+ var _g = react_1.useState(false), nextPageIsLoading = _g[0], setNextPageIsLoading = _g[1];
78
+ var pageSizeForRequest = max + 1;
79
+ var _h = react_1.useState(''), currentValue = _h[0], setCurrentValue = _h[1];
80
80
  value = ramda_1.defaultTo(multiple ? [] : '', value);
81
81
  var inputValue = multiple ? currentValue : value;
82
82
  hooks_1.useDidUpdateEffect(function () {
@@ -100,9 +100,9 @@ var TypeaheadEditor = function (_a) {
100
100
  var debouncedFetchSuggestions = react_1.useCallback(mdm_sdk_1.debounce(fetchSuggestions, FETCH_DEBOUNCE_INTERVAL), [
101
101
  getSuggestions
102
102
  ]);
103
- var displayedSuggestions = react_1.useMemo(function () { return suggestions.slice(0, pageNumber * PAGE_SIZE); }, [suggestions, pageNumber]);
103
+ var displayedSuggestions = react_1.useMemo(function () { return suggestions.slice(0, pageNumber * max); }, [suggestions, pageNumber, max]);
104
104
  var showMoreButton = suggestions.length > displayedSuggestions.length;
105
- var _h = react_1.useState(false), hasHighlightedItem = _h[0], setHasHighlightedItem = _h[1];
105
+ var _j = react_1.useState(false), hasHighlightedItem = _j[0], setHasHighlightedItem = _j[1];
106
106
  var onInputChange = function (_a) {
107
107
  var newValue = _a.newValue, method = _a.method;
108
108
  switch (method) {
@@ -172,6 +172,7 @@ TypeaheadEditor.propTypes = {
172
172
  value: prop_types_1.default.oneOfType([prop_types_1.default.string, prop_types_1.default.arrayOf(prop_types_1.default.string)]),
173
173
  onChange: prop_types_1.default.func.isRequired,
174
174
  getSuggestions: prop_types_1.default.func.isRequired,
175
- InputProps: prop_types_1.default.object
175
+ InputProps: prop_types_1.default.object,
176
+ max: prop_types_1.default.number
176
177
  };
177
178
  exports.default = TypeaheadEditor;
@@ -103,3 +103,20 @@ export declare enum RequestStates {
103
103
  LOADED = "loaded",
104
104
  ERROR = "error"
105
105
  }
106
+ export declare type SelectableItem = {
107
+ text?: string;
108
+ disabled?: boolean;
109
+ tooltip?: string;
110
+ id?: string;
111
+ onClick?: (e: any) => void;
112
+ selected?: boolean;
113
+ };
114
+ export declare type DropDownMenuItem = {
115
+ text?: string;
116
+ disabled?: boolean;
117
+ tooltip?: string;
118
+ id?: string;
119
+ onClick?: (e: any) => void;
120
+ selectable?: boolean;
121
+ selected?: boolean;
122
+ };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { MenuProps } from '@material-ui/core/Menu';
3
- import { Item } from './MenuItemRenderer';
3
+ import { DropDownMenuItem } from '../../types';
4
4
  declare type Props<T> = {
5
5
  className?: string;
6
6
  buttonComponent?: React.ElementType;
@@ -13,7 +13,7 @@ declare type Props<T> = {
13
13
  onMenuClose?: () => void;
14
14
  MenuItemRenderer?: (props: any) => JSX.Element;
15
15
  };
16
- declare function DropDownMenuButton<T = Item>({ className, menuId, buttonComponent, buttonContent, menuItems, buttonProps, popoverProps, onMenuOpen, onMenuClose, MenuItemRenderer }: Props<T>): JSX.Element;
16
+ declare function DropDownMenuButton<T = DropDownMenuItem>({ className, menuId, buttonComponent, buttonContent, menuItems, buttonProps, popoverProps, onMenuOpen, onMenuClose, MenuItemRenderer }: Props<T>): JSX.Element;
17
17
  declare namespace DropDownMenuButton {
18
18
  var displayName: string;
19
19
  }
@@ -1,13 +1,7 @@
1
1
  import React from 'react';
2
- export declare type Item = {
3
- text?: string;
4
- disabled?: boolean;
5
- tooltip?: string;
6
- id?: string;
7
- onClick?: (e: any) => void;
8
- };
2
+ import { DropDownMenuItem } from '../../types';
9
3
  declare type Props = {
10
- item: Item;
4
+ item: DropDownMenuItem;
11
5
  onMenuClose?: (e: any) => void;
12
6
  };
13
7
  declare const MenuItemRenderer: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLLIElement>>;
@@ -1,5 +1,6 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import { identity } from 'ramda';
3
+ import Checkbox from '@material-ui/core/Checkbox';
3
4
  import MenuItem from '@material-ui/core/MenuItem';
4
5
  import Typography from '@material-ui/core/Typography';
5
6
  import withTooltip from '../../HOCs/withTooltip/withTooltip';
@@ -8,12 +9,13 @@ var MenuItemWithTooltip = withTooltip(MenuItem);
8
9
  var MenuItemRenderer = forwardRef(function (_a, ref) {
9
10
  var item = _a.item, _b = _a.onMenuClose, onMenuClose = _b === void 0 ? identity : _b;
10
11
  var styles = useStyles();
11
- var disabled = item.disabled, text = item.text, tooltip = item.tooltip, onClick = item.onClick, _c = item.id, id = _c === void 0 ? '' : _c;
12
+ var disabled = item.disabled, text = item.text, tooltip = item.tooltip, onClick = item.onClick, _c = item.id, id = _c === void 0 ? '' : _c, selectable = item.selectable, selected = item.selected;
12
13
  var handleClick = function (e) {
13
14
  onMenuClose(e);
14
15
  onClick(e);
15
16
  };
16
17
  return (React.createElement(MenuItemWithTooltip, { tooltipTitle: tooltip, showForDisabled: true, classes: { root: styles.menuItem }, onClick: handleClick, disabled: disabled, ref: ref, "data-modal": true, "data-reltio-id": "reltio-search-menu-item" + id },
18
+ selectable && React.createElement(Checkbox, { checked: selected, color: "primary" }),
17
19
  React.createElement(Typography, { classes: { root: styles.menuText } }, text)));
18
20
  });
19
21
  MenuItemRenderer.displayName = 'MenuItemRenderer';
@@ -17,11 +17,10 @@ var MatchRulesBlock = function (_a) {
17
17
  return uri !== NOT_MATCH;
18
18
  });
19
19
  var hasNotMatch = rules.length !== matchRules.length;
20
- var showTransitive = isTransitive && variant !== MatchRuleVariant.ml;
21
20
  var showSimple = !isTransitive && !hasNotMatch;
22
- var showNotMatch = hasNotMatch && ![MatchRuleVariant.excludeNotMatch, MatchRuleVariant.ml].includes(variant);
21
+ var showNotMatch = hasNotMatch && variant !== MatchRuleVariant.excludeNotMatch;
23
22
  return (React.createElement(React.Fragment, null,
24
- showTransitive ? (React.createElement(TransitiveMatchBlock, { transitiveMatchRules: getTransitiveMatchRules(metadata, match, entitiesMap) })) : null,
23
+ isTransitive ? (React.createElement(TransitiveMatchBlock, { transitiveMatchRules: getTransitiveMatchRules(metadata, match, entitiesMap) })) : null,
25
24
  showSimple ? (React.createElement(SimpleMatchRulesBuilder, { variant: variant, matchRules: matchRules, Component: SimpleMatchRulesBlock })) : null,
26
25
  showNotMatch ? React.createElement(NotMatchRule, null) : null));
27
26
  };
@@ -28,9 +28,9 @@ import { MatchRuleVariant } from '../types';
28
28
  var SimpleMatchRulesBuilder = function (_a) {
29
29
  var matchRules = _a.matchRules, Component = _a.Component, _b = _a.variant, variant = _b === void 0 ? MatchRuleVariant.all : _b, otherProps = __rest(_a, ["matchRules", "Component", "variant"]);
30
30
  var _c = partitionByMlMatch(matchRules), MlMatchRules = _c[0], otherMatchRules = _c[1];
31
- var all = MatchRuleVariant.all, simple = MatchRuleVariant.simple, ml = MatchRuleVariant.ml, excludeML = MatchRuleVariant.excludeML, excludeNotMatch = MatchRuleVariant.excludeNotMatch;
32
- var showSimple = [all, simple, excludeML, excludeNotMatch].includes(variant) && !isEmpty(otherMatchRules);
33
- var showML = [all, ml, excludeNotMatch, excludeNotMatch].includes(variant) && !isEmpty(MlMatchRules);
31
+ var all = MatchRuleVariant.all, simple = MatchRuleVariant.simple, excludeNotMatch = MatchRuleVariant.excludeNotMatch;
32
+ var showSimple = [all, simple, excludeNotMatch].includes(variant) && !isEmpty(otherMatchRules);
33
+ var showML = [all, excludeNotMatch].includes(variant) && !isEmpty(MlMatchRules);
34
34
  return (React.createElement(React.Fragment, null,
35
35
  showSimple ? React.createElement(Component, __assign({ matchRules: otherMatchRules }, otherProps)) : null,
36
36
  showML ? React.createElement(Component, __assign({ isMlMatch: true, matchRules: MlMatchRules }, otherProps)) : null));
@@ -5,9 +5,7 @@ declare type MatchRule = {
5
5
  export declare type MatchRules = MatchRule[];
6
6
  export declare enum MatchRuleVariant {
7
7
  all = "all",
8
- ml = "ml",
9
8
  simple = "simple",
10
- excludeML = "excludeML",
11
9
  excludeNotMatch = "excludeNotMatch"
12
10
  }
13
11
  export declare type TransitiveMatchRules = Array<{
@@ -1,8 +1,6 @@
1
1
  export var MatchRuleVariant;
2
2
  (function (MatchRuleVariant) {
3
3
  MatchRuleVariant["all"] = "all";
4
- MatchRuleVariant["ml"] = "ml";
5
4
  MatchRuleVariant["simple"] = "simple";
6
- MatchRuleVariant["excludeML"] = "excludeML";
7
5
  MatchRuleVariant["excludeNotMatch"] = "excludeNotMatch";
8
6
  })(MatchRuleVariant || (MatchRuleVariant = {}));
@@ -9,6 +9,7 @@ declare type Props = {
9
9
  attributeType: any;
10
10
  attributeValue: any;
11
11
  }) => JSX.Element;
12
+ showNonOv?: boolean;
12
13
  };
13
14
  declare const _default: React.MemoExoticComponent<({ expanded, LabelRenderer, ...props }: Props) => JSX.Element>;
14
15
  export default _default;
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
12
12
  import React, { useContext, useEffect, useMemo, useState } from 'react';
13
13
  import PropTypes from 'prop-types';
14
14
  import classnames from 'classnames';
15
- import { AttributeTypeType, areOneHierarchyUris, isAnalyticAttribute, NestedAttributeValueType, ReferenceAttributeValueType, CollaborationObjectTypes, createRelatedObjectUris, isRelationAttrType, isSpecialAttribute } from '@reltio/mdm-sdk';
15
+ import { AttributeTypeType, areOneHierarchyUris, isAnalyticAttribute, NestedAttributeValueType, ReferenceAttributeValueType, CollaborationObjectTypes, createRelatedObjectUris, isOv, isRelationAttrType, isSpecialAttribute } from '@reltio/mdm-sdk';
16
16
  import Typography from '@material-ui/core/Typography';
17
17
  import AttributesList from '../AttributesList/AttributesList';
18
18
  import ArrowExpandButton from '../../../ArrowExpandButton/ArrowExpandButton';
@@ -20,10 +20,12 @@ import CommentsContainer from '../../../CommentsContainer/CommentsContainer';
20
20
  import { COMMENTS_CONTAINER_VISIBILITY_AREA } from '../../../../constants/classnames';
21
21
  import { useStyles } from './styles';
22
22
  import { HighlightedValuesContext } from '../../../../contexts';
23
+ import { useOvValueStyles } from '../helpers/commonStyles';
23
24
  var ComplexAttribute = function (_a) {
24
25
  var _b;
25
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;
26
27
  var styles = useStyles();
28
+ var ovValueStyles = useOvValueStyles();
27
29
  var uri = attributeValue.uri;
28
30
  var _d = useState(false), expanded = _d[0], setExpanded = _d[1];
29
31
  var _e = useContext(HighlightedValuesContext), _f = _e.highlightedValuesUris, highlightedValuesUris = _f === void 0 ? [] : _f, highlightedClassName = _e.highlightedClassName;
@@ -43,6 +45,7 @@ var ComplexAttribute = function (_a) {
43
45
  _b[highlightedClassName] = highlightedValuesUris.some(function (uri) {
44
46
  return areOneHierarchyUris(uri, attributeValue.uri);
45
47
  }),
48
+ _b[ovValueStyles.ovFalse] = !isOv(attributeValue),
46
49
  _b)), "data-reltio-id": "reltio-attribute-complex-label" }, label),
47
50
  React.createElement("div", { className: styles.spacer }),
48
51
  React.createElement(CommentsContainer, { uri: attributeValue.uri, relatedObjectUris: createRelatedObjectUris(objectType, {
@@ -21,15 +21,18 @@ 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 { getAttributeTypeSubAttributes, getEntityLink, getLabel, getReferencedEntityUriFromAttrValue, isEmptyValue, ReferenceAttributeType } from '@reltio/mdm-sdk';
24
+ import classnames from 'classnames';
25
+ import { getAttributeTypeSubAttributes, getEntityLink, getLabel, getReferencedEntityUriFromAttrValue, isEmptyValue, isOv, ReferenceAttributeType } from '@reltio/mdm-sdk';
25
26
  import { HistoryDiffContext } from '../../../../contexts';
26
27
  import ComplexAttribute from '../ComplexAttribute/ComplexAttribute';
27
28
  import { getHistoryAppearanceByUri, getHistoryAttributeClassName } from '../helpers/historyAppearance';
28
29
  import InternalLink from '../../../InternalLink/InternalLink';
30
+ import { useOvValueStyles } from '../helpers/commonStyles';
29
31
  import useStyles from './styles';
30
32
  var ReferenceAttribute = function (_a) {
31
33
  var attributeValue = _a.attributeValue, metadata = _a.metadata, attributeType = _a.attributeType, uiPath = _a.uiPath, otherProps = __rest(_a, ["attributeValue", "metadata", "attributeType", "uiPath"]);
32
34
  var styles = useStyles();
35
+ var ovValueStyles = useOvValueStyles();
33
36
  var refEntityURI = getReferencedEntityUriFromAttrValue(attributeValue);
34
37
  var attributeTypeList = useMemo(function () { return getAttributeTypeSubAttributes(metadata, attributeType); }, [
35
38
  attributeType,
@@ -37,20 +40,15 @@ var ReferenceAttribute = function (_a) {
37
40
  ]);
38
41
  var appearance = useContext(HistoryDiffContext).appearance;
39
42
  var entityLabel = useMemo(function () {
43
+ var _a;
40
44
  var attributeAppearance = getHistoryAppearanceByUri(attributeValue.uri, appearance);
41
45
  var historyAttributesClassName = getHistoryAttributeClassName(attributeAppearance);
42
- return (React.createElement(InternalLink, { href: isEmptyValue(appearance) ? getEntityLink({ uiPath: uiPath, uri: refEntityURI }) : undefined, className: styles[historyAttributesClassName] },
46
+ return (React.createElement(InternalLink, { href: isEmptyValue(appearance) ? getEntityLink({ uiPath: uiPath, uri: refEntityURI }) : undefined, className: classnames(styles[historyAttributesClassName], (_a = {},
47
+ _a[ovValueStyles.ovFalse] = !isOv(attributeValue),
48
+ _a)) },
43
49
  getLabel(attributeValue.label),
44
50
  attributeValue.relationshipLabel && (React.createElement("span", { className: styles.relationshipLabel }, attributeValue.relationshipLabel))));
45
- }, [
46
- attributeValue.uri,
47
- attributeValue.label,
48
- attributeValue.relationshipLabel,
49
- appearance,
50
- refEntityURI,
51
- styles,
52
- uiPath
53
- ]);
51
+ }, [attributeValue, appearance, uiPath, refEntityURI, styles, ovValueStyles.ovFalse]);
54
52
  return (React.createElement(ComplexAttribute, __assign({ attributeTypesList: attributeTypeList, attributeValue: attributeValue, label: entityLabel, attributeType: attributeType }, otherProps)));
55
53
  };
56
54
  ReferenceAttribute.propTypes = ReferenceAttributeType;
@@ -1,5 +1,5 @@
1
1
  import React, { useContext } from 'react';
2
- import { getAttrDataTypeDefinition, getAttributeValue, CollaborationObjectTypes, createRelatedObjectUris, isRelationAttrType } from '@reltio/mdm-sdk';
2
+ import { getAttrDataTypeDefinition, getAttributeValue, CollaborationObjectTypes, createRelatedObjectUris, isOv, isRelationAttrType } from '@reltio/mdm-sdk';
3
3
  import classnames from 'classnames';
4
4
  import { COMMENTS_CONTAINER_VISIBILITY_AREA } from '../../../../constants/classnames';
5
5
  import { HistoryDiffContext } from '../../../../contexts/HistoryAppearanceContext';
@@ -9,11 +9,13 @@ import { PivotingTooltip } from '../../PivotingAttributes/PivotingTooltip';
9
9
  import { getHistoryAppearanceByUri, getHistoryAttributeClassName } from '../helpers/historyAppearance';
10
10
  import { useStyles } from './styles';
11
11
  import { HighlightedValuesContext } from '../../../../contexts';
12
+ import { useOvValueStyles } from '../helpers/commonStyles';
12
13
  var SimpleAttribute = function (_a) {
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
+ var _b, _c, _d, _e, _f;
15
+ var className = _a.className, _g = _a.attributeType, attributeType = _g === void 0 ? null : _g, attributeValue = _a.attributeValue, inlined = _a.inlined;
15
16
  var styles = useStyles();
16
- var _f = useContext(HighlightedValuesContext), _g = _f.highlightedValuesUris, highlightedValuesUris = _g === void 0 ? [] : _g, highlightedClassName = _f.highlightedClassName;
17
+ var ovValueStyles = useOvValueStyles();
18
+ var _h = useContext(HighlightedValuesContext), _j = _h.highlightedValuesUris, highlightedValuesUris = _j === void 0 ? [] : _j, highlightedClassName = _h.highlightedClassName;
17
19
  var appearance = useContext(HistoryDiffContext).appearance;
18
20
  var attributeAppearance = getHistoryAppearanceByUri(attributeValue.uri, appearance);
19
21
  var historyClassName = getHistoryAttributeClassName(attributeAppearance);
@@ -25,11 +27,11 @@ var SimpleAttribute = function (_a) {
25
27
  _b[highlightedClassName] = highlightedValuesUris.includes(attributeValue.uri),
26
28
  _b)) },
27
29
  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)) },
30
+ React.createElement("span", { className: classnames(styles[historyClassName], (_d = {}, _d[ovValueStyles.ovFalse] = !isOv(attributeValue), _d)), "data-reltio-id": "reltio-attribute-value" }, dataTypeValue)))) : (React.createElement("div", { className: classnames(className, styles.root, COMMENTS_CONTAINER_VISIBILITY_AREA, (_e = {},
31
+ _e[highlightedClassName] = highlightedValuesUris.includes(attributeValue.uri),
32
+ _e)) },
31
33
  React.createElement(PivotingTooltip, { value: attributeValue, attributeType: attributeType, key: attributeValue.uri },
32
- React.createElement("span", { className: styles.attributeValue, "data-reltio-id": "reltio-attribute-value" }, dataTypeValue)),
34
+ React.createElement("span", { className: classnames(styles.attributeValue, (_f = {}, _f[ovValueStyles.ovFalse] = !isOv(attributeValue), _f)), "data-reltio-id": "reltio-attribute-value" }, dataTypeValue)),
33
35
  React.createElement(CommentsContainer, { className: styles.commentsContainer, uri: attributeValue.uri, relatedObjectUris: createRelatedObjectUris(objectType, {
34
36
  uri: attributeValue.uri
35
37
  }), objectType: objectType })));
@@ -0,0 +1 @@
1
+ export declare const useOvValueStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"ovFalse">;
@@ -0,0 +1,4 @@
1
+ import { makeStyles } from '@material-ui/core/styles';
2
+ export var useOvValueStyles = makeStyles(function (theme) { return ({
3
+ ovFalse: theme.inactive
4
+ }); });
@@ -1,6 +1,6 @@
1
1
  export const DEBOUNCE_INTERVAL: 400;
2
2
  export default DependentLookupEditor;
3
- declare function DependentLookupEditor({ multiple, value, lookupCode: lookupTypeCode, TextFieldProps, parents, onChange, getLookups, lookups, resolveLookups, fullWidth, disabled, placeholder, autopopulationId, ...otherProps }: {
3
+ declare function DependentLookupEditor({ multiple, value, lookupCode: lookupTypeCode, TextFieldProps, parents, onChange, getLookups, lookups, resolveLookups, fullWidth, disabled, placeholder, autopopulationId, max, ...otherProps }: {
4
4
  [x: string]: any;
5
5
  multiple: any;
6
6
  value: any;
@@ -15,6 +15,7 @@ declare function DependentLookupEditor({ multiple, value, lookupCode: lookupType
15
15
  disabled: any;
16
16
  placeholder: any;
17
17
  autopopulationId: any;
18
+ max?: number;
18
19
  }): JSX.Element;
19
20
  declare namespace DependentLookupEditor {
20
21
  namespace propTypes {
@@ -41,6 +42,7 @@ declare namespace DependentLookupEditor {
41
42
  const placeholder: PropTypes.Requireable<string>;
42
43
  const disabled: PropTypes.Requireable<boolean>;
43
44
  const autopopulationId: PropTypes.Requireable<string>;
45
+ const max: PropTypes.Requireable<number>;
44
46
  }
45
47
  }
46
48
  import PropTypes from "prop-types";
@@ -39,6 +39,7 @@ import useDefaultOptions from './useDefaultOptions';
39
39
  import useAutopopulation from './useAutopopulation';
40
40
  import useSavingFocus from './useSavingFocus';
41
41
  import LoadMoreButton from '../../commonReactSelectComponents/LoadMoreButton';
42
+ import { useDidUpdateEffect } from '../../../hooks';
42
43
  var SelectComponents = {
43
44
  IndicatorSeparator: EmptyStub,
44
45
  LoadingIndicator: EmptyStub,
@@ -51,7 +52,7 @@ var SelectComponents = {
51
52
  export var DEBOUNCE_INTERVAL = 400;
52
53
  var MAX_DEPENDENT_LOOKUP_VALUES = 50;
53
54
  var DependentLookupEditor = function (_a) {
54
- var multiple = _a.multiple, value = _a.value, lookupTypeCode = _a.lookupCode, TextFieldProps = _a.TextFieldProps, parents = _a.parents, onChange = _a.onChange, getLookups = _a.getLookups, _b = _a.lookups, lookups = _b === void 0 ? {} : _b, resolveLookups = _a.resolveLookups, fullWidth = _a.fullWidth, disabled = _a.disabled, placeholder = _a.placeholder, autopopulationId = _a.autopopulationId, otherProps = __rest(_a, ["multiple", "value", "lookupCode", "TextFieldProps", "parents", "onChange", "getLookups", "lookups", "resolveLookups", "fullWidth", "disabled", "placeholder", "autopopulationId"]);
55
+ var multiple = _a.multiple, value = _a.value, lookupTypeCode = _a.lookupCode, TextFieldProps = _a.TextFieldProps, parents = _a.parents, onChange = _a.onChange, getLookups = _a.getLookups, _b = _a.lookups, lookups = _b === void 0 ? {} : _b, resolveLookups = _a.resolveLookups, fullWidth = _a.fullWidth, disabled = _a.disabled, placeholder = _a.placeholder, autopopulationId = _a.autopopulationId, _c = _a.max, max = _c === void 0 ? MAX_DEPENDENT_LOOKUP_VALUES : _c, otherProps = __rest(_a, ["multiple", "value", "lookupCode", "TextFieldProps", "parents", "onChange", "getLookups", "lookups", "resolveLookups", "fullWidth", "disabled", "placeholder", "autopopulationId", "max"]);
55
56
  var inputRef = useRef(null);
56
57
  var selectRef = useRef(null);
57
58
  var styles = useStyles();
@@ -62,10 +63,10 @@ var DependentLookupEditor = function (_a) {
62
63
  onLookupsResolve: function (lookups) { return onChange(multiple ? lookups : lookups[0]); }
63
64
  });
64
65
  useSavingFocus(selectRef, inputRef, disabled);
65
- var _c = useState(''), inputValue = _c[0], setInputValue = _c[1];
66
- var _d = useState([]), options = _d[0], setOptions = _d[1];
67
- var _e = useState(1), pageNumber = _e[0], setPageNumber = _e[1];
68
- var _f = useState(false), nextPageIsLoading = _f[0], setNextPageIsLoading = _f[1];
66
+ var _d = useState(''), inputValue = _d[0], setInputValue = _d[1];
67
+ var _e = useState([]), options = _e[0], setOptions = _e[1];
68
+ var _f = useState(1), pageNumber = _f[0], setPageNumber = _f[1];
69
+ var _g = useState(false), optionsAreLoading = _g[0], setOptionsAreLoading = _g[1];
69
70
  var handleInputChange = function (value) {
70
71
  if (value !== inputValue) {
71
72
  setInputValue(value);
@@ -75,41 +76,35 @@ var DependentLookupEditor = function (_a) {
75
76
  };
76
77
  var loadOptions = useCallback(function (value, pageNumber) {
77
78
  if (pageNumber === void 0) { pageNumber = 1; }
79
+ setOptionsAreLoading(true);
78
80
  return getLookups({
79
81
  type: lookupTypeCode,
80
82
  parents: parents,
81
83
  displayNamePrefix: value,
82
- max: MAX_DEPENDENT_LOOKUP_VALUES + 1,
83
- offset: (pageNumber - 1) * MAX_DEPENDENT_LOOKUP_VALUES
84
- }).then(function (buildOptions) { return buildLookupOptions(buildOptions); });
85
- }, [lookupTypeCode, parents]);
86
- var loadMoreOptions = useCallback(function () {
87
- setNextPageIsLoading(true);
88
- loadOptions(inputValue, pageNumber + 1)
89
- .then(function (buildOptions) {
90
- setOptions(function (options) {
91
- return concat(options.slice(0, pageNumber * MAX_DEPENDENT_LOOKUP_VALUES), buildOptions);
92
- });
93
- setPageNumber(function (page) { return page + 1; });
84
+ max: max + 1,
85
+ offset: (pageNumber - 1) * max
94
86
  })
87
+ .then(function (buildOptions) { return buildLookupOptions(buildOptions); })
95
88
  .catch(function () { return []; })
96
- .finally(function () { return setNextPageIsLoading(false); });
97
- }, [loadOptions, inputValue, pageNumber]);
89
+ .finally(function () { return setOptionsAreLoading(false); });
90
+ }, [max, lookupTypeCode, parents]);
91
+ var loadMoreOptions = useCallback(function () {
92
+ loadOptions(inputValue, pageNumber + 1).then(function (buildOptions) {
93
+ setOptions(function (options) { return concat(options.slice(0, pageNumber * max), buildOptions); });
94
+ setPageNumber(function (page) { return page + 1; });
95
+ });
96
+ }, [max, loadOptions, inputValue, pageNumber]);
98
97
  var debouncedLoadOptions = useCallback(debounce(function (value, callback) {
99
- setNextPageIsLoading(true);
100
- loadOptions(value)
101
- .then(function (options) { return callback(options); })
102
- .catch(function () { return callback([]); })
103
- .finally(function () { return setNextPageIsLoading(false); });
98
+ loadOptions(value).then(function (options) { return callback(options); });
104
99
  }, DEBOUNCE_INTERVAL), [loadOptions]);
105
- var _g = useDefaultOptions(loadOptions), defaultOptions = _g.defaultOptions, initialDefaultOptions = _g.initialDefaultOptions, isLoadingDefaultOptions = _g.isLoading;
100
+ var _h = useDefaultOptions(loadOptions), defaultOptions = _h.defaultOptions, initialDefaultOptions = _h.initialDefaultOptions, isLoadingDefaultOptions = _h.isLoading;
106
101
  useEffect(function () {
107
102
  setOptions(defaultOptions);
108
103
  }, [defaultOptions]);
109
- var displayedOptions = useMemo(function () { return options.slice(0, pageNumber * MAX_DEPENDENT_LOOKUP_VALUES); }, [
110
- options,
111
- pageNumber
112
- ]);
104
+ useDidUpdateEffect(function () {
105
+ setPageNumber(1);
106
+ }, [lookupTypeCode]);
107
+ var displayedOptions = useMemo(function () { return options.slice(0, pageNumber * max); }, [max, options, pageNumber]);
113
108
  var showMoreButton = options.length > displayedOptions.length;
114
109
  var isEmptyValue = multiple ? isEmpty(value) : !(value === null || value === void 0 ? void 0 : value.lookupCode) && !(value === null || value === void 0 ? void 0 : value.value);
115
110
  var markAsTouched = useAutopopulation({
@@ -122,10 +117,12 @@ var DependentLookupEditor = function (_a) {
122
117
  return (React.createElement(Select, __assign({}, otherProps, { isMulti: multiple, classes: styles, menuPortalTarget: document.body, menuPlacement: "auto", TextFieldProps: __assign(__assign({}, TextFieldProps), { ref: inputRef, disabled: (TextFieldProps === null || TextFieldProps === void 0 ? void 0 : TextFieldProps.disabled) || disabled }), inputRef: inputRef, innerRef: selectRef, styles: {
123
118
  menuPortal: function (base) { return (__assign(__assign({}, base), { zIndex: 1300 })); },
124
119
  container: function (base) { return (__assign(__assign({}, base), (fullWidth ? { width: '100%' } : {}))); }
125
- }, loadingMessage: function () { return i18n.text('Loading...'); }, noOptionsMessage: function () { return i18n.text('No results found'); }, components: SelectComponents, isClearable: true, isSearchable: true, inputValue: inputValue, onInputChange: handleInputChange, isLoading: !inputValue && isLoadingDefaultOptions, hideSelectedOptions: false, placeholder: placeholder || '', isDisabled: disabled, options: displayedOptions, getOptionValue: either(prop('value'), prop('lookupCode')), getOptionLabel: getOptionLabel, onChange: function (value) {
120
+ }, noOptionsMessage: function () {
121
+ return optionsAreLoading && !showMoreButton ? i18n.text('Loading...') : i18n.text('No results found');
122
+ }, components: SelectComponents, isClearable: true, isSearchable: true, inputValue: inputValue, onInputChange: handleInputChange, loadingMessage: function () { return i18n.text('Loading...'); }, isLoading: !inputValue && isLoadingDefaultOptions, hideSelectedOptions: false, placeholder: placeholder || '', isDisabled: disabled, options: displayedOptions, getOptionValue: either(prop('value'), prop('lookupCode')), getOptionLabel: getOptionLabel, onChange: function (value) {
126
123
  markAsTouched();
127
124
  onChange(value);
128
- }, value: defaultTo(multiple ? [] : null, value), menuListFooter: showMoreButton && React.createElement(LoadMoreButton, { loading: nextPageIsLoading, onClick: loadMoreOptions }) })));
125
+ }, value: defaultTo(multiple ? [] : null, value), menuListFooter: showMoreButton && React.createElement(LoadMoreButton, { loading: optionsAreLoading, onClick: loadMoreOptions }) })));
129
126
  };
130
127
  DependentLookupEditor.propTypes = {
131
128
  multiple: PropTypes.bool,
@@ -144,6 +141,7 @@ DependentLookupEditor.propTypes = {
144
141
  fullWidth: PropTypes.bool,
145
142
  placeholder: PropTypes.string,
146
143
  disabled: PropTypes.bool,
147
- autopopulationId: PropTypes.string
144
+ autopopulationId: PropTypes.string,
145
+ max: PropTypes.number
148
146
  };
149
147
  export default DependentLookupEditor;
@@ -1,7 +1,8 @@
1
1
  export default TypeaheadEditor;
2
- declare function TypeaheadEditor({ value, getSuggestions, onChange, multiple, fullWidth, InputProps, ...inputProps }: {
2
+ declare function TypeaheadEditor({ value, max, getSuggestions, onChange, multiple, fullWidth, InputProps, ...inputProps }: {
3
3
  [x: string]: any;
4
4
  value: any;
5
+ max?: number;
5
6
  getSuggestions: any;
6
7
  onChange: any;
7
8
  multiple: any;
@@ -17,6 +18,7 @@ declare namespace TypeaheadEditor {
17
18
  const onChange: PropTypes.Validator<(...args: any[]) => any>;
18
19
  const getSuggestions: PropTypes.Validator<(...args: any[]) => any>;
19
20
  const InputProps: PropTypes.Requireable<object>;
21
+ const max: PropTypes.Requireable<number>;
20
22
  }
21
23
  }
22
24
  import PropTypes from "prop-types";
@@ -46,13 +46,13 @@ import { useDidUpdateEffect } from '../../../hooks';
46
46
  var FETCH_DEBOUNCE_INTERVAL = 300;
47
47
  var PAGE_SIZE = 50;
48
48
  var TypeaheadEditor = function (_a) {
49
- var value = _a.value, getSuggestions = _a.getSuggestions, onChange = _a.onChange, multiple = _a.multiple, fullWidth = _a.fullWidth, _b = _a.InputProps, InputProps = _b === void 0 ? {} : _b, inputProps = __rest(_a, ["value", "getSuggestions", "onChange", "multiple", "fullWidth", "InputProps"]);
50
- var _c = useState([]), suggestions = _c[0], setSuggestions = _c[1];
51
- var _d = useState(false), isPlaceholderVisible = _d[0], setPlaceholderVisibility = _d[1];
52
- var _e = useState(1), pageNumber = _e[0], setPageNumber = _e[1];
53
- var _f = useState(false), nextPageIsLoading = _f[0], setNextPageIsLoading = _f[1];
54
- var pageSizeForRequest = PAGE_SIZE + 1;
55
- var _g = useState(''), currentValue = _g[0], setCurrentValue = _g[1];
49
+ var value = _a.value, _b = _a.max, max = _b === void 0 ? PAGE_SIZE : _b, getSuggestions = _a.getSuggestions, onChange = _a.onChange, multiple = _a.multiple, fullWidth = _a.fullWidth, _c = _a.InputProps, InputProps = _c === void 0 ? {} : _c, inputProps = __rest(_a, ["value", "max", "getSuggestions", "onChange", "multiple", "fullWidth", "InputProps"]);
50
+ var _d = useState([]), suggestions = _d[0], setSuggestions = _d[1];
51
+ var _e = useState(false), isPlaceholderVisible = _e[0], setPlaceholderVisibility = _e[1];
52
+ var _f = useState(1), pageNumber = _f[0], setPageNumber = _f[1];
53
+ var _g = useState(false), nextPageIsLoading = _g[0], setNextPageIsLoading = _g[1];
54
+ var pageSizeForRequest = max + 1;
55
+ var _h = useState(''), currentValue = _h[0], setCurrentValue = _h[1];
56
56
  value = defaultTo(multiple ? [] : '', value);
57
57
  var inputValue = multiple ? currentValue : value;
58
58
  useDidUpdateEffect(function () {
@@ -76,9 +76,9 @@ var TypeaheadEditor = function (_a) {
76
76
  var debouncedFetchSuggestions = useCallback(debounce(fetchSuggestions, FETCH_DEBOUNCE_INTERVAL), [
77
77
  getSuggestions
78
78
  ]);
79
- var displayedSuggestions = useMemo(function () { return suggestions.slice(0, pageNumber * PAGE_SIZE); }, [suggestions, pageNumber]);
79
+ var displayedSuggestions = useMemo(function () { return suggestions.slice(0, pageNumber * max); }, [suggestions, pageNumber, max]);
80
80
  var showMoreButton = suggestions.length > displayedSuggestions.length;
81
- var _h = useState(false), hasHighlightedItem = _h[0], setHasHighlightedItem = _h[1];
81
+ var _j = useState(false), hasHighlightedItem = _j[0], setHasHighlightedItem = _j[1];
82
82
  var onInputChange = function (_a) {
83
83
  var newValue = _a.newValue, method = _a.method;
84
84
  switch (method) {
@@ -148,6 +148,7 @@ TypeaheadEditor.propTypes = {
148
148
  value: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
149
149
  onChange: PropTypes.func.isRequired,
150
150
  getSuggestions: PropTypes.func.isRequired,
151
- InputProps: PropTypes.object
151
+ InputProps: PropTypes.object,
152
+ max: PropTypes.number
152
153
  };
153
154
  export default TypeaheadEditor;
@@ -103,3 +103,20 @@ export declare enum RequestStates {
103
103
  LOADED = "loaded",
104
104
  ERROR = "error"
105
105
  }
106
+ export declare type SelectableItem = {
107
+ text?: string;
108
+ disabled?: boolean;
109
+ tooltip?: string;
110
+ id?: string;
111
+ onClick?: (e: any) => void;
112
+ selected?: boolean;
113
+ };
114
+ export declare type DropDownMenuItem = {
115
+ text?: string;
116
+ disabled?: boolean;
117
+ tooltip?: string;
118
+ id?: string;
119
+ onClick?: (e: any) => void;
120
+ selectable?: boolean;
121
+ selected?: boolean;
122
+ };
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.1206",
3
+ "version": "1.4.1209",
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.1206",
11
- "@reltio/mdm-sdk": "^1.4.1206",
10
+ "@reltio/mdm-module": "^1.4.1209",
11
+ "@reltio/mdm-sdk": "^1.4.1209",
12
12
  "classnames": "^2.2.5",
13
13
  "d3-cloud": "^1.2.5",
14
14
  "d3-geo": "^2.0.1",