@reltio/components 1.4.1667 → 1.4.1669

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 (45) hide show
  1. package/cjs/components/ConnectionEditor/ConnectionEditor.js +2 -2
  2. package/cjs/components/EntityUriLink/EntityUriLink.d.ts +3 -5
  3. package/cjs/components/EntityUriLink/EntityUriLink.js +6 -8
  4. package/cjs/components/ValueChip/ValueChip.d.ts +7 -14
  5. package/cjs/components/ValueChip/ValueChip.js +1 -7
  6. package/cjs/components/ValueChip/styles.d.ts +2 -2
  7. package/cjs/components/attributes/editMode/NestedAttribute/NestedAttribute.d.ts +1 -1
  8. package/cjs/components/attributes/editMode/Tags/Tags.js +63 -19
  9. package/cjs/components/attributes/inline/ComplexAttribute/ComplexAttribute.js +2 -2
  10. package/cjs/components/attributes/inline/NestedAttributesBlock/NestedAttributesBlock.js +1 -1
  11. package/cjs/components/attributes/inline/SimpleAttribute/SimpleAttribute.js +2 -2
  12. package/cjs/components/attributes/inline/SimpleAttributesBlock/SimpleAttributesBlock.js +1 -1
  13. package/cjs/components/attributes/readMode/NestedAttribute/NestedAttribute.d.ts +1 -1
  14. package/cjs/components/crosswalks/AttributesTable/AddAttributesButton/AddAttributesButton.js +1 -1
  15. package/cjs/components/editors/DataTypeValueEditor/useEditorContext.d.ts +1 -1
  16. package/cjs/components/editors/TypeaheadEditor/TypeaheadEditor.d.ts +20 -24
  17. package/cjs/components/editors/TypeaheadEditor/TypeaheadEditor.js +155 -83
  18. package/cjs/components/editors/TypeaheadEditor/styles.d.ts +1 -1
  19. package/cjs/components/editors/TypeaheadEditor/styles.js +17 -17
  20. package/cjs/components/history/ContributorsPanel/styles.d.ts +1 -1
  21. package/cjs/hooks/useCommentsEntitiesMap.js +1 -1
  22. package/cjs/hooks/useMatchesLoader.js +2 -2
  23. package/esm/components/ConnectionEditor/ConnectionEditor.js +3 -3
  24. package/esm/components/EntityUriLink/EntityUriLink.d.ts +3 -5
  25. package/esm/components/EntityUriLink/EntityUriLink.js +6 -8
  26. package/esm/components/ValueChip/ValueChip.d.ts +7 -14
  27. package/esm/components/ValueChip/ValueChip.js +1 -7
  28. package/esm/components/ValueChip/styles.d.ts +2 -2
  29. package/esm/components/attributes/editMode/NestedAttribute/NestedAttribute.d.ts +1 -1
  30. package/esm/components/attributes/editMode/Tags/Tags.js +65 -21
  31. package/esm/components/attributes/inline/ComplexAttribute/ComplexAttribute.js +3 -3
  32. package/esm/components/attributes/inline/NestedAttributesBlock/NestedAttributesBlock.js +2 -2
  33. package/esm/components/attributes/inline/SimpleAttribute/SimpleAttribute.js +3 -3
  34. package/esm/components/attributes/inline/SimpleAttributesBlock/SimpleAttributesBlock.js +2 -2
  35. package/esm/components/attributes/readMode/NestedAttribute/NestedAttribute.d.ts +1 -1
  36. package/esm/components/crosswalks/AttributesTable/AddAttributesButton/AddAttributesButton.js +2 -2
  37. package/esm/components/editors/DataTypeValueEditor/useEditorContext.d.ts +1 -1
  38. package/esm/components/editors/TypeaheadEditor/TypeaheadEditor.d.ts +20 -24
  39. package/esm/components/editors/TypeaheadEditor/TypeaheadEditor.js +155 -83
  40. package/esm/components/editors/TypeaheadEditor/styles.d.ts +1 -1
  41. package/esm/components/editors/TypeaheadEditor/styles.js +17 -17
  42. package/esm/components/history/ContributorsPanel/styles.d.ts +1 -1
  43. package/esm/hooks/useCommentsEntitiesMap.js +2 -2
  44. package/esm/hooks/useMatchesLoader.js +3 -3
  45. package/package.json +2 -2
