@reltio/components 1.4.1666 → 1.4.1668

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 (59) 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/AttributesPager/AttributesPager.js +1 -1
  8. package/cjs/components/attributes/editMode/AttributesPager/ImageLineRenderer.d.ts +5 -2
  9. package/cjs/components/attributes/editMode/AttributesPager/ImageLineRenderer.js +44 -9
  10. package/cjs/components/attributes/editMode/AttributesPager/styles.d.ts +1 -1
  11. package/cjs/components/attributes/editMode/AttributesPager/styles.js +7 -0
  12. package/cjs/components/attributes/editMode/ImageAttributesLine/ImageAttributesLine.js +1 -1
  13. package/cjs/components/attributes/editMode/ImageAttributesLine/styles.js +1 -2
  14. package/cjs/components/attributes/editMode/NestedAttribute/NestedAttribute.d.ts +1 -1
  15. package/cjs/components/attributes/editMode/Tags/Tags.js +63 -19
  16. package/cjs/components/attributes/inline/ComplexAttribute/ComplexAttribute.js +2 -2
  17. package/cjs/components/attributes/inline/NestedAttributesBlock/NestedAttributesBlock.js +1 -1
  18. package/cjs/components/attributes/inline/SimpleAttribute/SimpleAttribute.js +2 -2
  19. package/cjs/components/attributes/inline/SimpleAttributesBlock/SimpleAttributesBlock.js +1 -1
  20. package/cjs/components/attributes/readMode/NestedAttribute/NestedAttribute.d.ts +1 -1
  21. package/cjs/components/crosswalks/AttributesTable/AddAttributesButton/AddAttributesButton.js +1 -1
  22. package/cjs/components/editors/DataTypeValueEditor/useEditorContext.d.ts +1 -1
  23. package/cjs/components/editors/TypeaheadEditor/TypeaheadEditor.d.ts +20 -24
  24. package/cjs/components/editors/TypeaheadEditor/TypeaheadEditor.js +155 -83
  25. package/cjs/components/editors/TypeaheadEditor/styles.d.ts +1 -1
  26. package/cjs/components/editors/TypeaheadEditor/styles.js +17 -17
  27. package/cjs/components/history/ContributorsPanel/styles.d.ts +1 -1
  28. package/cjs/hooks/useCommentsEntitiesMap.js +1 -1
  29. package/cjs/hooks/useMatchesLoader.js +2 -2
  30. package/esm/components/ConnectionEditor/ConnectionEditor.js +3 -3
  31. package/esm/components/EntityUriLink/EntityUriLink.d.ts +3 -5
  32. package/esm/components/EntityUriLink/EntityUriLink.js +6 -8
  33. package/esm/components/ValueChip/ValueChip.d.ts +7 -14
  34. package/esm/components/ValueChip/ValueChip.js +1 -7
  35. package/esm/components/ValueChip/styles.d.ts +2 -2
  36. package/esm/components/attributes/editMode/AttributesPager/AttributesPager.js +2 -2
  37. package/esm/components/attributes/editMode/AttributesPager/ImageLineRenderer.d.ts +5 -2
  38. package/esm/components/attributes/editMode/AttributesPager/ImageLineRenderer.js +21 -9
  39. package/esm/components/attributes/editMode/AttributesPager/styles.d.ts +1 -1
  40. package/esm/components/attributes/editMode/AttributesPager/styles.js +7 -0
  41. package/esm/components/attributes/editMode/ImageAttributesLine/ImageAttributesLine.js +1 -1
  42. package/esm/components/attributes/editMode/ImageAttributesLine/styles.js +1 -2
  43. package/esm/components/attributes/editMode/NestedAttribute/NestedAttribute.d.ts +1 -1
  44. package/esm/components/attributes/editMode/Tags/Tags.js +65 -21
  45. package/esm/components/attributes/inline/ComplexAttribute/ComplexAttribute.js +3 -3
  46. package/esm/components/attributes/inline/NestedAttributesBlock/NestedAttributesBlock.js +2 -2
  47. package/esm/components/attributes/inline/SimpleAttribute/SimpleAttribute.js +3 -3
  48. package/esm/components/attributes/inline/SimpleAttributesBlock/SimpleAttributesBlock.js +2 -2
  49. package/esm/components/attributes/readMode/NestedAttribute/NestedAttribute.d.ts +1 -1
  50. package/esm/components/crosswalks/AttributesTable/AddAttributesButton/AddAttributesButton.js +2 -2
  51. package/esm/components/editors/DataTypeValueEditor/useEditorContext.d.ts +1 -1
  52. package/esm/components/editors/TypeaheadEditor/TypeaheadEditor.d.ts +20 -24
  53. package/esm/components/editors/TypeaheadEditor/TypeaheadEditor.js +155 -83
  54. package/esm/components/editors/TypeaheadEditor/styles.d.ts +1 -1
  55. package/esm/components/editors/TypeaheadEditor/styles.js +17 -17
  56. package/esm/components/history/ContributorsPanel/styles.d.ts +1 -1
  57. package/esm/hooks/useCommentsEntitiesMap.js +2 -2
  58. package/esm/hooks/useMatchesLoader.js +3 -3
  59. package/package.json +2 -2
