@reltio/components 1.4.2159 → 1.4.2161
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/AddressAutocompleteEditor/AddressAutocompleteEditor.d.ts +10 -0
- package/AddressAutocompleteEditor/AddressAutocompleteEditor.js +223 -0
- package/AddressAutocompleteEditor/AddressAutocompleteEditor.module.css.js +9 -0
- package/AddressAutocompleteEditor/AddressAutocompleteEditor.test.d.ts +1 -0
- package/AddressAutocompleteEditor/AddressAutocompleteEditor.test.js +522 -0
- package/AddressAutocompleteEditor/helpers.d.ts +10 -0
- package/AddressAutocompleteEditor/helpers.js +18 -0
- package/AddressAutocompleteEditor/index.d.ts +1 -0
- package/AddressAutocompleteEditor/index.js +1 -0
- package/BasicTable/index.d.ts +1 -0
- package/EditModeAttributesPager/components/AttributeRenderer/AttributeRenderer.js +1 -1
- package/EditorsFactory/EditorsFactory.js +4 -0
- package/ReferenceAttributeEditor/ReferenceAttributeEditor.js +5 -3
- package/RelationEditor/RelationEditor.js +6 -4
- package/SimpleAttributeEditor/SimpleAttributeEditor.d.ts +1 -0
- package/SimpleAttributeEditor/SimpleAttributeEditor.js +15 -4
- package/cjs/AddressAutocompleteEditor/AddressAutocompleteEditor.d.ts +10 -0
- package/cjs/AddressAutocompleteEditor/AddressAutocompleteEditor.js +253 -0
- package/cjs/AddressAutocompleteEditor/AddressAutocompleteEditor.module.css.js +9 -0
- package/cjs/AddressAutocompleteEditor/AddressAutocompleteEditor.test.d.ts +1 -0
- package/cjs/AddressAutocompleteEditor/AddressAutocompleteEditor.test.js +527 -0
- package/cjs/AddressAutocompleteEditor/helpers.d.ts +10 -0
- package/cjs/AddressAutocompleteEditor/helpers.js +24 -0
- package/cjs/AddressAutocompleteEditor/index.d.ts +1 -0
- package/cjs/AddressAutocompleteEditor/index.js +5 -0
- package/cjs/BasicTable/index.d.ts +1 -0
- package/cjs/EditModeAttributesPager/components/AttributeRenderer/AttributeRenderer.js +1 -1
- package/cjs/EditorsFactory/EditorsFactory.js +4 -0
- package/cjs/ReferenceAttributeEditor/ReferenceAttributeEditor.js +5 -3
- package/cjs/RelationEditor/RelationEditor.js +6 -4
- package/cjs/SimpleAttributeEditor/SimpleAttributeEditor.d.ts +1 -0
- package/cjs/SimpleAttributeEditor/SimpleAttributeEditor.js +14 -3
- package/cjs/contexts/AttributeValueContext/index.d.ts +3 -0
- package/cjs/contexts/AttributeValueContext/index.js +9 -0
- package/cjs/contexts/AutoCompleteContext/helpers.d.ts +24 -0
- package/cjs/contexts/AutoCompleteContext/helpers.js +165 -0
- package/cjs/contexts/AutoCompleteContext/index.d.ts +12 -0
- package/cjs/contexts/AutoCompleteContext/index.js +83 -0
- package/cjs/contexts/ProfileTablesContext/index.js +1 -0
- package/contexts/AttributeValueContext/index.d.ts +3 -0
- package/contexts/AttributeValueContext/index.js +3 -0
- package/contexts/AutoCompleteContext/helpers.d.ts +24 -0
- package/contexts/AutoCompleteContext/helpers.js +159 -0
- package/contexts/AutoCompleteContext/index.d.ts +12 -0
- package/contexts/AutoCompleteContext/index.js +56 -0
- package/contexts/ProfileTablesContext/index.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { useCallback, useMemo } from 'react';
|
|
2
|
+
import { createContext } from '@fluentui/react-context-selector';
|
|
3
|
+
import { getEntityType } from '@reltio/mdm-sdk';
|
|
4
|
+
import { useMdmAction, useMdmEntityUri, useMdmMetadata, useMdmModifiedEntity } from '../MdmModuleContext';
|
|
5
|
+
import { getSettings, isTriggerAttribute, modifyAttributes } from './helpers';
|
|
6
|
+
export var AddressAutoCompleteContext = createContext(null);
|
|
7
|
+
export var AddressAutoCompleteProvider = function (_a) {
|
|
8
|
+
var children = _a.children, entityUri = _a.entityUri;
|
|
9
|
+
var metadata = useMdmMetadata();
|
|
10
|
+
var modifyAttribute = useMdmAction('modifyAttribute');
|
|
11
|
+
var mdmEntityUri = useMdmEntityUri();
|
|
12
|
+
var modifiedEntity = useMdmModifiedEntity(entityUri || mdmEntityUri) || {};
|
|
13
|
+
var addressAutoCompleteConfig = useMemo(function () {
|
|
14
|
+
var _a;
|
|
15
|
+
var entityType = (modifiedEntity === null || modifiedEntity === void 0 ? void 0 : modifiedEntity.type) && metadata && getEntityType(metadata, modifiedEntity.type);
|
|
16
|
+
return (((_a = entityType === null || entityType === void 0 ? void 0 : entityType.cleanseConfig) === null || _a === void 0 ? void 0 : _a.addressAutoCompleteConfig) ||
|
|
17
|
+
{ outputMapping: [], inputMapping: [] });
|
|
18
|
+
}, [modifiedEntity === null || modifiedEntity === void 0 ? void 0 : modifiedEntity.type, metadata]);
|
|
19
|
+
var onPopulateAttributes = useCallback(function (triggerAttributeTypeUri, triggerAttributeValueUri, values) {
|
|
20
|
+
if (!(addressAutoCompleteConfig === null || addressAutoCompleteConfig === void 0 ? void 0 : addressAutoCompleteConfig.outputMapping) ||
|
|
21
|
+
!(modifiedEntity === null || modifiedEntity === void 0 ? void 0 : modifiedEntity.uri) ||
|
|
22
|
+
!triggerAttributeTypeUri ||
|
|
23
|
+
!values) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
var outputMapping = addressAutoCompleteConfig.outputMapping;
|
|
27
|
+
modifyAttributes({
|
|
28
|
+
outputMapping: outputMapping,
|
|
29
|
+
modifiedEntity: modifiedEntity,
|
|
30
|
+
metadata: metadata,
|
|
31
|
+
triggerAttributeTypeUri: triggerAttributeTypeUri,
|
|
32
|
+
triggerAttributeValueUri: triggerAttributeValueUri,
|
|
33
|
+
values: values,
|
|
34
|
+
modifyAttribute: modifyAttribute
|
|
35
|
+
});
|
|
36
|
+
}, [addressAutoCompleteConfig, modifiedEntity, metadata, modifyAttribute]);
|
|
37
|
+
var isAutocompleteTriggerAttribute = useCallback(function (attributeType) {
|
|
38
|
+
var _a = addressAutoCompleteConfig.inputMapping, inputMapping = _a === void 0 ? [] : _a;
|
|
39
|
+
return isTriggerAttribute(attributeType, inputMapping);
|
|
40
|
+
}, [addressAutoCompleteConfig]);
|
|
41
|
+
var getAutocompleteSettings = useCallback(function (triggerAttributeTypeUri, triggerAttributeValueUri) {
|
|
42
|
+
return getSettings({
|
|
43
|
+
metadata: metadata,
|
|
44
|
+
modifiedEntity: modifiedEntity,
|
|
45
|
+
triggerAttributeValueUri: triggerAttributeValueUri,
|
|
46
|
+
triggerAttributeTypeUri: triggerAttributeTypeUri,
|
|
47
|
+
addressAutoCompleteConfig: addressAutoCompleteConfig
|
|
48
|
+
});
|
|
49
|
+
}, [addressAutoCompleteConfig, metadata, modifiedEntity]);
|
|
50
|
+
var contextValue = useMemo(function () { return ({
|
|
51
|
+
onPopulateAttributes: onPopulateAttributes,
|
|
52
|
+
isAutocompleteTriggerAttribute: isAutocompleteTriggerAttribute,
|
|
53
|
+
getAutocompleteSettings: getAutocompleteSettings
|
|
54
|
+
}); }, [onPopulateAttributes, isAutocompleteTriggerAttribute, getAutocompleteSettings]);
|
|
55
|
+
return React.createElement(AddressAutoCompleteContext.Provider, { value: contextValue }, children);
|
|
56
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2161",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@fluentui/react-context-selector": "^9.1.26",
|
|
12
12
|
"@googlemaps/markerclusterer": "^2.5.3",
|
|
13
13
|
"@react-sigma/core": "3.4.0",
|
|
14
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
14
|
+
"@reltio/mdm-sdk": "^1.4.1978",
|
|
15
15
|
"@vis.gl/react-google-maps": "^1.3.0",
|
|
16
16
|
"d3-cloud": "^1.2.5",
|
|
17
17
|
"d3-geo": "^2.0.1",
|