@@ -113,7 +113,7 @@ var ConnectionEditor = function (_a) {
113
113
  return (react_1.default.createElement(react_1.default.Fragment, null,
114
114
  onChangeRelationType && (react_1.default.createElement(ConnectionRelationTypeSelector_1.default, { className: styles.item, relation: selectorCompatibleRelation, metadata: metadata, inRelationTypes: inRelationTypes, outRelationTypes: outRelationTypes, onChange: handleChangeRelationType })),
115
115
  onChangeEntity && (react_1.default.createElement(ErrorWrapper_1.default, { errorMessage: entityErrorMessage, className: styles.item },
116
- react_1.default.createElement(EntitySelector_1.default, { key: relationTypeUri, className: (0, classnames_1.default)((_b = {}, _b[styles.dense] = entityErrorMessage, _b)), entity: selectorCompatibleEntity || {}, entityTypesUris: availableEntityTypeUris, max: 20, globalSearchRequestOptions: globalSearchRequestOptions, mode: mdm_sdk_1.ModeTypes.EDITING, onChange: onChangeEntity, onCreate: undefined, metadata: metadata, attributeTypesSelectionStrategy: undefined }))),
117
- relationTypeUri && (react_1.default.createElement(AttributesList_1.default, { attrTypes: relationAttrTypes, entity: attributeListEntity, showEmptyEditors: showEmptyEditors, mode: mdm_sdk_1.ModeTypes.EDITING, parentUri: relationUri, onAddAttributes: onAddAttributes, onChangeAttribute: onChangeAttribute, onDeleteAttribute: onRemoveAttribute }))));
116
+ react_1.default.createElement(EntitySelector_1.default, { key: relationTypeUri, className: (0, classnames_1.default)((_b = {}, _b[styles.dense] = entityErrorMessage, _b)), entity: selectorCompatibleEntity || {}, entityTypesUris: availableEntityTypeUris, max: 20, globalSearchRequestOptions: globalSearchRequestOptions, mode: mdm_sdk_1.Mode.Editing, onChange: onChangeEntity, onCreate: undefined, metadata: metadata, attributeTypesSelectionStrategy: undefined }))),
117
+ relationTypeUri && (react_1.default.createElement(AttributesList_1.default, { attrTypes: relationAttrTypes, entity: attributeListEntity, showEmptyEditors: showEmptyEditors, mode: mdm_sdk_1.Mode.Editing, parentUri: relationUri, onAddAttributes: onAddAttributes, onChangeAttribute: onChangeAttribute, onDeleteAttribute: onRemoveAttribute }))));
118
118
  };
119
119
  exports.ConnectionEditor = ConnectionEditor;
@@ -1,9 +1,7 @@
1
1
  import React from 'react';
2
- type Props = {
3
- className?: string;
2
+ declare const EntityUriLink: React.ForwardRefExoticComponent<Pick<Omit<React.HTMLProps<HTMLAnchorElement>, "target" | "href" | "onClick"> & {
4
3
  value: string;
5
4
  screen?: string;
6
- children: React.ReactNode;
7
- };
8
- declare const EntityUriLink: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLAnchorElement>>;
5
+ shouldOpenInNewTab?: boolean;
6
+ }, "value" | "label" | "id" | "step" | "type" | "name" | "hidden" | "content" | "max" | "open" | "title" | "data" | "list" | "scope" | "key" | "children" | "default" | "defaultValue" | "required" | "size" | "method" | "headers" | "start" | "prefix" | "action" | "width" | "height" | "screen" | "pattern" | "integrity" | "results" | "cite" | "form" | "slot" | "span" | "style" | "summary" | "color" | "translate" | "wrap" | "multiple" | "disabled" | "className" | "lang" | "media" | "min" | "role" | "tabIndex" | "crossOrigin" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "classID" | "useMap" | "wmode" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "security" | "unselectable" | "inputMode" | "is" | "htmlFor" | "as" | "hrefLang" | "rel" | "sizes" | "charSet" | "cellPadding" | "cellSpacing" | "selected" | "src" | "srcSet" | "autoComplete" | "autoFocus" | "dateTime" | "manifest" | "download" | "alt" | "coords" | "shape" | "autoPlay" | "controls" | "loop" | "mediaGroup" | "muted" | "playsInline" | "preload" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "acceptCharset" | "encType" | "noValidate" | "allowFullScreen" | "allowTransparency" | "frameBorder" | "marginHeight" | "marginWidth" | "sandbox" | "scrolling" | "seamless" | "srcDoc" | "accept" | "capture" | "checked" | "maxLength" | "minLength" | "readOnly" | "challenge" | "keyType" | "keyParams" | "httpEquiv" | "high" | "low" | "optimum" | "reversed" | "async" | "defer" | "nonce" | "scoped" | "colSpan" | "rowSpan" | "cols" | "rows" | "kind" | "srcLang" | "poster" | "shouldOpenInNewTab"> & React.RefAttributes<HTMLAnchorElement>>;
9
7
  export default EntityUriLink;
