@reltio/components 1.4.1039 → 1.4.1041
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/EntityTypesSelector/EntityTypesSelector.d.ts +17 -55
- package/cjs/components/EntityTypesSelector/EntityTypesSelector.js +8 -118
- package/cjs/components/MetadataTypesSelector/ListLabel/ListLabel.d.ts +7 -0
- package/cjs/components/{EntityTypesSelector → MetadataTypesSelector}/ListLabel/ListLabel.js +2 -6
- package/cjs/components/MetadataTypesSelector/ListLabel/helpers.d.ts +4 -0
- package/cjs/components/{EntityTypesSelector → MetadataTypesSelector}/ListLabel/helpers.js +1 -1
- package/cjs/components/MetadataTypesSelector/ListLabel/styles.d.ts +1 -0
- package/cjs/components/{EntityTypesSelector → MetadataTypesSelector}/ListLabel/styles.js +0 -0
- package/cjs/components/MetadataTypesSelector/MetadataTypesSelector.d.ts +26 -0
- package/cjs/components/MetadataTypesSelector/MetadataTypesSelector.js +123 -0
- package/cjs/components/MetadataTypesSelector/SelectMetadataTypesList.d.ts +20 -0
- package/cjs/components/{EntityTypesSelector/SelectEntityTypesList.js → MetadataTypesSelector/SelectMetadataTypesList.js} +7 -12
- package/cjs/components/MetadataTypesSelector/styles.d.ts +1 -0
- package/cjs/components/{EntityTypesSelector → MetadataTypesSelector}/styles.js +0 -0
- package/cjs/components/RelationTypesSelector/RelationTypesSelector.d.ts +17 -0
- package/cjs/components/RelationTypesSelector/RelationTypesSelector.js +35 -0
- package/cjs/components/SearchInput/SearchInput.d.ts +3 -2
- package/cjs/components/SearchInput/SearchInput.js +3 -3
- package/cjs/components/SelectionPopup/SelectionPopup.d.ts +17 -44
- package/cjs/components/SelectionPopup/SelectionPopup.js +8 -26
- package/cjs/components/SelectionPopup/SelectionPopupPopper/SelectionPopupPopper.d.ts +17 -35
- package/cjs/components/SelectionPopup/SelectionPopupPopper/SelectionPopupPopper.js +0 -21
- package/cjs/components/SelectionPopup/helpers.d.ts +23 -9
- package/cjs/components/index.d.ts +2 -1
- package/cjs/components/index.js +5 -3
- package/esm/components/EntityTypesSelector/EntityTypesSelector.d.ts +17 -55
- package/esm/components/EntityTypesSelector/EntityTypesSelector.js +9 -120
- package/esm/components/MetadataTypesSelector/ListLabel/ListLabel.d.ts +7 -0
- package/esm/components/{EntityTypesSelector → MetadataTypesSelector}/ListLabel/ListLabel.js +1 -7
- package/esm/components/MetadataTypesSelector/ListLabel/helpers.d.ts +4 -0
- package/esm/components/{EntityTypesSelector → MetadataTypesSelector}/ListLabel/helpers.js +1 -1
- package/esm/components/MetadataTypesSelector/ListLabel/styles.d.ts +1 -0
- package/esm/components/{EntityTypesSelector → MetadataTypesSelector}/ListLabel/styles.js +0 -0
- package/esm/components/MetadataTypesSelector/MetadataTypesSelector.d.ts +26 -0
- package/esm/components/MetadataTypesSelector/MetadataTypesSelector.js +98 -0
- package/esm/components/MetadataTypesSelector/SelectMetadataTypesList.d.ts +20 -0
- package/esm/components/{EntityTypesSelector/SelectEntityTypesList.js → MetadataTypesSelector/SelectMetadataTypesList.js} +6 -12
- package/esm/components/MetadataTypesSelector/styles.d.ts +1 -0
- package/esm/components/{EntityTypesSelector → MetadataTypesSelector}/styles.js +0 -0
- package/esm/components/RelationTypesSelector/RelationTypesSelector.d.ts +17 -0
- package/esm/components/RelationTypesSelector/RelationTypesSelector.js +10 -0
- package/esm/components/SearchInput/SearchInput.d.ts +3 -2
- package/esm/components/SearchInput/SearchInput.js +3 -3
- package/esm/components/SelectionPopup/SelectionPopup.d.ts +17 -44
- package/esm/components/SelectionPopup/SelectionPopup.js +8 -26
- package/esm/components/SelectionPopup/SelectionPopupPopper/SelectionPopupPopper.d.ts +17 -35
- package/esm/components/SelectionPopup/SelectionPopupPopper/SelectionPopupPopper.js +0 -21
- package/esm/components/SelectionPopup/helpers.d.ts +23 -9
- package/esm/components/index.d.ts +2 -1
- package/esm/components/index.js +2 -1
- package/package.json +3 -3
- package/cjs/components/EntityTypesSelector/ListLabel/ListLabel.d.ts +0 -12
- package/cjs/components/EntityTypesSelector/ListLabel/helpers.d.ts +0 -3
- package/cjs/components/EntityTypesSelector/ListLabel/styles.d.ts +0 -1
- package/cjs/components/EntityTypesSelector/SelectEntityTypesList.d.ts +0 -16
- package/cjs/components/EntityTypesSelector/styles.d.ts +0 -1
- package/esm/components/EntityTypesSelector/ListLabel/ListLabel.d.ts +0 -12
- package/esm/components/EntityTypesSelector/ListLabel/helpers.d.ts +0 -3
- package/esm/components/EntityTypesSelector/ListLabel/styles.d.ts +0 -1
- package/esm/components/EntityTypesSelector/SelectEntityTypesList.d.ts +0 -16
- package/esm/components/EntityTypesSelector/styles.d.ts +0 -1
|
@@ -26,45 +26,27 @@ 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 classnames_1 = __importDefault(require("classnames"));
|
|
31
30
|
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
32
31
|
var Popover_1 = __importDefault(require("@material-ui/core/Popover"));
|
|
33
32
|
var styles_js_1 = __importDefault(require("./styles.js"));
|
|
34
33
|
var SearchInput_1 = __importDefault(require("../SearchInput/SearchInput"));
|
|
35
34
|
var SelectionPopup = function (_a) {
|
|
36
|
-
var title = _a.title, className = _a.className, onSearch = _a.onSearch, hideTitle = _a.hideTitle, hideSearchInput = _a.hideSearchInput, _b = _a.headerPlacement, headerPlacement = _b === void 0 ? 'top' : _b, containerWidth = _a.containerWidth, containerHeight = _a.containerHeight, searchInputOnKeyDown = _a.searchInputOnKeyDown, children = _a.children, searchInputRef = _a.searchInputRef,
|
|
35
|
+
var title = _a.title, className = _a.className, onSearch = _a.onSearch, hideTitle = _a.hideTitle, hideSearchInput = _a.hideSearchInput, _b = _a.headerPlacement, headerPlacement = _b === void 0 ? 'top' : _b, containerWidth = _a.containerWidth, containerHeight = _a.containerHeight, searchInputOnKeyDown = _a.searchInputOnKeyDown, children = _a.children, searchInputRef = _a.searchInputRef, _c = _a.anchorOrigin, anchorOrigin = _c === void 0 ? {
|
|
36
|
+
vertical: 'top',
|
|
37
|
+
horizontal: 'right'
|
|
38
|
+
} : _c, _d = _a.transformOrigin, transformOrigin = _d === void 0 ? {
|
|
39
|
+
vertical: 'top',
|
|
40
|
+
horizontal: 'right'
|
|
41
|
+
} : _d, otherProps = __rest(_a, ["title", "className", "onSearch", "hideTitle", "hideSearchInput", "headerPlacement", "containerWidth", "containerHeight", "searchInputOnKeyDown", "children", "searchInputRef", "anchorOrigin", "transformOrigin"]);
|
|
37
42
|
var classes = styles_js_1.default({ containerWidth: containerWidth, containerHeight: containerHeight });
|
|
38
43
|
var header = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
39
44
|
!hideTitle && react_1.default.createElement("div", { className: classes.header }, title),
|
|
40
45
|
!hideSearchInput && (react_1.default.createElement(SearchInput_1.default, { onSearch: onSearch, autofocus: true, onKeyDown: searchInputOnKeyDown, inputRef: searchInputRef, classes: { root: classes.searchInputContainer }, placeholder: ui_i18n_1.default.text('Search & add attributes'), height: 40 }))));
|
|
41
|
-
return (react_1.default.createElement(Popover_1.default, __assign({}, otherProps),
|
|
46
|
+
return (react_1.default.createElement(Popover_1.default, __assign({ anchorOrigin: anchorOrigin, transformOrigin: transformOrigin }, otherProps),
|
|
42
47
|
react_1.default.createElement("div", { className: classnames_1.default(classes.container, className), style: { width: containerWidth } },
|
|
43
48
|
headerPlacement === 'top' && header,
|
|
44
49
|
react_1.default.createElement("div", { className: classes.list }, children),
|
|
45
50
|
headerPlacement === 'bottom' && header)));
|
|
46
51
|
};
|
|
47
|
-
SelectionPopup.propTypes = {
|
|
48
|
-
className: prop_types_1.default.string,
|
|
49
|
-
title: prop_types_1.default.string,
|
|
50
|
-
headerPlacement: prop_types_1.default.oneOf(['top', 'bottom']),
|
|
51
|
-
onSearch: prop_types_1.default.func,
|
|
52
|
-
searchInputOnKeyDown: prop_types_1.default.func,
|
|
53
|
-
containerWidth: prop_types_1.default.number,
|
|
54
|
-
containerHeight: prop_types_1.default.number,
|
|
55
|
-
hideTitle: prop_types_1.default.bool,
|
|
56
|
-
hideSearchInput: prop_types_1.default.bool,
|
|
57
|
-
searchInputRef: prop_types_1.default.shape({ current: prop_types_1.default.instanceOf(Element) }),
|
|
58
|
-
children: prop_types_1.default.node
|
|
59
|
-
};
|
|
60
|
-
SelectionPopup.defaultProps = {
|
|
61
|
-
anchorOrigin: {
|
|
62
|
-
vertical: 'top',
|
|
63
|
-
horizontal: 'right'
|
|
64
|
-
},
|
|
65
|
-
transformOrigin: {
|
|
66
|
-
vertical: 'top',
|
|
67
|
-
horizontal: 'right'
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
52
|
exports.default = SelectionPopup;
|
|
@@ -1,36 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PaperProps } from '@material-ui/core/Paper';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
anchorEl: HTMLElement;
|
|
6
|
+
className?: string;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
containerWidth: number;
|
|
9
|
+
containerHeight: number;
|
|
10
|
+
paperProps: Omit<PaperProps, 'evelation'>;
|
|
11
|
+
listContent?: React.ReactNode;
|
|
12
|
+
externalInputField?: React.ReactNode;
|
|
13
|
+
classes?: {
|
|
14
|
+
root?: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
declare const SelectionPopupPopper: ({ open, anchorEl, className, onClose, containerWidth, containerHeight, paperProps, listContent, externalInputField, classes }: Props) => JSX.Element;
|
|
1
18
|
export default SelectionPopupPopper;
|
|
2
|
-
declare function SelectionPopupPopper({ open, anchorEl, className, onClose, containerWidth, containerHeight, paperProps, listContent, externalInputField, classes }: {
|
|
3
|
-
open: any;
|
|
4
|
-
anchorEl: any;
|
|
5
|
-
className: any;
|
|
6
|
-
onClose: any;
|
|
7
|
-
containerWidth: any;
|
|
8
|
-
containerHeight: any;
|
|
9
|
-
paperProps: any;
|
|
10
|
-
listContent: any;
|
|
11
|
-
externalInputField: any;
|
|
12
|
-
classes?: {};
|
|
13
|
-
}): JSX.Element;
|
|
14
|
-
declare namespace SelectionPopupPopper {
|
|
15
|
-
namespace propTypes {
|
|
16
|
-
const open: PropTypes.Requireable<boolean>;
|
|
17
|
-
const anchorEl: PropTypes.Requireable<object>;
|
|
18
|
-
const className: PropTypes.Requireable<string>;
|
|
19
|
-
const onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
20
|
-
const containerWidth: PropTypes.Requireable<number>;
|
|
21
|
-
const containerHeight: PropTypes.Requireable<number>;
|
|
22
|
-
const paperProps: PropTypes.Requireable<object>;
|
|
23
|
-
const listContent: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
24
|
-
const externalInputField: PropTypes.Requireable<PropTypes.ReactElementLike>;
|
|
25
|
-
const classes: PropTypes.Requireable<PropTypes.InferProps<{
|
|
26
|
-
root: PropTypes.Requireable<string>;
|
|
27
|
-
}>>;
|
|
28
|
-
}
|
|
29
|
-
namespace defaultProps {
|
|
30
|
-
namespace popoverAnchorOrigin {
|
|
31
|
-
const vertical: string;
|
|
32
|
-
const horizontal: string;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
import PropTypes from "prop-types";
|
|
@@ -15,7 +15,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
var react_1 = __importDefault(require("react"));
|
|
18
|
-
var prop_types_1 = __importDefault(require("prop-types"));
|
|
19
18
|
var classnames_1 = __importDefault(require("classnames"));
|
|
20
19
|
var styles_js_1 = __importDefault(require("../styles.js"));
|
|
21
20
|
var Popper_1 = __importDefault(require("../../Popper/Popper"));
|
|
@@ -37,24 +36,4 @@ var SelectionPopupPopper = function (_a) {
|
|
|
37
36
|
react_1.default.createElement("div", { className: commonStyles.list }, listContent)))));
|
|
38
37
|
})));
|
|
39
38
|
};
|
|
40
|
-
SelectionPopupPopper.propTypes = {
|
|
41
|
-
open: prop_types_1.default.bool,
|
|
42
|
-
anchorEl: prop_types_1.default.object,
|
|
43
|
-
className: prop_types_1.default.string,
|
|
44
|
-
onClose: prop_types_1.default.func,
|
|
45
|
-
containerWidth: prop_types_1.default.number,
|
|
46
|
-
containerHeight: prop_types_1.default.number,
|
|
47
|
-
paperProps: prop_types_1.default.object,
|
|
48
|
-
listContent: prop_types_1.default.element,
|
|
49
|
-
externalInputField: prop_types_1.default.element,
|
|
50
|
-
classes: prop_types_1.default.shape({
|
|
51
|
-
root: prop_types_1.default.string
|
|
52
|
-
})
|
|
53
|
-
};
|
|
54
|
-
SelectionPopupPopper.defaultProps = {
|
|
55
|
-
popoverAnchorOrigin: {
|
|
56
|
-
vertical: 'top',
|
|
57
|
-
horizontal: 'right'
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
39
|
exports.default = SelectionPopupPopper;
|
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
handleKeyDown: (event: any) => boolean;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type Item = {
|
|
3
|
+
titleItemIndex?: number;
|
|
4
|
+
index: number;
|
|
5
|
+
item: {
|
|
6
|
+
item: Record<string, unknown>;
|
|
7
|
+
moveTo?: number;
|
|
8
|
+
};
|
|
10
9
|
};
|
|
10
|
+
declare type Props = {
|
|
11
|
+
items: Item[];
|
|
12
|
+
open: boolean;
|
|
13
|
+
onSelectFocusedItem: (item: {
|
|
14
|
+
item: Item['item']['item'];
|
|
15
|
+
groupData: Item['item'];
|
|
16
|
+
}) => void;
|
|
17
|
+
selectedItems: string[];
|
|
18
|
+
onClose: (event: React.KeyboardEvent) => void;
|
|
19
|
+
};
|
|
20
|
+
declare const useKeyboardNavigation: ({ items, open, onSelectFocusedItem, selectedItems, onClose }: Props) => {
|
|
21
|
+
focusIndex: number;
|
|
22
|
+
handleKeyDown: (event: React.KeyboardEvent) => boolean;
|
|
23
|
+
};
|
|
24
|
+
export { useKeyboardNavigation };
|
|
@@ -50,7 +50,8 @@ export { default as EmptyState, EMPTY_STATE_ICONS, EMPTY_STATE_VARIANTS } from '
|
|
|
50
50
|
export { default as EntityAvatar } from './EntityAvatar/EntityAvatar';
|
|
51
51
|
export { default as EntityTypeBadge } from './EntityTypeBadge/EntityTypeBadge';
|
|
52
52
|
export { default as EntityTypeIcon } from './EntityTypeIcon/EntityTypeIcon';
|
|
53
|
-
export {
|
|
53
|
+
export { EntityTypesSelector } from './EntityTypesSelector/EntityTypesSelector';
|
|
54
|
+
export { RelationTypesSelector } from './RelationTypesSelector/RelationTypesSelector';
|
|
54
55
|
export { default as EntityUriLink } from './EntityUriLink/EntityUriLink';
|
|
55
56
|
export { default as ErrorBoundary } from './ErrorBoundary/ErrorBoundary';
|
|
56
57
|
export { default as ErrorPopup } from './ErrorPopup/ErrorPopup';
|
package/cjs/components/index.js
CHANGED
|
@@ -14,8 +14,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.EntityTypeBadge = exports.EntityAvatar = exports.EMPTY_STATE_VARIANTS = exports.EMPTY_STATE_ICONS = exports.EmptyState = exports.NoResults = exports.NoData = exports.DropDownSelector = exports.DropDownMenuButton = exports.Drawer = exports.DataTypeValue = exports.ConnectionRelationTypeSelector = exports.ConfigureColumnsPopup = exports.MenuWithPopper = exports.DropdownIndicatorWithIconButton = exports.DropdownIndicator = exports.CommentsContainer = exports.ColorBar = exports.CollapseButton = exports.CollaborationItem = exports.ClickAwayProvider = exports.BasicViewHeader = exports.BasicViewContent = exports.BasicView = exports.ProfileBandNavigation = exports.AvatarWithFallback = exports.AutoSizeList = exports.ReadOnlyAttributesPager = exports.SimpleAttribute = exports.ReferenceAttribute = exports.NestedAttribute = exports.EditableImageAttributesLine = exports.ImageAttributesLine = exports.ReadOnlyAttributesList = exports.ReadOnlyAttributeValuesBlock = exports.EditableAttribute = exports.ReadOnlyAttribute = exports.CardinalityMessage = exports.AttributesPager = exports.SimpleAttributeEditor = exports.RelationTypeSelector = exports.ReferenceAttributeEditor = exports.NestedAttributeEditor = exports.MoreAttributesButton = exports.EntitySelector = exports.EntityCreator = exports.AttributesList = exports.BranchDecorator = exports.AttributesView = exports.AttributeListItem = void 0;
|
|
17
|
-
exports.
|
|
18
|
-
exports.ProfilesList = exports.ActionButtonMode = exports.ActionButton = exports.NotMatchButton = exports.MergeButton = exports.ProfileMatchCard = exports.RelationEditor = exports.OvIcon = exports.ErrorMessage = exports.ReltioMap = exports.ConfirmDeleteDialog = exports.ConfirmationDialog = exports.Marginator = exports.LightArrowTooltip = exports.ArrowExpandButton = exports.ScrollableTabs = exports.ExpandableSearchInput = exports.VirtualGroupedList = exports.ViewMoreToggle = exports.VerticalHeadingsTable = exports.VerticalDivider = exports.AttributeTitle = exports.Spacer = exports.SourceIcon = exports.SmallIconButtonWithTooltip = exports.SmallIconButton = void 0;
|
|
17
|
+
exports.SidePanelContentHeader = exports.SidePanel = exports.SidePanelEmptyState = exports.SideButtonsPanel = exports.SelectorWithOnlyOptionAutoSelect = exports.SelectionPopupPopper = exports.SelectionPopup = exports.useKeyboardNavigation = exports.WhiteSearchInput = exports.SearchInput = exports.ResizablePanes = exports.ReltioGridLayout = exports.ReactSortableTreeUtils = exports.ReactSortableTreeHandlers = exports.ReactSortableTree = exports.ReactSelectOptionFilters = exports.MultiSelect = exports.QueryBuilderRowsGroup = exports.QueryBuilderRow = exports.ProfileCard = exports.ProfileBand = exports.PotentialMatchReviewCard = exports.PopupWithArrow = exports.Popper = exports.MultipleInput = exports.ModeSwitcherSelect = exports.ModeSwitcher = exports.TransitiveMatchBlock = exports.SimpleMatchRulesBuilder = exports.SimpleMatchRulesBlock = exports.MatchRulesBlock = exports.LoadingSpinner = exports.Link = exports.LinearLoadIndicator = exports.ImportModes = exports.ImportButton = exports.ImageGalleryDialog = exports.Highlighter = exports.HierarchicalAttributeTooltip = exports.HideOnShrink = exports.FlipCard = exports.FacetViewHeader = exports.ExpandedValueTooltip = exports.ErrorWrapper = exports.ErrorPopup = exports.ErrorBoundary = exports.EntityUriLink = exports.RelationTypesSelector = exports.EntityTypesSelector = exports.EntityTypeIcon = void 0;
|
|
18
|
+
exports.ProfilesList = exports.ActionButtonMode = exports.ActionButton = exports.NotMatchButton = exports.MergeButton = exports.ProfileMatchCard = exports.RelationEditor = exports.OvIcon = exports.ErrorMessage = exports.ReltioMap = exports.ConfirmDeleteDialog = exports.ConfirmationDialog = exports.Marginator = exports.LightArrowTooltip = exports.ArrowExpandButton = exports.ScrollableTabs = exports.ExpandableSearchInput = exports.VirtualGroupedList = exports.ViewMoreToggle = exports.VerticalHeadingsTable = exports.VerticalDivider = exports.AttributeTitle = exports.Spacer = exports.SourceIcon = exports.SmallIconButtonWithTooltip = exports.SmallIconButton = exports.SimpleDropDownSelector = void 0;
|
|
19
19
|
__exportStar(require("./activityLog"), exports);
|
|
20
20
|
var AttributeListItem_1 = require("./AttributeListItem/AttributeListItem");
|
|
21
21
|
Object.defineProperty(exports, "AttributeListItem", { enumerable: true, get: function () { return __importDefault(AttributeListItem_1).default; } });
|
|
@@ -119,7 +119,9 @@ Object.defineProperty(exports, "EntityTypeBadge", { enumerable: true, get: funct
|
|
|
119
119
|
var EntityTypeIcon_1 = require("./EntityTypeIcon/EntityTypeIcon");
|
|
120
120
|
Object.defineProperty(exports, "EntityTypeIcon", { enumerable: true, get: function () { return __importDefault(EntityTypeIcon_1).default; } });
|
|
121
121
|
var EntityTypesSelector_1 = require("./EntityTypesSelector/EntityTypesSelector");
|
|
122
|
-
Object.defineProperty(exports, "EntityTypesSelector", { enumerable: true, get: function () { return
|
|
122
|
+
Object.defineProperty(exports, "EntityTypesSelector", { enumerable: true, get: function () { return EntityTypesSelector_1.EntityTypesSelector; } });
|
|
123
|
+
var RelationTypesSelector_1 = require("./RelationTypesSelector/RelationTypesSelector");
|
|
124
|
+
Object.defineProperty(exports, "RelationTypesSelector", { enumerable: true, get: function () { return RelationTypesSelector_1.RelationTypesSelector; } });
|
|
123
125
|
var EntityUriLink_1 = require("./EntityUriLink/EntityUriLink");
|
|
124
126
|
Object.defineProperty(exports, "EntityUriLink", { enumerable: true, get: function () { return __importDefault(EntityUriLink_1).default; } });
|
|
125
127
|
var ErrorBoundary_1 = require("./ErrorBoundary/ErrorBoundary");
|
|
@@ -1,55 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
label: PropTypes.Requireable<string>;
|
|
19
|
-
uri: PropTypes.Requireable<string>;
|
|
20
|
-
attributes: PropTypes.Requireable<PropTypes.InferProps<{
|
|
21
|
-
label: PropTypes.Requireable<string>;
|
|
22
|
-
name: PropTypes.Requireable<string>;
|
|
23
|
-
description: PropTypes.Requireable<string>;
|
|
24
|
-
type: PropTypes.Requireable<string>;
|
|
25
|
-
hidden: PropTypes.Requireable<boolean>;
|
|
26
|
-
faceted: PropTypes.Requireable<boolean>;
|
|
27
|
-
searchable: PropTypes.Requireable<boolean>;
|
|
28
|
-
uri: PropTypes.Requireable<string>;
|
|
29
|
-
access: PropTypes.Requireable<string[]>;
|
|
30
|
-
cardinality: PropTypes.Requireable<PropTypes.InferProps<{
|
|
31
|
-
minValue: PropTypes.Requireable<number>;
|
|
32
|
-
maxValue: PropTypes.Requireable<number>;
|
|
33
|
-
}>>;
|
|
34
|
-
}>[]>;
|
|
35
|
-
}>[]>;
|
|
36
|
-
selectedEntityTypes: PropTypes.Validator<string[]>;
|
|
37
|
-
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
38
|
-
single: PropTypes.Requireable<boolean>;
|
|
39
|
-
enableEmptyValueUnderline: PropTypes.Requireable<boolean>;
|
|
40
|
-
placeholder: PropTypes.Requireable<string>;
|
|
41
|
-
classes: PropTypes.Requireable<PropTypes.InferProps<{
|
|
42
|
-
root: PropTypes.Requireable<string>;
|
|
43
|
-
label: PropTypes.Requireable<string>;
|
|
44
|
-
inputText: PropTypes.Requireable<string>;
|
|
45
|
-
input: PropTypes.Requireable<string>;
|
|
46
|
-
}>>;
|
|
47
|
-
ListLabelProps: PropTypes.Requireable<PropTypes.InferProps<{
|
|
48
|
-
maxWidth: PropTypes.Requireable<number>;
|
|
49
|
-
}>>;
|
|
50
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
51
|
-
};
|
|
52
|
-
}>;
|
|
53
|
-
export default _default;
|
|
54
|
-
import PropTypes from "prop-types";
|
|
55
|
-
import React from "react";
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TEntityType } from '@reltio/mdm-sdk';
|
|
3
|
+
import { MetadataTypesSelector } from '../MetadataTypesSelector/MetadataTypesSelector';
|
|
4
|
+
declare type MetadataTypesSelectorProps = React.ComponentProps<typeof MetadataTypesSelector>;
|
|
5
|
+
declare type Props = {
|
|
6
|
+
entityTypes: TEntityType[];
|
|
7
|
+
selectedEntityTypes: string[];
|
|
8
|
+
onChange: (values: string[]) => void;
|
|
9
|
+
single?: boolean;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
enableEmptyValueUnderline?: boolean;
|
|
12
|
+
classes?: MetadataTypesSelectorProps['classes'];
|
|
13
|
+
ListLabelProps?: MetadataTypesSelectorProps['ListLabelProps'];
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare const EntityTypesSelector: React.MemoExoticComponent<({ entityTypes, selectedEntityTypes, single, placeholder, enableEmptyValueUnderline, onChange, classes, ListLabelProps, disabled }: Props) => JSX.Element>;
|
|
17
|
+
export {};
|
|
@@ -1,121 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import React, { memo, useCallback, useMemo, useRef, useState } from 'react';
|
|
13
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import React, { useMemo, memo } from 'react';
|
|
14
2
|
import i18n from 'ui-i18n';
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import { useKeyboardNavigation } from '../SelectionPopup/helpers';
|
|
24
|
-
import SelectEntityTypesList from './SelectEntityTypesList';
|
|
25
|
-
import ListLabel from './ListLabel/ListLabel';
|
|
26
|
-
var MIN_CONTAINER_WIDTH = 255;
|
|
27
|
-
var LIST_HEIGHT = 245;
|
|
28
|
-
var POPUP_HEIGHT = 355;
|
|
29
|
-
var EntityTypesSelector = function (_a) {
|
|
30
|
-
var _b, _c, _d, _e;
|
|
31
|
-
var entityTypes = _a.entityTypes, selectedEntityTypes = _a.selectedEntityTypes, single = _a.single, placeholder = _a.placeholder, enableEmptyValueUnderline = _a.enableEmptyValueUnderline, onChange = _a.onChange, _f = _a.classes, classes = _f === void 0 ? {} : _f, _g = _a.ListLabelProps, ListLabelProps = _g === void 0 ? {} : _g, _h = _a.disabled, disabled = _h === void 0 ? false : _h;
|
|
32
|
-
var styles = useStyles();
|
|
33
|
-
var _j = useState(false), isPopupOpen = _j[0], setIsPopupOpen = _j[1];
|
|
34
|
-
var openPopup = useCallback(function () { return setIsPopupOpen(true); }, []);
|
|
35
|
-
var closePopup = useCallback(function () { return setIsPopupOpen(false); }, []);
|
|
36
|
-
var _k = useState(''), filterText = _k[0], setFilterText = _k[1];
|
|
37
|
-
var clearFilterText = useCallback(function () { return setFilterText(''); }, []);
|
|
38
|
-
var handleClose = useCallback(pipe(clearFilterText, closePopup), [closePopup, clearFilterText]);
|
|
39
|
-
var items = useMemo(function () {
|
|
40
|
-
return entityTypes
|
|
41
|
-
.filter(isAvailableEntityType)
|
|
42
|
-
.filter(function (_a) {
|
|
43
|
-
var label = _a.label;
|
|
44
|
-
return utils.strings.search(label, filterText);
|
|
45
|
-
})
|
|
46
|
-
.map(function (item, index) { return ({ item: { item: __assign(__assign({}, item), { filterText: filterText }) }, index: index }); });
|
|
47
|
-
}, [entityTypes, filterText]);
|
|
48
|
-
var selectedLabels = useMemo(function () { return selectedEntityTypes.map(function (uri) { return entityTypes.find(propEq('uri', uri)); }).map(prop('label')); }, [selectedEntityTypes, entityTypes]);
|
|
49
|
-
var handleListItemClick = useCallback(function (entityType, checked) {
|
|
50
|
-
if (single) {
|
|
51
|
-
onChange(checked ? [entityType.uri] : []);
|
|
52
|
-
handleClose();
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
onChange(checked
|
|
56
|
-
? selectedEntityTypes.concat(entityType.uri)
|
|
57
|
-
: selectedEntityTypes.filter(function (uri) { return uri !== entityType.uri; }));
|
|
58
|
-
}
|
|
59
|
-
}, [selectedEntityTypes, onChange, single, handleClose]);
|
|
60
|
-
var handleSearchOnEnter = useCallback(function (_a) {
|
|
61
|
-
var item = _a.item;
|
|
62
|
-
var checked = !selectedEntityTypes.includes(item.uri);
|
|
63
|
-
handleListItemClick(item, checked);
|
|
64
|
-
}, [selectedEntityTypes, handleListItemClick]);
|
|
65
|
-
var _l = useKeyboardNavigation({
|
|
66
|
-
items: items,
|
|
67
|
-
open: isPopupOpen,
|
|
68
|
-
onSelectFocusedItem: handleSearchOnEnter,
|
|
69
|
-
selectedItems: selectedEntityTypes,
|
|
70
|
-
onClose: handleClose
|
|
71
|
-
}), focusIndex = _l.focusIndex, handleKeyDown = _l.handleKeyDown;
|
|
72
|
-
var rootRef = useRef();
|
|
73
|
-
var rootWidth = rootRef.current ? rootRef.current.getBoundingClientRect().width : 0;
|
|
74
|
-
var containerWidth = Math.max(rootWidth, MIN_CONTAINER_WIDTH);
|
|
75
|
-
var noTypesSelected = selectedEntityTypes.length === 0;
|
|
76
|
-
return (React.createElement(React.Fragment, null,
|
|
77
|
-
React.createElement(TextField, { label: i18n.text('Entity type'), ref: rootRef, InputProps: {
|
|
78
|
-
startAdornment: noTypesSelected && !placeholder ? null : (React.createElement("div", { className: classnames(styles.inputText, classes.inputText) }, noTypesSelected ? (React.createElement("div", null, placeholder)) : (React.createElement(ListLabel, __assign({}, ListLabelProps, { list: selectedLabels }))))),
|
|
79
|
-
classes: {
|
|
80
|
-
root: styles.inputRoot,
|
|
81
|
-
input: classnames(styles.input, classes.input, (_b = {},
|
|
82
|
-
_b[styles.emptyInput] = noTypesSelected && !placeholder,
|
|
83
|
-
_b)),
|
|
84
|
-
disabled: classnames(styles.disabledInput, (_c = {}, _c[styles.disabledPointer] = disabled, _c)),
|
|
85
|
-
underline: styles.disabledUnderline
|
|
86
|
-
},
|
|
87
|
-
endAdornment: (React.createElement(SmallIconButton, { size: 'L', icon: ArrowDropDown, iconClassName: classnames(styles.icon, (_d = {},
|
|
88
|
-
_d[styles['popup-opened-icon']] = isPopupOpen,
|
|
89
|
-
_d)), disabled: disabled })),
|
|
90
|
-
readOnly: true,
|
|
91
|
-
disabled: true,
|
|
92
|
-
disableUnderline: noTypesSelected && !enableEmptyValueUnderline
|
|
93
|
-
}, inputProps: {
|
|
94
|
-
tabIndex: -1
|
|
95
|
-
}, InputLabelProps: {
|
|
96
|
-
classes: {
|
|
97
|
-
root: classnames(styles.inputLabel, classes.label)
|
|
98
|
-
}
|
|
99
|
-
}, value: "", onClick: disabled ? undefined : openPopup, classes: { root: classnames(styles.root, classes.root) }, margin: "dense", variant: "filled", disabled: disabled, "data-reltio-id": "entity-type-selector" }),
|
|
100
|
-
React.createElement(SelectionPopup, { open: isPopupOpen, anchorEl: rootRef.current, onClose: handleClose, onSearch: setFilterText, title: i18n.text('Select entity types'), containerWidth: containerWidth, containerHeight: POPUP_HEIGHT, searchInputOnKeyDown: handleKeyDown, transformOrigin: { horizontal: 'left', vertical: 'top' }, anchorOrigin: { horizontal: 'left', vertical: 'bottom' }, PaperProps: (_e = {}, _e['data-reltio-id'] = 'entity-type-selector-popup', _e) },
|
|
101
|
-
React.createElement(SelectEntityTypesList, { items: items, onItemClick: handleListItemClick, selectedEntityTypes: selectedEntityTypes, width: containerWidth, height: LIST_HEIGHT, focusIndex: focusIndex }))));
|
|
102
|
-
};
|
|
103
|
-
EntityTypesSelector.propTypes = {
|
|
104
|
-
entityTypes: PropTypes.arrayOf(EntityTypeType),
|
|
105
|
-
selectedEntityTypes: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
106
|
-
onChange: PropTypes.func.isRequired,
|
|
107
|
-
single: PropTypes.bool,
|
|
108
|
-
enableEmptyValueUnderline: PropTypes.bool,
|
|
109
|
-
placeholder: PropTypes.string,
|
|
110
|
-
classes: PropTypes.shape({
|
|
111
|
-
root: PropTypes.string,
|
|
112
|
-
label: PropTypes.string,
|
|
113
|
-
inputText: PropTypes.string,
|
|
114
|
-
input: PropTypes.string
|
|
115
|
-
}),
|
|
116
|
-
ListLabelProps: PropTypes.shape({
|
|
117
|
-
maxWidth: PropTypes.number
|
|
118
|
-
}),
|
|
119
|
-
disabled: PropTypes.bool
|
|
120
|
-
};
|
|
121
|
-
export default memo(EntityTypesSelector);
|
|
3
|
+
import { isAvailableEntityType } from '@reltio/mdm-sdk';
|
|
4
|
+
import { MetadataTypesSelector } from '../MetadataTypesSelector/MetadataTypesSelector';
|
|
5
|
+
export var EntityTypesSelector = memo(function (_a) {
|
|
6
|
+
var entityTypes = _a.entityTypes, selectedEntityTypes = _a.selectedEntityTypes, single = _a.single, placeholder = _a.placeholder, enableEmptyValueUnderline = _a.enableEmptyValueUnderline, onChange = _a.onChange, _b = _a.classes, classes = _b === void 0 ? {} : _b, _c = _a.ListLabelProps, ListLabelProps = _c === void 0 ? {} : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d;
|
|
7
|
+
var items = useMemo(function () { return entityTypes.filter(isAvailableEntityType); }, [entityTypes]);
|
|
8
|
+
return (React.createElement(MetadataTypesSelector, { items: items, selectedItemsUris: selectedEntityTypes, single: single, placeholder: placeholder, enableEmptyValueUnderline: enableEmptyValueUnderline, onChange: onChange, classes: classes, ListLabelProps: ListLabelProps, disabled: disabled, label: i18n.text('Entity type'), dataReltioId: "entity-type-selector", selectionPopupTitle: i18n.text('Select entity types') }));
|
|
9
|
+
});
|
|
10
|
+
EntityTypesSelector.displayName = 'EntityTypesSelector';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import Tooltip from '@material-ui/core/Tooltip';
|
|
4
3
|
import { useStyles } from './styles';
|
|
5
4
|
import { countHiddenItems, getListLabel, getListLabelWidth } from './helpers';
|
|
6
|
-
var ListLabel = function (_a) {
|
|
5
|
+
export var ListLabel = function (_a) {
|
|
7
6
|
var list = _a.list, maxWidth = _a.maxWidth;
|
|
8
7
|
var styles = useStyles();
|
|
9
8
|
var labelRef = useRef();
|
|
@@ -20,8 +19,3 @@ var ListLabel = function (_a) {
|
|
|
20
19
|
React.createElement("div", { className: styles.visibleItemsLabel }, visibleItemsLabel),
|
|
21
20
|
hasHiddenItems && React.createElement("div", { className: styles.hiddenCount }, "+" + hiddenItemsCount))));
|
|
22
21
|
};
|
|
23
|
-
ListLabel.propTypes = {
|
|
24
|
-
list: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
25
|
-
maxWidth: PropTypes.number
|
|
26
|
-
};
|
|
27
|
-
export default ListLabel;
|
|
@@ -20,7 +20,7 @@ var countOverflowItems = function (list, labelEl) {
|
|
|
20
20
|
var findFirstOverflowItemIndex = function (list, labelEl) {
|
|
21
21
|
var childNodes = labelEl.childNodes, clientLeft = labelEl.clientLeft, clientWidth = labelEl.clientWidth;
|
|
22
22
|
if (childNodes.length > 0) {
|
|
23
|
-
var textNode = childNodes[0];
|
|
23
|
+
var textNode = Array.from(childNodes)[0];
|
|
24
24
|
var range = document.createRange();
|
|
25
25
|
range.setStart(textNode, 0);
|
|
26
26
|
for (var index = 0; index < list.length; index++) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"listLabelContainer" | "listLabel" | "visibleItemsLabel" | "hiddenCount">;
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TEntityType, TRelationType } from '@reltio/mdm-sdk';
|
|
3
|
+
import { ListLabel } from './ListLabel/ListLabel';
|
|
4
|
+
declare type ListLabelProps = React.ComponentPropsWithoutRef<typeof ListLabel>;
|
|
5
|
+
declare type Classes = {
|
|
6
|
+
inputText?: string;
|
|
7
|
+
input?: string;
|
|
8
|
+
root?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
};
|
|
11
|
+
declare type Props = {
|
|
12
|
+
items: (TEntityType | TRelationType)[];
|
|
13
|
+
selectedItemsUris: string[];
|
|
14
|
+
onChange: (values: string[]) => void;
|
|
15
|
+
label: string;
|
|
16
|
+
dataReltioId: string;
|
|
17
|
+
selectionPopupTitle: string;
|
|
18
|
+
classes?: Classes;
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
ListLabelProps?: Omit<ListLabelProps, 'list'>;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
enableEmptyValueUnderline?: boolean;
|
|
23
|
+
single?: boolean;
|
|
24
|
+
};
|
|
25
|
+
export declare const MetadataTypesSelector: React.MemoExoticComponent<({ placeholder, classes, items, selectedItemsUris, onChange, ListLabelProps, disabled, enableEmptyValueUnderline, single, label, dataReltioId, selectionPopupTitle }: Props) => JSX.Element>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import React, { useRef, useState, useCallback, useMemo, memo } from 'react';
|
|
13
|
+
import classnames from 'classnames';
|
|
14
|
+
import { pipe, propEq, prop } from 'ramda';
|
|
15
|
+
import { utils } from '@reltio/mdm-sdk';
|
|
16
|
+
import TextField from '@material-ui/core/TextField';
|
|
17
|
+
import ArrowDropDown from '@material-ui/icons/ArrowDropDown';
|
|
18
|
+
import { ListLabel } from './ListLabel/ListLabel';
|
|
19
|
+
import { SmallIconButton } from '../SmallIconButton';
|
|
20
|
+
import SelectionPopup from '../SelectionPopup/SelectionPopup';
|
|
21
|
+
import { useKeyboardNavigation } from '../SelectionPopup/helpers';
|
|
22
|
+
import { SelectMetadataTypesList } from './SelectMetadataTypesList';
|
|
23
|
+
import { useStyles } from './styles';
|
|
24
|
+
var MIN_CONTAINER_WIDTH = 255;
|
|
25
|
+
var LIST_HEIGHT = 245;
|
|
26
|
+
var POPUP_HEIGHT = 355;
|
|
27
|
+
export var MetadataTypesSelector = memo(function (_a) {
|
|
28
|
+
var _b, _c, _d, _e;
|
|
29
|
+
var placeholder = _a.placeholder, _f = _a.classes, classes = _f === void 0 ? {} : _f, items = _a.items, selectedItemsUris = _a.selectedItemsUris, onChange = _a.onChange, _g = _a.ListLabelProps, ListLabelProps = _g === void 0 ? {} : _g, disabled = _a.disabled, enableEmptyValueUnderline = _a.enableEmptyValueUnderline, single = _a.single, label = _a.label, dataReltioId = _a.dataReltioId, selectionPopupTitle = _a.selectionPopupTitle;
|
|
30
|
+
var styles = useStyles();
|
|
31
|
+
var _h = useState(false), isPopupOpen = _h[0], setIsPopupOpen = _h[1];
|
|
32
|
+
var openPopup = useCallback(function () { return setIsPopupOpen(true); }, []);
|
|
33
|
+
var closePopup = useCallback(function () { return setIsPopupOpen(false); }, []);
|
|
34
|
+
var _j = useState(''), filterText = _j[0], setFilterText = _j[1];
|
|
35
|
+
var clearFilterText = useCallback(function () { return setFilterText(''); }, []);
|
|
36
|
+
var handleClose = useCallback(pipe(clearFilterText, closePopup), [closePopup, clearFilterText]);
|
|
37
|
+
var filteredItems = items
|
|
38
|
+
.filter(function (_a) {
|
|
39
|
+
var label = _a.label;
|
|
40
|
+
return utils.strings.search(label, filterText);
|
|
41
|
+
})
|
|
42
|
+
.map(function (item, index) { return ({ item: { item: __assign(__assign({}, item), { filterText: filterText }) }, index: index }); });
|
|
43
|
+
var selectedLabels = useMemo(function () { return selectedItemsUris.map(function (uri) { return items.find(propEq('uri', uri)); }).map(prop('label')); }, [selectedItemsUris, items]);
|
|
44
|
+
var handleListItemClick = useCallback(function (item, checked) {
|
|
45
|
+
if (single) {
|
|
46
|
+
onChange(checked ? [item.uri] : []);
|
|
47
|
+
handleClose();
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
onChange(checked
|
|
51
|
+
? selectedItemsUris.concat(item.uri)
|
|
52
|
+
: selectedItemsUris.filter(function (uri) { return uri !== item.uri; }));
|
|
53
|
+
}
|
|
54
|
+
}, [selectedItemsUris, onChange, single, handleClose]);
|
|
55
|
+
var handleSearchOnEnter = useCallback(function (_a) {
|
|
56
|
+
var item = _a.item;
|
|
57
|
+
var checked = !selectedItemsUris.includes(item.uri);
|
|
58
|
+
handleListItemClick(item, checked);
|
|
59
|
+
}, [selectedItemsUris, handleListItemClick]);
|
|
60
|
+
var _k = useKeyboardNavigation({
|
|
61
|
+
items: filteredItems,
|
|
62
|
+
open: isPopupOpen,
|
|
63
|
+
onSelectFocusedItem: handleSearchOnEnter,
|
|
64
|
+
selectedItems: selectedItemsUris,
|
|
65
|
+
onClose: handleClose
|
|
66
|
+
}), focusIndex = _k.focusIndex, handleKeyDown = _k.handleKeyDown;
|
|
67
|
+
var rootRef = useRef();
|
|
68
|
+
var rootWidth = rootRef.current ? rootRef.current.getBoundingClientRect().width : 0;
|
|
69
|
+
var containerWidth = Math.max(rootWidth, MIN_CONTAINER_WIDTH);
|
|
70
|
+
var noTypesSelected = selectedItemsUris.length === 0;
|
|
71
|
+
return (React.createElement(React.Fragment, null,
|
|
72
|
+
React.createElement(TextField, { label: label, ref: rootRef, InputProps: {
|
|
73
|
+
startAdornment: noTypesSelected && !placeholder ? null : (React.createElement("div", { className: classnames(styles.inputText, classes.inputText) }, noTypesSelected ? (React.createElement("div", null, placeholder)) : (React.createElement(ListLabel, __assign({}, ListLabelProps, { list: selectedLabels }))))),
|
|
74
|
+
classes: {
|
|
75
|
+
root: styles.inputRoot,
|
|
76
|
+
input: classnames(styles.input, classes.input, (_b = {},
|
|
77
|
+
_b[styles.emptyInput] = noTypesSelected && !placeholder,
|
|
78
|
+
_b)),
|
|
79
|
+
disabled: classnames(styles.disabledInput, (_c = {}, _c[styles.disabledPointer] = disabled, _c)),
|
|
80
|
+
underline: styles.disabledUnderline
|
|
81
|
+
},
|
|
82
|
+
endAdornment: (React.createElement(SmallIconButton, { size: 'L', icon: ArrowDropDown, iconClassName: classnames(styles.icon, (_d = {},
|
|
83
|
+
_d[styles['popup-opened-icon']] = isPopupOpen,
|
|
84
|
+
_d)), disabled: disabled })),
|
|
85
|
+
readOnly: true,
|
|
86
|
+
disabled: true,
|
|
87
|
+
disableUnderline: noTypesSelected && !enableEmptyValueUnderline
|
|
88
|
+
}, inputProps: {
|
|
89
|
+
tabIndex: -1
|
|
90
|
+
}, InputLabelProps: {
|
|
91
|
+
classes: {
|
|
92
|
+
root: classnames(styles.inputLabel, classes.label)
|
|
93
|
+
}
|
|
94
|
+
}, value: "", onClick: disabled ? undefined : openPopup, classes: { root: classnames(styles.root, classes.root) }, margin: "dense", variant: "filled", disabled: disabled, "data-reltio-id": dataReltioId }),
|
|
95
|
+
React.createElement(SelectionPopup, { open: isPopupOpen, anchorEl: rootRef.current, onClose: handleClose, onSearch: setFilterText, title: selectionPopupTitle, containerWidth: containerWidth, containerHeight: POPUP_HEIGHT, searchInputOnKeyDown: handleKeyDown, transformOrigin: { horizontal: 'left', vertical: 'top' }, anchorOrigin: { horizontal: 'left', vertical: 'bottom' }, PaperProps: (_e = {}, _e['data-reltio-id'] = dataReltioId + "-popup", _e) },
|
|
96
|
+
React.createElement(SelectMetadataTypesList, { items: filteredItems, onItemClick: handleListItemClick, selectedItems: selectedItemsUris, width: containerWidth, height: LIST_HEIGHT, focusIndex: focusIndex }))));
|
|
97
|
+
});
|
|
98
|
+
MetadataTypesSelector.displayName = 'MetadataTypesSelector';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TEntityType, TRelationType } from '@reltio/mdm-sdk';
|
|
3
|
+
import AttributeListItem from '../AttributeListItem/AttributeListItem';
|
|
4
|
+
declare type AttributeListItemProps = React.ComponentPropsWithoutRef<typeof AttributeListItem>;
|
|
5
|
+
declare type Item = {
|
|
6
|
+
item: {
|
|
7
|
+
item: TEntityType | TRelationType;
|
|
8
|
+
};
|
|
9
|
+
index: number;
|
|
10
|
+
};
|
|
11
|
+
declare type Props = {
|
|
12
|
+
selectedItems: string[];
|
|
13
|
+
onItemClick: AttributeListItemProps['onClick'];
|
|
14
|
+
focusIndex: number;
|
|
15
|
+
items: Item[];
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
export declare const SelectMetadataTypesList: React.MemoExoticComponent<({ selectedItems, onItemClick, focusIndex, width, height, ...otherProps }: Props) => JSX.Element>;
|
|
20
|
+
export {};
|