@@ -1,18 +1,30 @@
1
- import React from 'react';
1
+ import React, { useCallback } from 'react';
2
2
  import classnames from 'classnames';
3
+ import { pipe } from 'ramda';
4
+ import { getErrorId } from '@reltio/mdm-sdk';
3
5
  import Title from '../../../Title/Title';
4
6
  import DescriptionIcon from '../../DescriptionIcon';
5
7
  import ImageAttributesLine from '../ImageAttributesLine';
6
8
  import { useScrollToAttribute } from '../hooks/useScrollToAttribute/useScrollToAttribute';
9
+ import { useScrollToAttributeError } from '../../../../hooks';
10
+ import ErrorWrapper from '../../../ErrorWrapper/ErrorWrapper';
7
11
  import { useStyles } from './styles';
8
12
  export var ImageLineRenderer = function (_a) {
9
- var attributeType = _a.attributeType, attributeValues = _a.attributeValues, paging = _a.paging, parentUri = _a.parentUri, showNonOv = _a.showNonOv, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues, highlightedAttribute = _a.highlightedAttribute;
13
+ var attributeType = _a.attributeType, attributeValues = _a.attributeValues, paging = _a.paging, parentUri = _a.parentUri, showNonOv = _a.showNonOv, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues, highlightedAttribute = _a.highlightedAttribute, error = _a.error, highlightedError = _a.highlightedError, onDeactivateError = _a.onDeactivateError;
10
14
  var styles = useStyles();
11
- var label = attributeType.label, description = attributeType.description;
12
- var _b = useScrollToAttribute(highlightedAttribute), ref = _b.ref, highlightedClassName = _b.highlightedClassName;
13
- return (React.createElement("div", { ref: ref, className: classnames(styles.wrapper, highlightedClassName) },
14
- React.createElement("div", { className: styles.titleWrapper },
15
- React.createElement(Title, { className: styles.title, label: label, "data-reltio-id": "reltio-attribute-label" }),
16
- React.createElement(DescriptionIcon, { className: styles.description, description: description })),
17
- React.createElement(ImageAttributesLine, { attributeValues: attributeValues, attributeType: attributeType, paging: paging, onDeleteAttribute: onDeleteAttribute, parentUri: parentUri, onChangeAttribute: onChangeAttribute, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv })));
15
+ var label = attributeType.label, description = attributeType.description, isRequired = attributeType.required;
16
+ var _b = useScrollToAttribute(highlightedAttribute), highlightedRef = _b.ref, highlightedClassName = _b.highlightedClassName;
17
+ var _c = useScrollToAttributeError({ highlightedError: highlightedError }), errorRef = _c.ref, errorClassName = _c.errorClassName;
18
+ var deactivateError = useCallback(function () {
19
+ if (error && !!onDeactivateError) {
20
+ onDeactivateError(getErrorId(error));
21
+ }
22
+ }, [error, onDeactivateError]);
23
+ return (React.createElement("div", { ref: highlightedRef, className: classnames(styles.wrapper, highlightedClassName) },
24
+ React.createElement("div", { ref: errorRef, className: classnames(styles.imagesWrapper, errorClassName) },
25
+ React.createElement("div", { className: styles.titleWrapper },
26
+ React.createElement(Title, { className: styles.title, label: label, "data-reltio-id": "reltio-attribute-label", isRequired: isRequired }),
27
+ React.createElement(DescriptionIcon, { className: styles.description, description: description })),
28
+ React.createElement(ErrorWrapper, { errorMessage: error === null || error === void 0 ? void 0 : error.message, className: styles.errorWrapper },
29
+ React.createElement(ImageAttributesLine, { attributeValues: attributeValues, attributeType: attributeType, paging: paging, onDeleteAttribute: onDeleteAttribute, parentUri: parentUri, onChangeAttribute: pipe(onChangeAttribute, deactivateError), requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv })))));
18
30
  };