@@ -48,20 +48,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
48
48
  var react_1 = __importStar(require("react"));
49
49
  var contexts_1 = require("../../contexts");
50
50
  var EntityUriLink = (0, react_1.forwardRef)(function (_a, ref) {
51
- var value = _a.value, children = _a.children, screen = _a.screen, className = _a.className, otherProps = __rest(_a, ["value", "children", "screen", "className"]);
51
+ var value = _a.value, children = _a.children, screen = _a.screen, className = _a.className, _b = _a.shouldOpenInNewTab, shouldOpenInNewTab = _b === void 0 ? false : _b, otherProps = __rest(_a, ["value", "children", "screen", "className", "shouldOpenInNewTab"]);
52
52
  var viewId = (0, react_1.useContext)(contexts_1.ViewIdContext);
53
53
  var generateEntityUrl = (0, react_1.useContext)(contexts_1.UrlGeneratorsContext).generateEntityUrl;
54
54
  var openEntity = (0, contexts_1.useMdmAction)('openEntity');
55
55
  var uiPath = (0, contexts_1.useMdmUiPath)();
56
56
  var generateEntityUrlByUri = function (uri) { return generateEntityUrl({ uiPath: uiPath, uri: uri, screen: screen }); };
57
- var onClick = (0, react_1.useCallback)(function () {
57
+ var handleClick = (0, react_1.useCallback)(function (e) {
58
58
  openEntity({ uri: value, viewId: viewId, screen: screen });
59
- }, [viewId, value, openEntity, screen]);
60
- return (react_1.default.createElement("a", __assign({ ref: ref, href: generateEntityUrlByUri(value), onClick: function (e) {
61
- onClick();
62
- e.stopPropagation();
63
- e.preventDefault();
64
- }, className: className }, otherProps), children));
59
+ e.stopPropagation();
60
+ e.preventDefault();
61
+ }, [openEntity, screen, value, viewId]);
62
+ return (react_1.default.createElement("a", __assign({ ref: ref, href: generateEntityUrlByUri(value), onClick: shouldOpenInNewTab ? undefined : handleClick, target: shouldOpenInNewTab ? '_blank' : '_self', className: className }, otherProps), children));
65
63
  });
66
64
  EntityUriLink.displayName = 'EntityUriLink';
67
65
  exports.default = EntityUriLink;
@@ -1,15 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { ChipProps } from '@mui/material/Chip';
3
+ type Props = Omit<ChipProps, 'label'> & {
4
+ label: string;
5
+ count?: string;
6
+ };
7
+ declare const ValueChip: ({ classes: classesProp, label, count, ...otherProp }: Props) => JSX.Element;
1
8
  export default ValueChip;
2
- declare function ValueChip({ classes: classesProp, label, count, ...otherProp }: {
3
- [x: string]: any;
4
- classes?: {};
5
- label: any;
6
- count: any;
7
- }): JSX.Element;
8
- declare namespace ValueChip {
9
- namespace propTypes {
10
- const classes: PropTypes.Requireable<object>;
11
- const label: PropTypes.Requireable<string>;
12
- const count: PropTypes.Requireable<string>;
13
- }
14
- }
15
- import PropTypes from 'prop-types';
@@ -26,11 +26,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  };
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
28
  var react_1 = __importDefault(require("react"));
