@reltio/components 1.4.882 → 1.4.886
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/RelationEditor/RelationEditor.d.ts +31 -0
- package/cjs/components/RelationEditor/RelationEditor.js +175 -0
- package/cjs/components/RelationEditor/index.d.ts +142 -0
- package/cjs/components/RelationEditor/index.js +42 -0
- package/cjs/components/RelationEditor/styles.d.ts +1 -0
- package/cjs/components/RelationEditor/styles.js +36 -0
- package/cjs/components/attributes/editMode/AttributesPager/SpecialRenderer.js +1 -1
- package/cjs/components/attributes/editMode/Tags/Tags.d.ts +7 -0
- package/cjs/components/attributes/editMode/Tags/Tags.js +62 -0
- package/cjs/components/attributes/editMode/Tags/index.d.ts +1 -0
- package/cjs/components/attributes/editMode/Tags/index.js +8 -0
- package/cjs/components/editors/TypeaheadEditor/TypeaheadEditor.d.ts +1 -1
- package/cjs/components/editors/TypeaheadEditor/TypeaheadEditor.js +7 -6
- package/cjs/components/editors/TypeaheadEditor/styles.d.ts +1 -1
- package/cjs/components/editors/TypeaheadEditor/styles.js +15 -0
- package/cjs/components/index.d.ts +1 -0
- package/cjs/components/index.js +3 -1
- package/cjs/components/workflow/cards/GenericWorkflowTaskCard/GenericWorkflowTaskCard.js +6 -6
- package/cjs/components/workflow/components/AssigneeSelector/AssigneeSelector.d.ts +4 -2
- package/cjs/components/workflow/components/AssigneeSelector/AssigneeSelector.js +3 -2
- package/cjs/components/workflow/components/DueDateField/DueDateField.d.ts +2 -1
- package/cjs/components/workflow/components/DueDateField/DueDateField.js +6 -2
- package/cjs/components/workflow/components/PrioritySelector/PrioritySelector.d.ts +2 -1
- package/cjs/components/workflow/components/PrioritySelector/PrioritySelector.js +6 -2
- package/cjs/components/workflow/components/TaskActions/TaskActions.d.ts +4 -2
- package/cjs/components/workflow/components/TaskActions/TaskActions.js +7 -2
- package/cjs/components/workflow/components/WorkflowComments/WorkflowComments.d.ts +2 -1
- package/cjs/components/workflow/components/WorkflowComments/WorkflowComments.js +6 -2
- package/cjs/components/workflow/helpers/index.d.ts +3 -1
- package/cjs/components/workflow/helpers/index.js +3 -1
- package/cjs/components/workflow/hooks/useWorkflowActions.d.ts +1 -1
- package/cjs/components/workflow/hooks/useWorkflowActions.js +4 -3
- package/cjs/components/workflow/hooks/useWorkflowAssignee.d.ts +1 -1
- package/cjs/components/workflow/hooks/useWorkflowAssignee.js +3 -2
- package/cjs/components/workflow/hooks/useWorkflowComments.d.ts +1 -1
- package/cjs/components/workflow/hooks/useWorkflowComments.js +3 -2
- package/cjs/components/workflow/hooks/useWorkflowDueDate.d.ts +1 -1
- package/cjs/components/workflow/hooks/useWorkflowDueDate.js +3 -2
- package/cjs/components/workflow/hooks/useWorkflowPriority.d.ts +1 -1
- package/cjs/components/workflow/hooks/useWorkflowPriority.js +3 -2
- package/cjs/{hooks → components/workflow/hooks}/useWorkflowTasks.d.ts +7 -1
- package/cjs/{hooks → components/workflow/hooks}/useWorkflowTasks.js +28 -17
- package/cjs/components/workflow/index.d.ts +1 -0
- package/cjs/components/workflow/index.js +3 -1
- package/cjs/hooks/index.d.ts +0 -1
- package/cjs/hooks/index.js +1 -3
- package/esm/components/RelationEditor/RelationEditor.d.ts +31 -0
- package/esm/components/RelationEditor/RelationEditor.js +151 -0
- package/esm/components/RelationEditor/index.d.ts +142 -0
- package/esm/components/RelationEditor/index.js +17 -0
- package/esm/components/RelationEditor/styles.d.ts +1 -0
- package/esm/components/RelationEditor/styles.js +33 -0
- package/esm/components/attributes/editMode/AttributesPager/SpecialRenderer.js +1 -1
- package/esm/components/attributes/editMode/Tags/Tags.d.ts +7 -0
- package/esm/components/attributes/editMode/Tags/Tags.js +38 -0
- package/esm/components/attributes/editMode/Tags/index.d.ts +1 -0
- package/esm/components/attributes/editMode/Tags/index.js +1 -0
- package/esm/components/editors/TypeaheadEditor/TypeaheadEditor.d.ts +1 -1
- package/esm/components/editors/TypeaheadEditor/TypeaheadEditor.js +7 -6
- package/esm/components/editors/TypeaheadEditor/styles.d.ts +1 -1
- package/esm/components/editors/TypeaheadEditor/styles.js +15 -0
- package/esm/components/index.d.ts +1 -0
- package/esm/components/index.js +1 -0
- package/esm/components/workflow/cards/GenericWorkflowTaskCard/GenericWorkflowTaskCard.js +6 -6
- package/esm/components/workflow/components/AssigneeSelector/AssigneeSelector.d.ts +4 -2
- package/esm/components/workflow/components/AssigneeSelector/AssigneeSelector.js +3 -2
- package/esm/components/workflow/components/DueDateField/DueDateField.d.ts +2 -1
- package/esm/components/workflow/components/DueDateField/DueDateField.js +6 -2
- package/esm/components/workflow/components/PrioritySelector/PrioritySelector.d.ts +2 -1
- package/esm/components/workflow/components/PrioritySelector/PrioritySelector.js +6 -2
- package/esm/components/workflow/components/TaskActions/TaskActions.d.ts +4 -2
- package/esm/components/workflow/components/TaskActions/TaskActions.js +7 -2
- package/esm/components/workflow/components/WorkflowComments/WorkflowComments.d.ts +2 -1
- package/esm/components/workflow/components/WorkflowComments/WorkflowComments.js +6 -2
- package/esm/components/workflow/helpers/index.d.ts +3 -1
- package/esm/components/workflow/helpers/index.js +2 -1
- package/esm/components/workflow/hooks/useWorkflowActions.d.ts +1 -1
- package/esm/components/workflow/hooks/useWorkflowActions.js +4 -3
- package/esm/components/workflow/hooks/useWorkflowAssignee.d.ts +1 -1
- package/esm/components/workflow/hooks/useWorkflowAssignee.js +3 -2
- package/esm/components/workflow/hooks/useWorkflowComments.d.ts +1 -1
- package/esm/components/workflow/hooks/useWorkflowComments.js +3 -2
- package/esm/components/workflow/hooks/useWorkflowDueDate.d.ts +1 -1
- package/esm/components/workflow/hooks/useWorkflowDueDate.js +3 -2
- package/esm/components/workflow/hooks/useWorkflowPriority.d.ts +1 -1
- package/esm/components/workflow/hooks/useWorkflowPriority.js +3 -2
- package/esm/{hooks → components/workflow/hooks}/useWorkflowTasks.d.ts +7 -1
- package/esm/{hooks → components/workflow/hooks}/useWorkflowTasks.js +28 -17
- package/esm/components/workflow/index.d.ts +1 -0
- package/esm/components/workflow/index.js +1 -0
- package/esm/hooks/index.d.ts +0 -1
- package/esm/hooks/index.js +0 -1
- package/package.json +3 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export default RelationEditor;
|
|
2
|
+
declare function RelationEditor({ connection, modifiedEntity, allModifiedEntities, dispatch, config, mode, metadata, globalSearchRequestOptions, error }: {
|
|
3
|
+
connection: any;
|
|
4
|
+
modifiedEntity: any;
|
|
5
|
+
allModifiedEntities: any;
|
|
6
|
+
dispatch: any;
|
|
7
|
+
config: any;
|
|
8
|
+
mode: any;
|
|
9
|
+
metadata: any;
|
|
10
|
+
globalSearchRequestOptions: any;
|
|
11
|
+
error: any;
|
|
12
|
+
}): JSX.Element;
|
|
13
|
+
declare namespace RelationEditor {
|
|
14
|
+
namespace propTypes {
|
|
15
|
+
export { ConnectionType as connection };
|
|
16
|
+
export { EntityType as modifiedEntity };
|
|
17
|
+
export const allModifiedEntities: PropTypes.Requireable<object>;
|
|
18
|
+
export const dispatch: PropTypes.Requireable<(...args: any[]) => any>;
|
|
19
|
+
export { RelationsConfigType as config };
|
|
20
|
+
export const mode: PropTypes.Requireable<string>;
|
|
21
|
+
export { MetadataType as metadata };
|
|
22
|
+
export const globalSearchRequestOptions: PropTypes.Requireable<object>;
|
|
23
|
+
export { AttributeErrorType as error };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
import { ConnectionType } from "@reltio/mdm-sdk/src/constants";
|
|
27
|
+
import { EntityType } from "@reltio/mdm-sdk/src/constants";
|
|
28
|
+
import PropTypes from "prop-types";
|
|
29
|
+
import { RelationsConfigType } from "@reltio/mdm-sdk/src/constants";
|
|
30
|
+
import { MetadataType } from "@reltio/mdm-sdk/src/constants";
|
|
31
|
+
import { AttributeErrorType } from "@reltio/mdm-sdk/src/constants";
|
|
@@ -0,0 +1,175 @@
|
|
|
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
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
33
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
34
|
+
};
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
var react_1 = __importStar(require("react"));
|
|
37
|
+
var prop_types_1 = __importDefault(require("prop-types"));
|
|
38
|
+
var Button_1 = __importDefault(require("@material-ui/core/Button"));
|
|
39
|
+
var Typography_1 = __importDefault(require("@material-ui/core/Typography"));
|
|
40
|
+
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
41
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
42
|
+
var ramda_1 = require("ramda");
|
|
43
|
+
var styles_1 = require("./styles");
|
|
44
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
45
|
+
var mdm_module_1 = require("@reltio/mdm-module");
|
|
46
|
+
var Divider_1 = __importDefault(require("@material-ui/core/Divider"));
|
|
47
|
+
var ConnectionRelationTypeSelector_1 = __importDefault(require("../ConnectionRelationTypeSelector/ConnectionRelationTypeSelector"));
|
|
48
|
+
var ErrorWrapper_1 = __importDefault(require("../ErrorWrapper/ErrorWrapper"));
|
|
49
|
+
var EntitySelector_1 = __importDefault(require("../attributes/editMode/EntitySelector/EntitySelector"));
|
|
50
|
+
var AttributesList_1 = __importDefault(require("../attributes/editMode/AttributesList"));
|
|
51
|
+
var areRelatedEntitiesChanged = function (initial, actual) {
|
|
52
|
+
return initial.length !== actual.length || initial.some(function (_, i) { return initial[i] !== actual[i]; });
|
|
53
|
+
};
|
|
54
|
+
var RelationEditor = function (_a) {
|
|
55
|
+
var _b;
|
|
56
|
+
var connection = _a.connection, modifiedEntity = _a.modifiedEntity, allModifiedEntities = _a.allModifiedEntities, dispatch = _a.dispatch, config = _a.config, mode = _a.mode, metadata = _a.metadata, globalSearchRequestOptions = _a.globalSearchRequestOptions, error = _a.error;
|
|
57
|
+
var _c = connection.relation, relationUri = _c.relationUri, relationType = _c.relationType, direction = _c.direction;
|
|
58
|
+
var isNew = connection.isNew;
|
|
59
|
+
var styles = styles_1.useStyles();
|
|
60
|
+
var _d = react_1.useMemo(function () { return mdm_sdk_1.getInOutRelations({ config: config, direction: direction, relationType: relationType, mode: mode, metadata: metadata }); }, [config, direction, relationType, mode, metadata]), _e = _d.inRelations, inRelationTypes = _e === void 0 ? [] : _e, _f = _d.outRelations, outRelationTypes = _f === void 0 ? [] : _f;
|
|
61
|
+
var firstLevelRelationAttrTypes = react_1.useMemo(function () { return mdm_sdk_1.getRelationAttributesList(metadata, relationType); }, [
|
|
62
|
+
relationType,
|
|
63
|
+
metadata
|
|
64
|
+
]);
|
|
65
|
+
var attributeListEntity = react_1.useMemo(function () { return (__assign({ attributes: __assign({}, mdm_module_1.profile.relations.selectors.getRelationAttributesFromConnection(connection)) }, mdm_sdk_1.getActivenessAttributes(connection.relation))); }, [connection]);
|
|
66
|
+
var initialConnection = react_1.useRef(connection);
|
|
67
|
+
var initialModifiedEntity = react_1.useRef(modifiedEntity);
|
|
68
|
+
var relatedTempEntities = react_1.useMemo(function () { return mdm_sdk_1.findRelatedTemporaryEntities(allModifiedEntities, modifiedEntity); }, [
|
|
69
|
+
allModifiedEntities,
|
|
70
|
+
modifiedEntity
|
|
71
|
+
]);
|
|
72
|
+
var relatedTempEntitiesUrisHistory = react_1.useRef([]);
|
|
73
|
+
react_1.useEffect(function () {
|
|
74
|
+
relatedTempEntitiesUrisHistory.current = ramda_1.pipe(ramda_1.concat(relatedTempEntities.map(ramda_1.prop('uri'))), ramda_1.uniq)(relatedTempEntitiesUrisHistory.current);
|
|
75
|
+
}, [relatedTempEntities]);
|
|
76
|
+
var initialRelatedTempEntities = react_1.useRef(relatedTempEntities);
|
|
77
|
+
var defaultRelationType = mdm_sdk_1.getDefaultRelationTypeObject(inRelationTypes, outRelationTypes);
|
|
78
|
+
var hasChanges = initialConnection.current !== connection ||
|
|
79
|
+
initialModifiedEntity.current !== modifiedEntity ||
|
|
80
|
+
areRelatedEntitiesChanged(initialRelatedTempEntities.current, relatedTempEntities) ||
|
|
81
|
+
(connection.isNew && !mdm_sdk_1.isEmptyValue(ramda_1.path(['relation', 'object', 'attributes'], connection)));
|
|
82
|
+
var applyAction = isNew ? mdm_module_1.profile.relations.actions.addRelation : mdm_module_1.profile.relations.actions.editRelation;
|
|
83
|
+
var onRelationTypeChange = react_1.useCallback(ramda_1.pipe(mdm_module_1.profile.relations.actions.setRelationType(config.id, relationUri), dispatch), [config, relationUri, dispatch]);
|
|
84
|
+
var handleClose = react_1.useCallback(function () { return ramda_1.pipe(mdm_module_1.profile.relations.actions.closeRelationEditor, dispatch)(config.id, relationUri); }, [config, relationUri, dispatch]);
|
|
85
|
+
var updateModifiedEntityLabel = react_1.useCallback(function (connection) {
|
|
86
|
+
if (modifiedEntity) {
|
|
87
|
+
var entityType = mdm_sdk_1.getEntityType(metadata, modifiedEntity.type);
|
|
88
|
+
return mdm_sdk_1.updateConnectionEntityLabel(entityType, modifiedEntity, connection);
|
|
89
|
+
}
|
|
90
|
+
return connection;
|
|
91
|
+
}, [modifiedEntity, metadata]);
|
|
92
|
+
var setModifiedEntity = react_1.useCallback(function (entity) { return dispatch(mdm_module_1.profile.modifiedEntities.actions.entityCreated(entity)); }, [dispatch]);
|
|
93
|
+
var deleteModifiedEntity = react_1.useCallback(function (entityUri) { return dispatch(mdm_module_1.profile.modifiedEntities.actions.entityDeleted(entityUri)); }, [dispatch]);
|
|
94
|
+
var onChangeEntity = react_1.useCallback(function (entity) {
|
|
95
|
+
if (modifiedEntity) {
|
|
96
|
+
deleteModifiedEntity(modifiedEntity.uri);
|
|
97
|
+
}
|
|
98
|
+
dispatch(mdm_module_1.profile.relations.actions.setRelationEntity(config.id, relationUri, entity));
|
|
99
|
+
if (error) {
|
|
100
|
+
dispatch(mdm_module_1.profile.errors.actions.errorDeactivated(mdm_sdk_1.getErrorId(error)));
|
|
101
|
+
}
|
|
102
|
+
}, [config.id, relationUri, dispatch, modifiedEntity, deleteModifiedEntity, error]);
|
|
103
|
+
var validate = react_1.useCallback(function () {
|
|
104
|
+
var errors = mdm_sdk_1.validateConnection(metadata, allModifiedEntities, connection);
|
|
105
|
+
dispatch(mdm_module_1.profile.errors.actions.errorsSet(errors));
|
|
106
|
+
return errors.length === 0;
|
|
107
|
+
}, [connection, metadata, allModifiedEntities, dispatch]);
|
|
108
|
+
var resetErrors = react_1.useCallback(function () { return dispatch(mdm_module_1.profile.errors.actions.errorsSet([])); }, [dispatch]);
|
|
109
|
+
var onApply = react_1.useCallback(ramda_1.pipe(ramda_1.always(connection), ramda_1.when(validate, ramda_1.pipe(mdm_sdk_1.omitMarks, updateModifiedEntityLabel, applyAction(config.id), dispatch, ramda_1.always(ramda_1.differenceWith(ramda_1.equals, relatedTempEntitiesUrisHistory.current, relatedTempEntities.map(ramda_1.prop('uri')))), ramda_1.forEach(deleteModifiedEntity), handleClose))), [connection, config, dispatch, updateModifiedEntityLabel, validate, relatedTempEntities]);
|
|
110
|
+
var onCancel = react_1.useCallback(function () {
|
|
111
|
+
var initialEntity = initialModifiedEntity.current;
|
|
112
|
+
if (modifiedEntity !== initialEntity) {
|
|
113
|
+
if (initialEntity) {
|
|
114
|
+
setModifiedEntity(initialEntity);
|
|
115
|
+
if (modifiedEntity && modifiedEntity.uri !== initialEntity.uri) {
|
|
116
|
+
deleteModifiedEntity(modifiedEntity.uri);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
deleteModifiedEntity(modifiedEntity.uri);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
var initialTempEntities = initialRelatedTempEntities.current;
|
|
124
|
+
var entitiesUrisToDelete = ramda_1.differenceWith(ramda_1.equals, relatedTempEntitiesUrisHistory.current, initialTempEntities.map(ramda_1.prop('uri')));
|
|
125
|
+
entitiesUrisToDelete.forEach(deleteModifiedEntity);
|
|
126
|
+
initialTempEntities.forEach(setModifiedEntity);
|
|
127
|
+
resetErrors();
|
|
128
|
+
handleClose();
|
|
129
|
+
}, [handleClose, setModifiedEntity, deleteModifiedEntity, resetErrors, modifiedEntity]);
|
|
130
|
+
var onAddAttributes = react_1.useCallback(function (params) {
|
|
131
|
+
return ramda_1.pipe(mdm_module_1.profile.actions.addAttributes, dispatch)(params.map(function (param) { return (__assign(__assign({}, param), { viewId: config.id })); }));
|
|
132
|
+
}, [config.id, dispatch]);
|
|
133
|
+
var onChangeAttribute = react_1.useCallback(function (params) { return ramda_1.pipe(mdm_module_1.profile.actions.modifyAttribute, dispatch)(__assign(__assign({}, params), { viewId: config.id })); }, [config.id, dispatch]);
|
|
134
|
+
var onDeleteAttribute = react_1.useCallback(function (params) { return ramda_1.pipe(mdm_module_1.profile.actions.removeAttribute, dispatch)(__assign(__assign({}, params), { viewId: config.id })); }, [config.id, dispatch]);
|
|
135
|
+
var onCreateEntity = react_1.useCallback(function (entityTypeUri, initValue) {
|
|
136
|
+
var entityType = mdm_sdk_1.getEntityType(metadata, entityTypeUri);
|
|
137
|
+
var newEntityAttrTypes = ramda_1.pipe(mdm_sdk_1.relationEditorAttributeTypesSelectionStrategy, mdm_sdk_1.getCreatableAttributeTypes(mode))(entityType);
|
|
138
|
+
var newEntity = mdm_sdk_1.createTemporaryEntity({
|
|
139
|
+
entityTypeUri: entityTypeUri,
|
|
140
|
+
initValue: initValue,
|
|
141
|
+
attributeTypes: newEntityAttrTypes,
|
|
142
|
+
metadata: metadata,
|
|
143
|
+
mode: mode
|
|
144
|
+
});
|
|
145
|
+
onChangeEntity(newEntity);
|
|
146
|
+
setModifiedEntity(newEntity);
|
|
147
|
+
}, [setModifiedEntity, onChangeEntity, mode, metadata]);
|
|
148
|
+
var errorMessage = mdm_sdk_1.getErrorMessage(error);
|
|
149
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
150
|
+
react_1.default.createElement("div", { className: styles.editor },
|
|
151
|
+
react_1.default.createElement(Typography_1.default, { className: styles.title }, isNew ? ui_i18n_1.default.text('Add new item') : ui_i18n_1.default.text('Edit item')),
|
|
152
|
+
defaultRelationType === null && (react_1.default.createElement(ConnectionRelationTypeSelector_1.default, { className: styles.item, relation: connection.relation, inRelationTypes: inRelationTypes, outRelationTypes: outRelationTypes, onChange: onRelationTypeChange })),
|
|
153
|
+
Boolean(relationType) && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
154
|
+
react_1.default.createElement(ErrorWrapper_1.default, { errorMessage: errorMessage },
|
|
155
|
+
react_1.default.createElement(EntitySelector_1.default, { className: classnames_1.default(styles.item, (_b = {},
|
|
156
|
+
_b[styles.dense] = errorMessage || (connection.entity && mdm_sdk_1.isTempUri(connection.entity.entityUri)),
|
|
157
|
+
_b)), entity: connection.entity || {}, entityTypesUris: config.content.entityTypes || [], max: config.max || 20, globalSearchRequestOptions: globalSearchRequestOptions, mode: mode, onChange: onChangeEntity, onCreate: onCreateEntity, metadata: metadata, attributeTypesSelectionStrategy: mdm_sdk_1.relationEditorAttributeTypesSelectionStrategy })),
|
|
158
|
+
react_1.default.createElement(AttributesList_1.default, { className: styles.item, attrTypes: firstLevelRelationAttrTypes, entity: attributeListEntity, showEmptyEditors: true, crosswalks: connection.crosswalks, mode: mode, parentUri: relationUri, onAddAttributes: onAddAttributes, onChangeAttribute: onChangeAttribute, onDeleteAttribute: onDeleteAttribute })))),
|
|
159
|
+
react_1.default.createElement("div", { className: styles.actionButtons },
|
|
160
|
+
react_1.default.createElement(Button_1.default, { onClick: onCancel }, ui_i18n_1.default.text('Cancel')),
|
|
161
|
+
react_1.default.createElement(Button_1.default, { color: "primary", disabled: !hasChanges, onClick: onApply }, ui_i18n_1.default.text('Apply'))),
|
|
162
|
+
react_1.default.createElement(Divider_1.default, null)));
|
|
163
|
+
};
|
|
164
|
+
RelationEditor.propTypes = {
|
|
165
|
+
connection: mdm_sdk_1.ConnectionType,
|
|
166
|
+
modifiedEntity: mdm_sdk_1.EntityType,
|
|
167
|
+
allModifiedEntities: prop_types_1.default.object,
|
|
168
|
+
dispatch: prop_types_1.default.func,
|
|
169
|
+
config: mdm_sdk_1.RelationsConfigType,
|
|
170
|
+
mode: prop_types_1.default.string,
|
|
171
|
+
metadata: mdm_sdk_1.MetadataType,
|
|
172
|
+
globalSearchRequestOptions: prop_types_1.default.object,
|
|
173
|
+
error: mdm_sdk_1.AttributeErrorType
|
|
174
|
+
};
|
|
175
|
+
exports.default = RelationEditor;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
export { RelationEditor };
|
|
2
|
+
declare var _default: import("react-redux").ConnectedComponent<{
|
|
3
|
+
({ connection, modifiedEntity, allModifiedEntities, dispatch, config, mode, metadata, globalSearchRequestOptions, error }: {
|
|
4
|
+
connection: any;
|
|
5
|
+
modifiedEntity: any;
|
|
6
|
+
allModifiedEntities: any;
|
|
7
|
+
dispatch: any;
|
|
8
|
+
config: any;
|
|
9
|
+
mode: any;
|
|
10
|
+
metadata: any;
|
|
11
|
+
globalSearchRequestOptions: any;
|
|
12
|
+
error: any;
|
|
13
|
+
}): JSX.Element;
|
|
14
|
+
propTypes: {
|
|
15
|
+
connection: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
16
|
+
entity: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
17
|
+
entityUri: import("prop-types").Requireable<string>;
|
|
18
|
+
entityType: import("prop-types").Requireable<string>;
|
|
19
|
+
entityLabel: import("prop-types").Requireable<string>;
|
|
20
|
+
object: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
21
|
+
uri: import("prop-types").Requireable<string>;
|
|
22
|
+
type: import("prop-types").Requireable<string>;
|
|
23
|
+
}>>;
|
|
24
|
+
}>>;
|
|
25
|
+
relation: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
26
|
+
relationUri: import("prop-types").Requireable<string>;
|
|
27
|
+
relationType: import("prop-types").Requireable<string>;
|
|
28
|
+
relationLabel: import("prop-types").Requireable<string>;
|
|
29
|
+
direction: import("prop-types").Requireable<string>;
|
|
30
|
+
object: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
31
|
+
uri: import("prop-types").Requireable<string>;
|
|
32
|
+
type: import("prop-types").Requireable<string>;
|
|
33
|
+
}>>;
|
|
34
|
+
}>>;
|
|
35
|
+
}>>;
|
|
36
|
+
modifiedEntity: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
37
|
+
uri: import("prop-types").Requireable<string>;
|
|
38
|
+
type: import("prop-types").Requireable<string>;
|
|
39
|
+
}>>;
|
|
40
|
+
allModifiedEntities: import("prop-types").Requireable<object>;
|
|
41
|
+
dispatch: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
42
|
+
config: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
43
|
+
id: import("prop-types").Requireable<string>;
|
|
44
|
+
content: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
45
|
+
inRelations: import("prop-types").Requireable<(string | object)[]>;
|
|
46
|
+
outRelations: import("prop-types").Requireable<(string | object)[]>;
|
|
47
|
+
groups: import("prop-types").Requireable<string[]>;
|
|
48
|
+
entityTypes: import("prop-types").Requireable<string[]>;
|
|
49
|
+
nextEntry: import("prop-types").Requireable<object>;
|
|
50
|
+
}>>;
|
|
51
|
+
allowOnlyCreateNew: import("prop-types").Requireable<boolean>;
|
|
52
|
+
sortColumn: import("prop-types").Requireable<string>;
|
|
53
|
+
sortOrder: import("prop-types").Requireable<string>;
|
|
54
|
+
'text-empty': import("prop-types").Requireable<string>;
|
|
55
|
+
max: import("prop-types").Requireable<number>;
|
|
56
|
+
icon: import("prop-types").Requireable<string>;
|
|
57
|
+
caption: import("prop-types").Requireable<string>;
|
|
58
|
+
canCreate: import("prop-types").Requireable<boolean>;
|
|
59
|
+
canRead: import("prop-types").Requireable<boolean>;
|
|
60
|
+
canUpdate: import("prop-types").Requireable<boolean>;
|
|
61
|
+
canDelete: import("prop-types").Requireable<boolean>;
|
|
62
|
+
editingEnabled: import("prop-types").Requireable<boolean>;
|
|
63
|
+
}>>;
|
|
64
|
+
mode: import("prop-types").Requireable<string>;
|
|
65
|
+
metadata: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
66
|
+
uri: import("prop-types").Requireable<string>;
|
|
67
|
+
description: import("prop-types").Requireable<string>;
|
|
68
|
+
label: import("prop-types").Requireable<string>;
|
|
69
|
+
schemaVersion: import("prop-types").Requireable<string>;
|
|
70
|
+
entityTypes: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
71
|
+
typeColor: import("prop-types").Requireable<string>;
|
|
72
|
+
typeIcon: import("prop-types").Requireable<string>;
|
|
73
|
+
typeImage: import("prop-types").Requireable<string>;
|
|
74
|
+
label: import("prop-types").Requireable<string>;
|
|
75
|
+
uri: import("prop-types").Requireable<string>;
|
|
76
|
+
attributes: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
77
|
+
label: import("prop-types").Requireable<string>;
|
|
78
|
+
name: import("prop-types").Requireable<string>;
|
|
79
|
+
description: import("prop-types").Requireable<string>;
|
|
80
|
+
type: import("prop-types").Requireable<string>;
|
|
81
|
+
hidden: import("prop-types").Requireable<boolean>;
|
|
82
|
+
faceted: import("prop-types").Requireable<boolean>;
|
|
83
|
+
searchable: import("prop-types").Requireable<boolean>;
|
|
84
|
+
uri: import("prop-types").Requireable<string>;
|
|
85
|
+
access: import("prop-types").Requireable<string[]>;
|
|
86
|
+
cardinality: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
87
|
+
minValue: import("prop-types").Requireable<number>;
|
|
88
|
+
maxValue: import("prop-types").Requireable<number>;
|
|
89
|
+
}>>;
|
|
90
|
+
}>[]>;
|
|
91
|
+
}>[]>;
|
|
92
|
+
roles: import("prop-types").Requireable<object[]>;
|
|
93
|
+
groupTypes: import("prop-types").Requireable<object[]>;
|
|
94
|
+
relationTypes: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
95
|
+
label: import("prop-types").Requireable<string>;
|
|
96
|
+
uri: import("prop-types").Requireable<string>;
|
|
97
|
+
typeColor: import("prop-types").Requireable<string>;
|
|
98
|
+
direction: import("prop-types").Requireable<string>;
|
|
99
|
+
startObject: import("prop-types").Requireable<object>;
|
|
100
|
+
endObject: import("prop-types").Requireable<object>;
|
|
101
|
+
}>[]>;
|
|
102
|
+
graphTypes: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
103
|
+
uri: import("prop-types").Requireable<string>;
|
|
104
|
+
label: import("prop-types").Requireable<string>;
|
|
105
|
+
extendsTypeUri: import("prop-types").Requireable<string>;
|
|
106
|
+
relationshipTypeURIs: import("prop-types").Requireable<string[]>;
|
|
107
|
+
}>[]>;
|
|
108
|
+
interactionTypes: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
109
|
+
uri: import("prop-types").Requireable<string>;
|
|
110
|
+
label: import("prop-types").Requireable<string>;
|
|
111
|
+
memberTypes: import("prop-types").Requireable<any[]>;
|
|
112
|
+
extendsTypeUri: import("prop-types").Requireable<string>;
|
|
113
|
+
attributes: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
114
|
+
label: import("prop-types").Requireable<string>;
|
|
115
|
+
name: import("prop-types").Requireable<string>;
|
|
116
|
+
description: import("prop-types").Requireable<string>;
|
|
117
|
+
type: import("prop-types").Requireable<string>;
|
|
118
|
+
hidden: import("prop-types").Requireable<boolean>;
|
|
119
|
+
faceted: import("prop-types").Requireable<boolean>;
|
|
120
|
+
searchable: import("prop-types").Requireable<boolean>;
|
|
121
|
+
uri: import("prop-types").Requireable<string>;
|
|
122
|
+
access: import("prop-types").Requireable<string[]>;
|
|
123
|
+
cardinality: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
124
|
+
minValue: import("prop-types").Requireable<number>;
|
|
125
|
+
maxValue: import("prop-types").Requireable<number>;
|
|
126
|
+
}>>;
|
|
127
|
+
}>[]>;
|
|
128
|
+
}>[]>;
|
|
129
|
+
sources: import("prop-types").Requireable<object[]>;
|
|
130
|
+
}>>;
|
|
131
|
+
globalSearchRequestOptions: import("prop-types").Requireable<object>;
|
|
132
|
+
error: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
133
|
+
type: import("prop-types").Validator<import("@reltio/mdm-sdk").ErrorType>;
|
|
134
|
+
attributeTypeUri: import("prop-types").Validator<string>;
|
|
135
|
+
parentUri: import("prop-types").Validator<string>;
|
|
136
|
+
uri: import("prop-types").Requireable<string>;
|
|
137
|
+
message: import("prop-types").Requireable<string>;
|
|
138
|
+
}>>;
|
|
139
|
+
};
|
|
140
|
+
}, any>;
|
|
141
|
+
export default _default;
|
|
142
|
+
import RelationEditor from "./RelationEditor";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.RelationEditor = void 0;
|
|
26
|
+
var RelationEditor_1 = __importDefault(require("./RelationEditor"));
|
|
27
|
+
exports.RelationEditor = RelationEditor_1.default;
|
|
28
|
+
var mdm_module_1 = __importStar(require("@reltio/mdm-module"));
|
|
29
|
+
var react_redux_1 = require("react-redux");
|
|
30
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
31
|
+
var getConnectionEntityUri = function (props) { return mdm_module_1.profile.relations.selectors.getEntityUriFromConnection(props.connection); };
|
|
32
|
+
var mapStateToProps = function (state, ownProps) {
|
|
33
|
+
var entityUri = getConnectionEntityUri(ownProps);
|
|
34
|
+
var isTempEntity = mdm_sdk_1.isTempUri(entityUri);
|
|
35
|
+
return {
|
|
36
|
+
modifiedEntity: isTempEntity ? mdm_module_1.default.selectors.getModifiedEntity(state, entityUri) : null,
|
|
37
|
+
allModifiedEntities: isTempEntity ? mdm_module_1.default.selectors.getModifiedEntities(state) : null,
|
|
38
|
+
globalSearchRequestOptions: mdm_module_1.default.selectors.getGlobalSearchRequestOptions(state, ['ovOnly']),
|
|
39
|
+
error: mdm_sdk_1.getRelationEditorActiveError(ownProps.connection, mdm_module_1.default.selectors.getProfileErrors(state))
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
exports.default = react_redux_1.connect(mapStateToProps)(RelationEditor_1.default);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"title" | "item" | "dense" | "editor" | "actionButtons">;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStyles = void 0;
|
|
4
|
+
var styles_1 = require("@material-ui/core/styles");
|
|
5
|
+
exports.useStyles = styles_1.makeStyles({
|
|
6
|
+
editor: {
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flexDirection: 'column',
|
|
9
|
+
padding: '0 24px 5px'
|
|
10
|
+
},
|
|
11
|
+
title: {
|
|
12
|
+
color: 'rgba(0, 0, 0, 0.6)',
|
|
13
|
+
fontSize: '16px',
|
|
14
|
+
letterSpacing: '0.15px',
|
|
15
|
+
lineHeight: '24px',
|
|
16
|
+
margin: '17px 0 24px'
|
|
17
|
+
},
|
|
18
|
+
item: {
|
|
19
|
+
marginBottom: '20px'
|
|
20
|
+
},
|
|
21
|
+
dense: {
|
|
22
|
+
marginBottom: 0
|
|
23
|
+
},
|
|
24
|
+
actionButtons: {
|
|
25
|
+
display: 'flex',
|
|
26
|
+
justifyContent: 'flex-end',
|
|
27
|
+
margin: '0 8px 10px',
|
|
28
|
+
'& > button': {
|
|
29
|
+
fontSize: '14px',
|
|
30
|
+
lineHeight: '16px',
|
|
31
|
+
marginLeft: '8px',
|
|
32
|
+
padding: '10px 8px',
|
|
33
|
+
backgroundColor: 'rgba(98, 2, 238, 0)'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
@@ -51,7 +51,7 @@ var Title_1 = __importDefault(require("../../../Title/Title"));
|
|
|
51
51
|
var CardinalityMessage_1 = __importDefault(require("./CardinalityMessage"));
|
|
52
52
|
var ErrorMessage_1 = __importDefault(require("../../../ErrorWrapper/ErrorMessage"));
|
|
53
53
|
var Attribute_1 = __importDefault(require("../AttributesFactory/Attribute"));
|
|
54
|
-
var Tags_1 = __importDefault(require("
|
|
54
|
+
var Tags_1 = __importDefault(require("../Tags"));
|
|
55
55
|
var Roles_1 = __importDefault(require("../../readMode/SpecialAttributes/Roles")); //TODO: should be edit mode
|
|
56
56
|
var styles_1 = require("./styles");
|
|
57
57
|
var SpecialRenderer = function (_a) {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
var react_1 = __importStar(require("react"));
|
|
26
|
+
var react_redux_1 = require("react-redux");
|
|
27
|
+
var mdm_module_1 = __importStar(require("@reltio/mdm-module"));
|
|
28
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
29
|
+
var TypeaheadEditor_1 = __importDefault(require("../../../editors/TypeaheadEditor/TypeaheadEditor"));
|
|
30
|
+
var filtersWithSearch = function (searchQuery) { return [
|
|
31
|
+
{
|
|
32
|
+
filter: 'containsWordStartingWith',
|
|
33
|
+
fieldName: 'tags',
|
|
34
|
+
values: [searchQuery]
|
|
35
|
+
}
|
|
36
|
+
]; };
|
|
37
|
+
var getQuery = function (searchQuery) {
|
|
38
|
+
return searchQuery ? "?filter=" + mdm_sdk_1.buildFilterQueryString()(filtersWithSearch(searchQuery)) : '';
|
|
39
|
+
};
|
|
40
|
+
var body = [
|
|
41
|
+
{
|
|
42
|
+
fieldName: 'tags',
|
|
43
|
+
orderType: 'reversedCount'
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
var getSuggestions = function (searchQuery) {
|
|
47
|
+
return mdm_sdk_1.getFacets({ query: getQuery(searchQuery), body: body }).then(function (response) { return Object.keys(response.tags); });
|
|
48
|
+
};
|
|
49
|
+
var Tags = function (_a) {
|
|
50
|
+
var className = _a.className, values = _a.values;
|
|
51
|
+
var dispatch = react_redux_1.useDispatch();
|
|
52
|
+
var entityUri = react_redux_1.useSelector(mdm_module_1.default.selectors.getEntityUri);
|
|
53
|
+
var onChange = react_1.useCallback(function (tags) {
|
|
54
|
+
return dispatch(mdm_module_1.profile.actions.modifyAttribute({
|
|
55
|
+
value: tags,
|
|
56
|
+
attributeType: mdm_sdk_1.EntityAttrTypes.tags,
|
|
57
|
+
uri: entityUri
|
|
58
|
+
}));
|
|
59
|
+
}, [dispatch, entityUri]);
|
|
60
|
+
return (react_1.default.createElement(TypeaheadEditor_1.default, { fullWidth: true, multiple: true, variant: "filled", className: className, value: values, onChange: onChange, getSuggestions: getSuggestions }));
|
|
61
|
+
};
|
|
62
|
+
exports.default = Tags;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Tags';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var Tags_1 = require("./Tags");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(Tags_1).default; } });
|
|
@@ -50,6 +50,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
};
|
|
51
51
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
52
|
var react_autosuggest_1 = __importDefault(require("react-autosuggest"));
|
|
53
|
+
var react_input_autosize_1 = __importDefault(require("react-input-autosize"));
|
|
53
54
|
var classnames_1 = __importDefault(require("classnames"));
|
|
54
55
|
var TextField_1 = __importDefault(require("@material-ui/core/TextField"));
|
|
55
56
|
var MenuItem_1 = __importDefault(require("@material-ui/core/MenuItem"));
|
|
@@ -66,9 +67,9 @@ var ExpandedValueTooltip_1 = __importDefault(require("../../ExpandedValueTooltip
|
|
|
66
67
|
var ValueChip_1 = __importDefault(require("../../ValueChip/ValueChip"));
|
|
67
68
|
var FETCH_DEBOUNCE_INTERVAL = 300;
|
|
68
69
|
var TypeaheadEditor = function (_a) {
|
|
69
|
-
var value = _a.value, getSuggestions = _a.getSuggestions, onChange = _a.onChange, multiple = _a.multiple, fullWidth = _a.fullWidth,
|
|
70
|
-
var
|
|
71
|
-
var
|
|
70
|
+
var value = _a.value, getSuggestions = _a.getSuggestions, onChange = _a.onChange, multiple = _a.multiple, fullWidth = _a.fullWidth, _b = _a.InputProps, InputProps = _b === void 0 ? {} : _b, inputProps = __rest(_a, ["value", "getSuggestions", "onChange", "multiple", "fullWidth", "InputProps"]);
|
|
71
|
+
var _c = react_1.useState([]), suggestions = _c[0], setSuggestions = _c[1];
|
|
72
|
+
var _d = react_1.useState(false), isPlaceholderVisible = _d[0], setPlaceholderVisibility = _d[1];
|
|
72
73
|
var inputRef = react_1.useRef();
|
|
73
74
|
var styles = styles_1.useStyles();
|
|
74
75
|
var isFocused = function () { var _a; return ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('input')) === document.activeElement; };
|
|
@@ -77,8 +78,8 @@ var TypeaheadEditor = function (_a) {
|
|
|
77
78
|
getSuggestions
|
|
78
79
|
]);
|
|
79
80
|
value = ramda_1.defaultTo(multiple ? [] : '', value);
|
|
80
|
-
var
|
|
81
|
-
var
|
|
81
|
+
var _e = react_1.useState(''), currentValue = _e[0], setCurrentValue = _e[1];
|
|
82
|
+
var _f = react_1.useState(false), hasHighlightedItem = _f[0], setHasHighlightedItem = _f[1];
|
|
82
83
|
var onInputChange = function (_a) {
|
|
83
84
|
var newValue = _a.newValue, method = _a.method;
|
|
84
85
|
switch (method) {
|
|
@@ -123,7 +124,7 @@ var TypeaheadEditor = function (_a) {
|
|
|
123
124
|
underline: classnames_1.default((_b = {}, _b[styles['input__underline']] = mdm_sdk_1.isEmptyValue(value), _b)),
|
|
124
125
|
input: classnames_1.default(styles['rawInput'], ramda_1.path(['classes', 'input'], InputProps))
|
|
125
126
|
};
|
|
126
|
-
return multiple ? (react_1.default.createElement(TextField_1.default, __assign({}, otherProps, { ref: inputRef, inputRef: ref, InputProps: __assign(__assign({}, InputProps), { startAdornment: value.map(function (item, index) { return (react_1.default.createElement(ValueChip_1.default, { key: item, label: item, onDelete: function () { return onChange(ramda_1.remove(index, 1, value)); } })); }), classes: __assign({ root: classnames_1.default(styles['multiple-input__input'], ramda_1.path(['classes', 'root'], InputProps)), adornedStart: styles['multiple-input__adornedStart'] }
|
|
127
|
+
return multiple ? (react_1.default.createElement(TextField_1.default, __assign({}, otherProps, { ref: inputRef, inputRef: ref, InputProps: __assign(__assign({}, InputProps), { startAdornment: value.map(function (item, index) { return (react_1.default.createElement(ValueChip_1.default, { key: item, label: item, onDelete: function () { return onChange(ramda_1.remove(index, 1, value)); } })); }), inputComponent: react_input_autosize_1.default, classes: __assign(__assign({ root: classnames_1.default(styles['multiple-input__input'], ramda_1.path(['classes', 'root'], InputProps)) }, commonClasses), { input: classnames_1.default(styles.autosizeInput, commonClasses.input), adornedStart: styles['multiple-input__adornedStart'] }) }), value: currentValue, onChange: onInputChange, classes: { root: styles['multiple-input__root'] } }))) : (react_1.default.createElement(TextField_1.default, __assign({}, otherProps, { ref: inputRef, inputRef: ref, value: value, onChange: ramda_1.pipe(ramda_1.tap(onInputChange), utils_1.getValue, onChange), InputProps: __assign(__assign({}, InputProps), { classes: __assign({ root: classnames_1.default(styles['input__root'], ramda_1.path(['classes', 'root'], InputProps)) }, commonClasses) }) })));
|
|
127
128
|
}, renderSuggestionsContainer: function (_a) {
|
|
128
129
|
var children = _a.children, _b = _a.containerProps, ref = _b.ref, restContainerProps = __rest(_b, ["ref"]);
|
|
129
130
|
return (react_1.default.createElement(Popper_1.default, { anchorEl: inputRef.current, open: Boolean(children) || isPlaceholderVisible },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"typeahead__suggestions-placeholder" | "typeahead__suggestions-container--open" | "typeahead__suggestions-list" | "typeahead__suggestions-menuItem" | "input__root" | "rawInput" | "multiple-input__root" | "multiple-input__input" | "multiple-input__adornedStart" | "input__underline" | "typeahead__suggestions-container" | "menuItem--item">;
|
|
1
|
+
export const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"autosizeInput" | "typeahead__suggestions-placeholder" | "typeahead__suggestions-container--open" | "typeahead__suggestions-list" | "typeahead__suggestions-menuItem" | "input__root" | "rawInput" | "multiple-input__root" | "multiple-input__input" | "multiple-input__adornedStart" | "input__underline" | "typeahead__suggestions-container" | "menuItem--item">;
|
|
@@ -24,6 +24,21 @@ exports.useStyles = styles_1.makeStyles({
|
|
|
24
24
|
color: 'rgba(0,0,0,0.87)',
|
|
25
25
|
fontSize: '14px'
|
|
26
26
|
},
|
|
27
|
+
autosizeInput: {
|
|
28
|
+
width: 'auto',
|
|
29
|
+
paddingTop: '10px',
|
|
30
|
+
paddingBottom: '11px',
|
|
31
|
+
marginLeft: '5px',
|
|
32
|
+
overflow: 'hidden',
|
|
33
|
+
'& input': {
|
|
34
|
+
background: '0px center',
|
|
35
|
+
border: 0,
|
|
36
|
+
fontSize: 'inherit',
|
|
37
|
+
outline: 0,
|
|
38
|
+
padding: 0,
|
|
39
|
+
color: 'inherit'
|
|
40
|
+
}
|
|
41
|
+
},
|
|
27
42
|
rawInput: {
|
|
28
43
|
height: '19px'
|
|
29
44
|
},
|
|
@@ -119,4 +119,5 @@ export { ReltioMap } from './ReltioMap';
|
|
|
119
119
|
export { default as ErrorMessage } from './ErrorWrapper/ErrorMessage';
|
|
120
120
|
export * from './history';
|
|
121
121
|
export { default as OvIcon } from './attributes/OvIcon';
|
|
122
|
+
export { default as RelationEditor } from './RelationEditor';
|
|
122
123
|
export * from './workflow';
|