@@ -1 +1 @@
1
- export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"link" | "description" | "caption" | "title" | "wrapper" | "ovIcon" | "svg-icon__root" | "attributesWrapper" | "typeError" | "titleWrapper">;
1
+ export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"link" | "description" | "caption" | "title" | "wrapper" | "ovIcon" | "svg-icon__root" | "attributesWrapper" | "imagesWrapper" | "typeError" | "titleWrapper" | "errorWrapper">;
@@ -17,6 +17,10 @@ export var useStyles = makeStyles(function (theme) { return ({
17
17
  width: '100%',
18
18
  marginBottom: '10px'
19
19
  },
20
+ imagesWrapper: {
21
+ paddingBottom: '10px',
22
+ width: '100%'
23
+ },
20
24
  link: {
21
25
  display: 'flex',
22
26
  marginTop: 4
@@ -41,5 +45,8 @@ export var useStyles = makeStyles(function (theme) { return ({
41
45
  titleWrapper: {
42
46
  flex: 1,
43
47
  paddingBottom: '3px'
48
+ },
49
+ errorWrapper: {
50
+ paddingBottom: '10px'
44
51
  }
45
52
  }); });
@@ -75,7 +75,7 @@ var ImageAttributesLine = function (_a) {
75
75
  return (React.createElement("div", { className: styles.root },
76
76
  React.createElement(ImageAttributesLineCommon, { attributeValues: attributeValues, attributeType: attributeType, renderImage: renderImage, overlay: true, countFixedItems: 1, onUpload: toggleVisibilityUploadDialog, onDeleteAttribute: handleDeleteAttribute, imageSize: imageSize, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, paging: paging, parentUri: parentUri, showNonOv: showNonOv },
77
77
  React.createElement("div", { className: styles.uploadContainer, onClick: toggleVisibilityUploadDialog },
78
- React.createElement(SmallIconButton, { className: styles.uploadButton, iconClassName: styles.uploadIcon, icon: CloudUploadIcon }))),
78
+ React.createElement(SmallIconButton, { className: styles.uploadButton, iconClassName: styles.uploadIcon, icon: CloudUploadIcon, "data-reltio-id": "reltio-upload-image-button" }))),
79
79
  React.createElement(UploadImageDialog, { open: isVisibleUploadDialog, onUpload: handleAddAttributes, onClose: toggleVisibilityUploadDialog })));
80
80
  };
81
81
  export default ImageAttributesLine;
@@ -1,8 +1,7 @@
1
1
  import { makeStyles } from '@mui/styles';
2
2
  export var useStyles = makeStyles(function () { return ({
3
3
  root: {
4
- width: '100%',
5
- marginBottom: '10px'
4
+ width: '100%'
6
5
  },
7
6
  image: function (_a) {
8
7
  var imageMargin = _a.imageMargin;
@@ -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,33 +1,77 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ 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;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
1
48
  import React, { useCallback } from 'react';
2
- import { getFacets, EntityAttrTypes, buildFilterQueryString } from '@reltio/mdm-sdk';
49
+ import { EntityAttrTypes, getFacetedAttributeData } from '@reltio/mdm-sdk';
3
50
  import DeleteIcon from '@mui/icons-material/Delete';
4
51
  import TypeaheadEditor from '../../../editors/TypeaheadEditor/TypeaheadEditor';
5
52
  import SmallIconButton from '../../../SmallIconButton/SmallIconButton';
6
- import { useMdmEntityUri } from '../../../../contexts';
53
+ import { useMdmEntityUri, useMdmGlobalSearchRequestOptions } from '../../../../contexts';
7
54
  import { useStyles } from './styles';
8
- var filtersWithSearch = function (searchQuery) { return [
9
- {
10
- filter: 'containsWordStartingWith',
11
- fieldName: 'tags',
12
- values: [searchQuery]
13
- }
14
- ]; };
15
- var getQuery = function (searchQuery) {
16
- return searchQuery ? "?filter=".concat(buildFilterQueryString()(filtersWithSearch(searchQuery))) : '';
17
- };
18
- var body = [
19
- {
20
- fieldName: 'tags',
21
- orderType: 'reversedCount'
22
- }
23
- ];
24
- var getSuggestions = function (searchQuery) {
25
- return getFacets({ query: getQuery(searchQuery), body: body }).then(function (response) { return Object.keys(response.tags); });
26
- };
27
55
  var Tags = function (_a) {
28
56
  var className = _a.className, values = _a.values, onChange = _a.onChange, onDelete = _a.onDelete;
29
57
  var styles = useStyles();
30
58
  var entityUri = useMdmEntityUri();
59
+ var globalSearchRequestOptions = useMdmGlobalSearchRequestOptions();
60
+ var getSuggestions = useCallback(function (searchValue, max, pageNo) { return __awaiter(void 0, void 0, void 0, function () {
61
+ var response;
62
+ return __generator(this, function (_a) {
63
+ switch (_a.label) {
64
+ case 0: return [4 /*yield*/, getFacetedAttributeData({
65
+ fieldName: 'tags',
66
+ searchValue: searchValue,
67
+ options: __assign(__assign({}, globalSearchRequestOptions), { max: max, pageNo: pageNo })
68
+ })];
69
+ case 1:
70
+ response = _a.sent();
71
+ return [2 /*return*/, Object.keys(response.tags)];
72
+ }
73
+ });
74
+ }); }, [globalSearchRequestOptions]);
31
75
  var handleChange = useCallback(function (tags) {
32
76
  onChange({
33
77
  value: tags,
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react';
2
- import { areOneHierarchyUris, checkMetadataForDelete, checkMetadataForUpdate, isTempUri, getCrosswalkId, ModeTypes } from '@reltio/mdm-sdk';
2
+ import { areOneHierarchyUris, checkMetadataForDelete, checkMetadataForUpdate, isTempUri, getCrosswalkId, Mode } from '@reltio/mdm-sdk';
3
3
  import { useAttributeState } from '../hooks/useAttributeState';
4
4
  import { Spacer } from '../../../index';
5
5
  import CrosswalkIcon from '../common/CrosswalkIcon';
@@ -16,8 +16,8 @@ var ComplexAttribute = function (_a) {
16
16
  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;
17
17
  var styles = useStyles();
18
18
  var _b = useAttributeState(), isReadingMode = _b.isReadingMode, onMouseEnter = _b.onMouseEnter, onMouseLeave = _b.onMouseLeave;
19
- var canEdit = !disableEdit && checkMetadataForUpdate(ModeTypes.EDITING, attributeType);
20
- var canDelete = !disableDelete && checkMetadataForDelete(ModeTypes.EDITING, attributeType);
19
+ var canEdit = !disableEdit && checkMetadataForUpdate(Mode.Editing, attributeType);
20
+ var canDelete = !disableDelete && checkMetadataForDelete(Mode.Editing, attributeType);
21
21
  var isTemporary = isTempUri(attributeValue.uri);
22
22
  var showPin = !isTemporary && ((!isReadingMode && canEdit) || attributeValue.pin);
23
23
  var showIgnore = !isTemporary && ((!isReadingMode && canEdit) || attributeValue.ignored);
@@ -21,13 +21,13 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import React from 'react';
24
- import { checkMetadataForCreate, ModeTypes } from '@reltio/mdm-sdk';
24
+ import { checkMetadataForCreate, Mode } from '@reltio/mdm-sdk';
25
25
  import NestedAttribute from '../NestedAttribute/NestedAttribute';
26
26
  import Button from '@mui/material/Button';
27
27
  import i18n from 'ui-i18n';
28
28
  var NestedAttributesBlock = function (_a) {
29
29
  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"]);
30
- var canCreate = !disableEdit && checkMetadataForCreate(ModeTypes.EDITING, attributeType);
30
+ var canCreate = !disableEdit && checkMetadataForCreate(Mode.Editing, attributeType);
31
31
  return attributeValues.length === 0 && canCreate ? (React.createElement(Button, { variant: "text", color: "primary", onClick: function () {
32
32
  return onAdd({
33
33
  parentUri: parentUri,
@@ -2,7 +2,7 @@ import React, { useEffect, useRef } from 'react';
2
2
  import DeleteIcon from '@mui/icons-material/Delete';
3
3
  import EditIcon from '@mui/icons-material/Edit';
4
4
  import MoreVertIcon from '@mui/icons-material/MoreVert';
5
- import { checkMetadataForDelete, checkMetadataForUpdate, getAttrDataTypeDefinition, getAttributeValue, getLastUriPart, isAutoGeneratedAttribute, isCrosswalkDisabled, isTempUri, MetadataPermissions, ModeTypes, checkBasicMetadataPermission } from '@reltio/mdm-sdk';
5
+ import { checkMetadataForDelete, checkMetadataForUpdate, getAttrDataTypeDefinition, getAttributeValue, getLastUriPart, isAutoGeneratedAttribute, isCrosswalkDisabled, isTempUri, MetadataPermissions, Mode, checkBasicMetadataPermission } from '@reltio/mdm-sdk';
6
6
  import classnames from 'classnames';
7
7
  import i18n from 'ui-i18n';
8
8
  import DataTypeValue from '../../../DataTypeValue/DataTypeValue';
@@ -22,8 +22,8 @@ var SimpleAttribute = function (_a) {
22
22
  var id = getLastUriPart(attributeValue.uri);
23
23
  var crosswalkDisabled = isCrosswalkDisabled(crosswalk);
24
24
  var canModifyAttribute = !attributeType.system && !crosswalkDisabled;
25
- var canEdit = canModifyAttribute && !disableEdit && checkMetadataForUpdate(ModeTypes.EDITING, attributeType);
26
- var canDelete = canModifyAttribute && !disableDelete && checkMetadataForDelete(ModeTypes.EDITING, attributeType);
25
+ var canEdit = canModifyAttribute && !disableEdit && checkMetadataForUpdate(Mode.Editing, attributeType);
26
+ var canDelete = canModifyAttribute && !disableDelete && checkMetadataForDelete(Mode.Editing, attributeType);
27
27
  var isTemporary = isTempUri(attributeValue.uri);
28
28
  var hasBasicPermission = checkBasicMetadataPermission(MetadataPermissions.UPDATE, attributeType) && !disableEdit && canModifyAttribute;
29
29
  var showPin = !isTemporary && ((!isReadingMode && hasBasicPermission) || attributeValue.pin);
@@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  };
23
23
  import React from 'react';
24
24
  import SimpleAttribute from '../SimpleAttribute';
25
- import { checkMetadataForCreate, isEntityTypeUri, isEntityUri, isRelationTypeUri, isRelationUri, ModeTypes } from '@reltio/mdm-sdk';
25
+ import { checkMetadataForCreate, isEntityTypeUri, isEntityUri, isRelationTypeUri, isRelationUri, Mode } from '@reltio/mdm-sdk';
26
26
  import { useDrop } from 'react-dnd';
27
27
  import i18n from 'ui-i18n';
28
28
  import { useStyles } from './styles';
@@ -35,7 +35,7 @@ var SimpleAttributesBlock = function (_a) {
35
35
  var crosswalk = _a.crosswalk;
36
36
  var isRelationCrosswalk = isRelationUri(crosswalk.uri) || crosswalk.ownerType === 'relation';
37
37
  var isEntityCrosswalk = isEntityUri(crosswalk.uri) && crosswalk.ownerType === 'entity';
38
- return (checkMetadataForCreate(ModeTypes.EDITING, attributeType) &&
38
+ return (checkMetadataForCreate(Mode.Editing, attributeType) &&
39
39
  !disableEdit &&
40
40
  ((isRelationCrosswalk && isRelationTypeUri(attributeType.uri)) ||
41
41
  (isEntityCrosswalk && 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>;
@@ -12,7 +12,7 @@ import MoreAttributesButton from '../../../attributes/editMode/MoreAttributesBut
12
12
  import { withTableContext } from '../../../BasicTableView';
13
13
  import i18n from 'ui-i18n';
14
14
  import { both, either, filter, pick, pipe, propEq, propOr, reject } from 'ramda';
15
- import { checkCanCreateAttribute, isImage, isNested, isReadableAttribute, isReference, ModeTypes } from '@reltio/mdm-sdk';
15
+ import { checkCanCreateAttribute, isImage, isNested, isReadableAttribute, isReference, Mode } from '@reltio/mdm-sdk';
16
16
  import { useMdmMetadata } from '../../../../contexts';
17
17
  import { useStyles } from './styles';
18
18
  export var AddAttributesButton = function (_a) {
@@ -21,7 +21,7 @@ export var AddAttributesButton = function (_a) {
21
21
  var metadata = useMdmMetadata();
22
22
  var parentType = __spreadArray(__spreadArray([], metadata.entityTypes, true), (metadata.relationTypes || []), true).find(propEq('uri', parentTypeUri));
23
23
  var isNotSelected = function (attrType) { return !(selectedAttributeTypes === null || selectedAttributeTypes === void 0 ? void 0 : selectedAttributeTypes.find(propEq('uri', attrType.uri))); };
24
- var canCreate = function (attributeType) { return checkCanCreateAttribute({ attributeType: attributeType, mode: ModeTypes.EDITING }); };
24
+ var canCreate = function (attributeType) { return checkCanCreateAttribute({ attributeType: attributeType, mode: Mode.Editing }); };
25
25
  var data = pipe(propOr([], 'attributes'), reject(either(isReference, isImage)), filter(either(isNested, isNotSelected)), filter(both(isReadableAttribute, canCreate)))(parentType);
26
26
  var handleAdd = function (addedTypes) {
27
27
  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;