29
- var prop_types_1 = __importDefault(require("prop-types"));
30
29
  var Chip_1 = __importDefault(require("@mui/material/Chip"));
31
- var styles_1 = require("./styles");
32
30
  var utils_1 = require("../../core/utils");
33
31
  var ExpandedValueTooltip_1 = __importDefault(require("../ExpandedValueTooltip/ExpandedValueTooltip"));
32
+ var styles_1 = require("./styles");
34
33
  var ValueChip = function (_a) {
35
34
  var _b = _a.classes, classesProp = _b === void 0 ? {} : _b, label = _a.label, count = _a.count, otherProp = __rest(_a, ["classes", "label", "count"]);
36
35
  var classes = (0, styles_1.useChipStyles)();
@@ -40,9 +39,4 @@ var ValueChip = function (_a) {
40
39
  react_1.default.createElement("div", { className: styles.label }, label)),
41
40
  count && react_1.default.createElement("div", { className: styles.count }, count)) }, otherProp)));
42
41
  };
43
- ValueChip.propTypes = {
44
- classes: prop_types_1.default.object,
45
- label: prop_types_1.default.string,
46
- count: prop_types_1.default.string
47
- };
48
42
  exports.default = ValueChip;
@@ -1,2 +1,2 @@
1
- export const useChipStyles: (props?: any) => import("@mui/styles").ClassNameMap<"label" | "root" | "deleteIcon">;
2
- export const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"label" | "count" | "container">;
1
+ export declare const useChipStyles: (props?: any) => import("@mui/styles").ClassNameMap<"label" | "root" | "deleteIcon">;
2
+ export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"label" | "count" | "container">;
@@ -18,7 +18,7 @@ declare const _default: React.MemoExoticComponent<{
18
18
  }>>;
19
19
  showEmptyEditors: import("prop-types").Requireable<boolean>;
20
20
  lazy: import("prop-types").Requireable<boolean>;
21
- mode: import("prop-types").Requireable<any>;
21
+ mode: import("prop-types").Requireable<import("@reltio/mdm-sdk").Mode>;
22
22
  metadata: import("prop-types").Requireable<import("prop-types").InferProps<{
23
23
  uri: import("prop-types").Requireable<string>;
24
24
  description: import("prop-types").Requireable<string>;
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
14
  if (k2 === undefined) k2 = k;
4
15
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -22,6 +33,42 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
33
  __setModuleDefault(result, mod);
23
34
  return result;
24
35
  };
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ var __generator = (this && this.__generator) || function (thisArg, body) {
46
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
47
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48
+ function verb(n) { return function (v) { return step([n, v]); }; }
49
+ function step(op) {
50
+ if (f) throw new TypeError("Generator is already executing.");
51
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
52
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
53
+ if (y = 0, t) op = [op[0] & 2, t.value];
54
+ switch (op[0]) {
55
+ case 0: case 1: t = op; break;
56
+ case 4: _.label++; return { value: op[1], done: false };
57
+ case 5: _.label++; y = op[1]; op = [0]; continue;
58
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
59
+ default:
60
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
61
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
62
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
63
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
64
+ if (t[2]) _.ops.pop();
65
+ _.trys.pop(); continue;
66
+ }
67
+ op = body.call(thisArg, _);
68
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
69
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
70
+ }
71
+ };
25
72
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
73
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
74
  };
@@ -33,29 +80,26 @@ var TypeaheadEditor_1 = __importDefault(require("../../../editors/TypeaheadEdito
33
80
  var SmallIconButton_1 = __importDefault(require("../../../SmallIconButton/SmallIconButton"));
34
81
  var contexts_1 = require("../../../../contexts");
35
82
  var styles_1 = require("./styles");
36
- var filtersWithSearch = function (searchQuery) { return [
37
- {
38
- filter: 'containsWordStartingWith',
39
- fieldName: 'tags',
40
- values: [searchQuery]
41
- }
42
- ]; };
43
- var getQuery = function (searchQuery) {
44
- return searchQuery ? "?filter=".concat((0, mdm_sdk_1.buildFilterQueryString)()(filtersWithSearch(searchQuery))) : '';
45
- };
46
- var body = [
47
- {
48
- fieldName: 'tags',
49
- orderType: 'reversedCount'
50
- }
51
- ];
52
- var getSuggestions = function (searchQuery) {
53
- return (0, mdm_sdk_1.getFacets)({ query: getQuery(searchQuery), body: body }).then(function (response) { return Object.keys(response.tags); });
54
- };
55
83
  var Tags = function (_a) {
56
84
  var className = _a.className, values = _a.values, onChange = _a.onChange, onDelete = _a.onDelete;
57
85
  var styles = (0, styles_1.useStyles)();
58
86
  var entityUri = (0, contexts_1.useMdmEntityUri)();
87
+ var globalSearchRequestOptions = (0, contexts_1.useMdmGlobalSearchRequestOptions)();
88
+ var getSuggestions = (0, react_1.useCallback)(function (searchValue, max, pageNo) { return __awaiter(void 0, void 0, void 0, function () {
89
+ var response;
90
+ return __generator(this, function (_a) {
91
+ switch (_a.label) {
92
+ case 0: return [4 /*yield*/, (0, mdm_sdk_1.getFacetedAttributeData)({
93
+ fieldName: 'tags',
94
+ searchValue: searchValue,
95
+ options: __assign(__assign({}, globalSearchRequestOptions), { max: max, pageNo: pageNo })
96
+ })];
97
+ case 1:
98
+ response = _a.sent();
99
+ return [2 /*return*/, Object.keys(response.tags)];
100
+ }
101
+ });
102
+ }); }, [globalSearchRequestOptions]);
59
103
  var handleChange = (0, react_1.useCallback)(function (tags) {
60
104
  onChange({
61
105
  value: tags,
@@ -44,8 +44,8 @@ var ComplexAttribute = function (_a) {
44
44
  var attributeType = _a.attributeType, attributeValue = _a.attributeValue, attributeTypesList = _a.attributeTypesList, label = _a.label, crosswalksMap = _a.crosswalksMap, disableEdit = _a.disableEdit, disableDelete = _a.disableDelete, onPin = _a.onPin, onIgnore = _a.onIgnore, onDelete = _a.onDelete, onEdit = _a.onEdit, onAdd = _a.onAdd, emptyTempAttributeUris = _a.emptyTempAttributeUris;
45
45
  var styles = (0, styles_1.useStyles)();
46
46
  var _b = (0, useAttributeState_1.useAttributeState)(), isReadingMode = _b.isReadingMode, onMouseEnter = _b.onMouseEnter, onMouseLeave = _b.onMouseLeave;
47
- var canEdit = !disableEdit && (0, mdm_sdk_1.checkMetadataForUpdate)(mdm_sdk_1.ModeTypes.EDITING, attributeType);
48
- var canDelete = !disableDelete && (0, mdm_sdk_1.checkMetadataForDelete)(mdm_sdk_1.ModeTypes.EDITING, attributeType);
47
+ var canEdit = !disableEdit && (0, mdm_sdk_1.checkMetadataForUpdate)(mdm_sdk_1.Mode.Editing, attributeType);
48
+ var canDelete = !disableDelete && (0, mdm_sdk_1.checkMetadataForDelete)(mdm_sdk_1.Mode.Editing, attributeType);
49
49
  var isTemporary = (0, mdm_sdk_1.isTempUri)(attributeValue.uri);
50
50
  var showPin = !isTemporary && ((!isReadingMode && canEdit) || attributeValue.pin);
51
51
  var showIgnore = !isTemporary && ((!isReadingMode && canEdit) || attributeValue.ignored);
@@ -32,7 +32,7 @@ var Button_1 = __importDefault(require("@mui/material/Button"));
32
32
  var ui_i18n_1 = __importDefault(require("ui-i18n"));
33
33
  var NestedAttributesBlock = function (_a) {
34
34
  var className = _a.className, attributeValues = _a.attributeValues, attributeType = _a.attributeType, onAdd = _a.onAdd, parentUri = _a.parentUri, disableEdit = _a.disableEdit, props = __rest(_a, ["className", "attributeValues", "attributeType", "onAdd", "parentUri", "disableEdit"]);
35
- var canCreate = !disableEdit && (0, mdm_sdk_1.checkMetadataForCreate)(mdm_sdk_1.ModeTypes.EDITING, attributeType);
35
+ var canCreate = !disableEdit && (0, mdm_sdk_1.checkMetadataForCreate)(mdm_sdk_1.Mode.Editing, attributeType);
36
36
  return attributeValues.length === 0 && canCreate ? (react_1.default.createElement(Button_1.default, { variant: "text", color: "primary", onClick: function () {
37
37
  return onAdd({
38
38
  parentUri: parentUri,
@@ -50,8 +50,8 @@ var SimpleAttribute = function (_a) {
50
50
  var id = (0, mdm_sdk_1.getLastUriPart)(attributeValue.uri);
51
51
  var crosswalkDisabled = (0, mdm_sdk_1.isCrosswalkDisabled)(crosswalk);
52
52
  var canModifyAttribute = !attributeType.system && !crosswalkDisabled;
53
- var canEdit = canModifyAttribute && !disableEdit && (0, mdm_sdk_1.checkMetadataForUpdate)(mdm_sdk_1.ModeTypes.EDITING, attributeType);
54
- var canDelete = canModifyAttribute && !disableDelete && (0, mdm_sdk_1.checkMetadataForDelete)(mdm_sdk_1.ModeTypes.EDITING, attributeType);
53
+ var canEdit = canModifyAttribute && !disableEdit && (0, mdm_sdk_1.checkMetadataForUpdate)(mdm_sdk_1.Mode.Editing, attributeType);
54
+ var canDelete = canModifyAttribute && !disableDelete && (0, mdm_sdk_1.checkMetadataForDelete)(mdm_sdk_1.Mode.Editing, attributeType);
55
55
  var isTemporary = (0, mdm_sdk_1.isTempUri)(attributeValue.uri);
56
56
  var hasBasicPermission = (0, mdm_sdk_1.checkBasicMetadataPermission)(mdm_sdk_1.MetadataPermissions.UPDATE, attributeType) && !disableEdit && canModifyAttribute;
57
57
  var showPin = !isTemporary && ((!isReadingMode && hasBasicPermission) || attributeValue.pin);
@@ -40,7 +40,7 @@ var SimpleAttributesBlock = function (_a) {
40
40
  var crosswalk = _a.crosswalk;
41
41
  var isRelationCrosswalk = (0, mdm_sdk_1.isRelationUri)(crosswalk.uri) || crosswalk.ownerType === 'relation';
42
42
  var isEntityCrosswalk = (0, mdm_sdk_1.isEntityUri)(crosswalk.uri) && crosswalk.ownerType === 'entity';
43
- return ((0, mdm_sdk_1.checkMetadataForCreate)(mdm_sdk_1.ModeTypes.EDITING, attributeType) &&
43
+ return ((0, mdm_sdk_1.checkMetadataForCreate)(mdm_sdk_1.Mode.Editing, attributeType) &&
44
44
  !disableEdit &&
45
45
  ((isRelationCrosswalk && (0, mdm_sdk_1.isRelationTypeUri)(attributeType.uri)) ||
46
46
  (isEntityCrosswalk && (0, mdm_sdk_1.isEntityTypeUri)(attributeType.uri))));
@@ -22,7 +22,7 @@ declare const _default: React.MemoExoticComponent<{
22
22
  }>>;
23
23
  showEmptyEditors: import("prop-types").Requireable<boolean>;
24
24
  lazy: import("prop-types").Requireable<boolean>;
25
- mode: import("prop-types").Requireable<any>;
25
+ mode: import("prop-types").Requireable<import("@reltio/mdm-sdk").Mode>;
26
26
  metadata: import("prop-types").Requireable<import("prop-types").InferProps<{
27
27
  uri: import("prop-types").Requireable<string>;
28
28
  description: import("prop-types").Requireable<string>;
@@ -27,7 +27,7 @@ var AddAttributesButton = function (_a) {
27
27
  var metadata = (0, contexts_1.useMdmMetadata)();
28
28
  var parentType = __spreadArray(__spreadArray([], metadata.entityTypes, true), (metadata.relationTypes || []), true).find((0, ramda_1.propEq)('uri', parentTypeUri));
29
29
  var isNotSelected = function (attrType) { return !(selectedAttributeTypes === null || selectedAttributeTypes === void 0 ? void 0 : selectedAttributeTypes.find((0, ramda_1.propEq)('uri', attrType.uri))); };
30
- var canCreate = function (attributeType) { return (0, mdm_sdk_1.checkCanCreateAttribute)({ attributeType: attributeType, mode: mdm_sdk_1.ModeTypes.EDITING }); };
30
+ var canCreate = function (attributeType) { return (0, mdm_sdk_1.checkCanCreateAttribute)({ attributeType: attributeType, mode: mdm_sdk_1.Mode.Editing }); };
31
31
  var data = (0, ramda_1.pipe)((0, ramda_1.propOr)([], 'attributes'), (0, ramda_1.reject)((0, ramda_1.either)(mdm_sdk_1.isReference, mdm_sdk_1.isImage)), (0, ramda_1.filter)((0, ramda_1.either)(mdm_sdk_1.isNested, isNotSelected)), (0, ramda_1.filter)((0, ramda_1.both)(mdm_sdk_1.isReadableAttribute, canCreate)))(parentType);
32
32
  var handleAdd = function (addedTypes) {
33
33
  var typesToSelect = addedTypes.filter(isNotSelected);
@@ -33,7 +33,7 @@ declare function useEditorContext(fieldName: any, dataTypeDefinition: any): {
33
33
  format?: undefined;
34
34
  tenant?: undefined;
35
35
  } | {
36
- getSuggestions: (searchValue: any, max: any, pageNo: any) => Promise<any>;
36
+ getSuggestions: (searchValue: any, max: any, pageNo: any) => Promise<Record<string, unknown>>;
37
37
  entries?: undefined;
38
38
  lookups?: undefined;
39
39
  lookupCode?: undefined;
@@ -1,26 +1,22 @@
1
- export default TypeaheadEditor;
2
- declare function TypeaheadEditor({ value, max, getSuggestions, onChange, multiple, fullWidth, InputProps, isCrossedOut, ...inputProps }: {
3
- [x: string]: any;
4
- value: any;
1
+ /// <reference types="react" />
2
+ import { TextFieldProps } from '@mui/material/TextField';
3
+ type CommonProps = Omit<TextFieldProps, 'onChange' | 'value'> & {
4
+ getSuggestions?: (value: string, pageSize: number, pageNumber?: number) => Promise<string[]>;
5
5
  max?: number;
6
- getSuggestions: any;
7
- onChange: any;
8
- multiple: any;
9
- fullWidth: any;
10
- InputProps?: {};
6
+ multiple?: boolean;
7
+ fullWidth?: boolean;
11
8
  isCrossedOut?: boolean;
12
- }): JSX.Element;
13
- declare namespace TypeaheadEditor {
14
- namespace propTypes {
15
- const multiple: PropTypes.Requireable<boolean>;
16
- const fullWidth: PropTypes.Requireable<boolean>;
17
- const placeholder: PropTypes.Requireable<string>;
18
- const value: PropTypes.Requireable<NonNullable<string | string[]>>;
19
- const onChange: PropTypes.Validator<(...args: any[]) => any>;
20
- const getSuggestions: PropTypes.Validator<(...args: any[]) => any>;
21
- const InputProps: PropTypes.Requireable<object>;
22
- const max: PropTypes.Requireable<number>;
23
- const isCrossedOut: PropTypes.Requireable<boolean>;
24
- }
25
- }
26
- import PropTypes from 'prop-types';
9
+ };
10
+ type MultipleProps = CommonProps & {
11
+ value: string[];
12
+ onChange: (values: string[]) => void;
13
+ multiple: true;
14
+ };
15
+ type SingleProps = CommonProps & {
16
+ value: string;
17
+ onChange: (value: string) => void;
18
+ multiple?: false;
19
+ };
20
+ export type Props = MultipleProps | SingleProps;
21
+ declare const TypeaheadEditor: ({ value, max, getSuggestions, onChange, multiple, fullWidth, InputProps, isCrossedOut, ...inputProps }: Props) => JSX.Element;
22
+ export default TypeaheadEditor;