@reltio/components 1.4.1669 → 1.4.1670-hf
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/editors/TypeaheadEditor/TypeaheadEditor.d.ts +2 -2
- package/cjs/components/editors/TypeaheadEditor/TypeaheadEditor.js +2 -2
- package/cjs/contexts/EntityLoadingIndicationContext/index.d.ts +1 -0
- package/cjs/contexts/EntityLoadingIndicationContext/index.js +23 -2
- package/cjs/contexts/MdmModuleContext/context.d.ts +2 -0
- package/cjs/contexts/MdmModuleContext/hooks.d.ts +2 -1
- package/esm/components/editors/TypeaheadEditor/TypeaheadEditor.d.ts +2 -2
- package/esm/components/editors/TypeaheadEditor/TypeaheadEditor.js +2 -2
- package/esm/contexts/EntityLoadingIndicationContext/index.d.ts +1 -0
- package/esm/contexts/EntityLoadingIndicationContext/index.js +24 -3
- package/esm/contexts/MdmModuleContext/context.d.ts +2 -0
- package/esm/contexts/MdmModuleContext/hooks.d.ts +2 -1
- package/package.json +2 -2
|
@@ -8,12 +8,12 @@ type CommonProps = Omit<TextFieldProps, 'onChange' | 'value'> & {
|
|
|
8
8
|
isCrossedOut?: boolean;
|
|
9
9
|
};
|
|
10
10
|
type MultipleProps = CommonProps & {
|
|
11
|
-
value
|
|
11
|
+
value?: string[];
|
|
12
12
|
onChange: (values: string[]) => void;
|
|
13
13
|
multiple: true;
|
|
14
14
|
};
|
|
15
15
|
type SingleProps = CommonProps & {
|
|
16
|
-
value
|
|
16
|
+
value?: string;
|
|
17
17
|
onChange: (value: string) => void;
|
|
18
18
|
multiple?: false;
|
|
19
19
|
};
|
|
@@ -201,7 +201,7 @@ var TypeaheadEditor = function (_a) {
|
|
|
201
201
|
case ChangeMethod.Enter: {
|
|
202
202
|
if (multiple === true) {
|
|
203
203
|
if (newValue)
|
|
204
|
-
onChange((0, ramda_1.uniq)(__spreadArray(__spreadArray([], value, true), [newValue], false)));
|
|
204
|
+
onChange((0, ramda_1.uniq)(__spreadArray(__spreadArray([], (value || []), true), [newValue], false)));
|
|
205
205
|
setInputValue('');
|
|
206
206
|
}
|
|
207
207
|
else {
|
|
@@ -242,7 +242,7 @@ var TypeaheadEditor = function (_a) {
|
|
|
242
242
|
underline: (0, classnames_1.default)((_b = {}, _b[styles.underline] = (0, mdm_sdk_1.isEmptyValue)(value), _b)),
|
|
243
243
|
input: (0, classnames_1.default)(styles['rawInput'], (0, ramda_1.path)(['classes', 'input'], InputProps))
|
|
244
244
|
};
|
|
245
|
-
return multiple === true ? (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((0, ramda_1.remove)(index, 1, value)); } })); }), inputComponent: react_input_autosize_1.default, classes: __assign(__assign({ root: (0, classnames_1.default)(styles.multipleTextFieldInput, (0, ramda_1.path)(['classes', 'root'], InputProps)) }, commonClasses), { input: (0, classnames_1.default)(styles.autosizeInput, commonClasses.input), adornedStart: styles.multipleTextFieldAdornedStart }) }), classes: { root: styles.multipleTextField } }))) : (react_1.default.createElement(TextField_1.default, __assign({}, otherProps, { ref: inputRef, inputRef: ref, InputProps: __assign(__assign({}, InputProps), { classes: __assign({ root: (0, classnames_1.default)(styles.inputRoot, (0, ramda_1.path)(['classes', 'root'], InputProps), (_c = {},
|
|
245
|
+
return multiple === true ? (react_1.default.createElement(TextField_1.default, __assign({}, otherProps, { ref: inputRef, inputRef: ref, InputProps: __assign(__assign({}, InputProps), { startAdornment: value === null || value === void 0 ? void 0 : value.map(function (item, index) { return (react_1.default.createElement(ValueChip_1.default, { key: item, label: item, onDelete: function () { return onChange((0, ramda_1.remove)(index, 1, value)); } })); }), inputComponent: react_input_autosize_1.default, classes: __assign(__assign({ root: (0, classnames_1.default)(styles.multipleTextFieldInput, (0, ramda_1.path)(['classes', 'root'], InputProps)) }, commonClasses), { input: (0, classnames_1.default)(styles.autosizeInput, commonClasses.input), adornedStart: styles.multipleTextFieldAdornedStart }) }), classes: { root: styles.multipleTextField } }))) : (react_1.default.createElement(TextField_1.default, __assign({}, otherProps, { ref: inputRef, inputRef: ref, InputProps: __assign(__assign({}, InputProps), { classes: __assign({ root: (0, classnames_1.default)(styles.inputRoot, (0, ramda_1.path)(['classes', 'root'], InputProps), (_c = {},
|
|
246
246
|
_c[styles.isCrossedOut] = isCrossedOut,
|
|
247
247
|
_c)) }, commonClasses) }) })));
|
|
248
248
|
}, renderSuggestionsContainer: function (_a) {
|
|
@@ -36,14 +36,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.useEntityLoadingIndication = exports.EntityLoadingIndicationProvider = void 0;
|
|
38
38
|
var react_1 = __importStar(require("react"));
|
|
39
|
+
var ramda_1 = require("ramda");
|
|
39
40
|
var utils_1 = require("../../core/utils");
|
|
41
|
+
var contexts_1 = require("../../contexts");
|
|
40
42
|
var EntityLoadingIndicationContext = react_1.default.createContext({
|
|
41
43
|
isLoading: false,
|
|
44
|
+
isEmptyState: false,
|
|
42
45
|
updateEntityLoadingState: utils_1.noop,
|
|
43
46
|
updateEntitiesNavigationLoadingState: utils_1.noop,
|
|
44
47
|
resetLoadingState: utils_1.noop
|
|
45
48
|
});
|
|
46
|
-
var defaultLoadingState = { entitiesNavigation: false, entity: false };
|
|
49
|
+
var defaultLoadingState = { entitiesNavigation: false, entity: false, entityCleansing: false };
|
|
47
50
|
var useEntityLoadingIndicationHook = function () {
|
|
48
51
|
var _a = (0, react_1.useState)(defaultLoadingState), loadingState = _a[0], setLoadingState = _a[1];
|
|
49
52
|
var updateEntityLoadingState = (0, react_1.useCallback)(function (loading) {
|
|
@@ -52,11 +55,29 @@ var useEntityLoadingIndicationHook = function () {
|
|
|
52
55
|
var updateEntitiesNavigationLoadingState = (0, react_1.useCallback)(function (loading) {
|
|
53
56
|
setLoadingState(function (prevLoadingState) { return (__assign(__assign({}, prevLoadingState), { entitiesNavigation: loading })); });
|
|
54
57
|
}, []);
|
|
58
|
+
var updateEntityCleansingLoadingState = (0, react_1.useCallback)(function (loading) {
|
|
59
|
+
setLoadingState(function (prevLoadingState) { return (__assign(__assign({}, prevLoadingState), { entityCleansing: loading })); });
|
|
60
|
+
}, []);
|
|
55
61
|
var resetLoadingState = (0, react_1.useCallback)(function () {
|
|
56
62
|
setLoadingState(defaultLoadingState);
|
|
57
63
|
}, []);
|
|
64
|
+
var listenToActions = (0, contexts_1.useActionsHook)();
|
|
65
|
+
var cleanseLoadingListener = (0, contexts_1.useMdmListener)('cleanseLoadingListener');
|
|
66
|
+
var listenerCallback = (0, react_1.useMemo)(function () { return cleanseLoadingListener(updateEntityCleansingLoadingState); }, [cleanseLoadingListener, updateEntityCleansingLoadingState]);
|
|
67
|
+
(0, react_1.useEffect)(function () {
|
|
68
|
+
var stopListeningActions = listenToActions(listenerCallback);
|
|
69
|
+
return function () { return stopListeningActions(); };
|
|
70
|
+
}, [listenerCallback, listenToActions]);
|
|
58
71
|
var isLoading = Object.values(loadingState).includes(true);
|
|
59
|
-
|
|
72
|
+
var isEmptyState = (0, ramda_1.pipe)((0, ramda_1.omit)(['entityCleansing']), ramda_1.values, (0, ramda_1.includes)(true))(loadingState);
|
|
73
|
+
return {
|
|
74
|
+
isLoading: isLoading,
|
|
75
|
+
isEmptyState: isEmptyState,
|
|
76
|
+
updateEntityLoadingState: updateEntityLoadingState,
|
|
77
|
+
updateEntitiesNavigationLoadingState: updateEntitiesNavigationLoadingState,
|
|
78
|
+
updateEntityCleansingLoadingState: updateEntityCleansingLoadingState,
|
|
79
|
+
resetLoadingState: resetLoadingState
|
|
80
|
+
};
|
|
60
81
|
};
|
|
61
82
|
var EntityLoadingIndicationProvider = function (_a) {
|
|
62
83
|
var children = _a.children;
|
|
@@ -121,6 +121,7 @@ export type MdmModuleActionsContextProps = Partial<{
|
|
|
121
121
|
}>;
|
|
122
122
|
export type MdmModuleListenersContextProps = Partial<{
|
|
123
123
|
expandInvalidRelatonsListener: (callback: () => void) => (action: any) => void;
|
|
124
|
+
cleanseLoadingListener: (callback: (value: boolean) => void) => (action: AnyAction) => void;
|
|
124
125
|
searchNavigationListener: (action: AnyAction, state: any, dispatch: (action: AnyAction) => void) => void;
|
|
125
126
|
}>;
|
|
126
127
|
export declare const MdmModuleActionsContext: import("@fluentui/react-context-selector").Context<Partial<{
|
|
@@ -244,5 +245,6 @@ export declare const MdmModuleValuesContext: import("@fluentui/react-context-sel
|
|
|
244
245
|
}>>;
|
|
245
246
|
export declare const MdmModuleListenersContext: import("@fluentui/react-context-selector").Context<Partial<{
|
|
246
247
|
expandInvalidRelatonsListener: (callback: () => void) => (action: any) => void;
|
|
248
|
+
cleanseLoadingListener: (callback: (value: boolean) => void) => (action: AnyAction) => void;
|
|
247
249
|
searchNavigationListener: (action: AnyAction, state: any, dispatch: (action: AnyAction) => void) => void;
|
|
248
250
|
}>>;
|
|
@@ -136,7 +136,8 @@ export declare const useMdmAction: <T extends "openSearch" | "openHistoryEvent"
|
|
|
136
136
|
addRelation: (id: string, connection: import("@reltio/mdm-sdk").Connection) => void;
|
|
137
137
|
editRelation: (id: string, connection: import("@reltio/mdm-sdk").Connection) => void;
|
|
138
138
|
}>[T];
|
|
139
|
-
export declare const useMdmListener: <T extends "expandInvalidRelatonsListener" | "searchNavigationListener">(listener: T) => Partial<{
|
|
139
|
+
export declare const useMdmListener: <T extends "expandInvalidRelatonsListener" | "cleanseLoadingListener" | "searchNavigationListener">(listener: T) => Partial<{
|
|
140
140
|
expandInvalidRelatonsListener: (callback: () => void) => (action: any) => void;
|
|
141
|
+
cleanseLoadingListener: (callback: (value: boolean) => void) => (action: import("../..").AnyAction) => void;
|
|
141
142
|
searchNavigationListener: (action: import("../..").AnyAction, state: any, dispatch: (action: import("../..").AnyAction) => void) => void;
|
|
142
143
|
}>[T];
|
|
@@ -8,12 +8,12 @@ type CommonProps = Omit<TextFieldProps, 'onChange' | 'value'> & {
|
|
|
8
8
|
isCrossedOut?: boolean;
|
|
9
9
|
};
|
|
10
10
|
type MultipleProps = CommonProps & {
|
|
11
|
-
value
|
|
11
|
+
value?: string[];
|
|
12
12
|
onChange: (values: string[]) => void;
|
|
13
13
|
multiple: true;
|
|
14
14
|
};
|
|
15
15
|
type SingleProps = CommonProps & {
|
|
16
|
-
value
|
|
16
|
+
value?: string;
|
|
17
17
|
onChange: (value: string) => void;
|
|
18
18
|
multiple?: false;
|
|
19
19
|
};
|
|
@@ -173,7 +173,7 @@ var TypeaheadEditor = function (_a) {
|
|
|
173
173
|
case ChangeMethod.Enter: {
|
|
174
174
|
if (multiple === true) {
|
|
175
175
|
if (newValue)
|
|
176
|
-
onChange(uniq(__spreadArray(__spreadArray([], value, true), [newValue], false)));
|
|
176
|
+
onChange(uniq(__spreadArray(__spreadArray([], (value || []), true), [newValue], false)));
|
|
177
177
|
setInputValue('');
|
|
178
178
|
}
|
|
179
179
|
else {
|
|
@@ -214,7 +214,7 @@ var TypeaheadEditor = function (_a) {
|
|
|
214
214
|
underline: classnames((_b = {}, _b[styles.underline] = isEmptyValue(value), _b)),
|
|
215
215
|
input: classnames(styles['rawInput'], path(['classes', 'input'], InputProps))
|
|
216
216
|
};
|
|
217
|
-
return multiple === true ? (React.createElement(TextField, __assign({}, otherProps, { ref: inputRef, inputRef: ref, InputProps: __assign(__assign({}, InputProps), { startAdornment: value.map(function (item, index) { return (React.createElement(ValueChip, { key: item, label: item, onDelete: function () { return onChange(remove(index, 1, value)); } })); }), inputComponent: AutosizeInput, classes: __assign(__assign({ root: classnames(styles.multipleTextFieldInput, path(['classes', 'root'], InputProps)) }, commonClasses), { input: classnames(styles.autosizeInput, commonClasses.input), adornedStart: styles.multipleTextFieldAdornedStart }) }), classes: { root: styles.multipleTextField } }))) : (React.createElement(TextField, __assign({}, otherProps, { ref: inputRef, inputRef: ref, InputProps: __assign(__assign({}, InputProps), { classes: __assign({ root: classnames(styles.inputRoot, path(['classes', 'root'], InputProps), (_c = {},
|
|
217
|
+
return multiple === true ? (React.createElement(TextField, __assign({}, otherProps, { ref: inputRef, inputRef: ref, InputProps: __assign(__assign({}, InputProps), { startAdornment: value === null || value === void 0 ? void 0 : value.map(function (item, index) { return (React.createElement(ValueChip, { key: item, label: item, onDelete: function () { return onChange(remove(index, 1, value)); } })); }), inputComponent: AutosizeInput, classes: __assign(__assign({ root: classnames(styles.multipleTextFieldInput, path(['classes', 'root'], InputProps)) }, commonClasses), { input: classnames(styles.autosizeInput, commonClasses.input), adornedStart: styles.multipleTextFieldAdornedStart }) }), classes: { root: styles.multipleTextField } }))) : (React.createElement(TextField, __assign({}, otherProps, { ref: inputRef, inputRef: ref, InputProps: __assign(__assign({}, InputProps), { classes: __assign({ root: classnames(styles.inputRoot, path(['classes', 'root'], InputProps), (_c = {},
|
|
218
218
|
_c[styles.isCrossedOut] = isCrossedOut,
|
|
219
219
|
_c)) }, commonClasses) }) })));
|
|
220
220
|
}, renderSuggestionsContainer: function (_a) {
|
|
@@ -9,15 +9,18 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import React, {
|
|
12
|
+
import React, { useCallback, useContext, useEffect, useState, useMemo } from 'react';
|
|
13
|
+
import { includes, omit, pipe, values } from 'ramda';
|
|
13
14
|
import { noop } from '../../core/utils';
|
|
15
|
+
import { useActionsHook, useMdmListener } from '../../contexts';
|
|
14
16
|
var EntityLoadingIndicationContext = React.createContext({
|
|
15
17
|
isLoading: false,
|
|
18
|
+
isEmptyState: false,
|
|
16
19
|
updateEntityLoadingState: noop,
|
|
17
20
|
updateEntitiesNavigationLoadingState: noop,
|
|
18
21
|
resetLoadingState: noop
|
|
19
22
|
});
|
|
20
|
-
var defaultLoadingState = { entitiesNavigation: false, entity: false };
|
|
23
|
+
var defaultLoadingState = { entitiesNavigation: false, entity: false, entityCleansing: false };
|
|
21
24
|
var useEntityLoadingIndicationHook = function () {
|
|
22
25
|
var _a = useState(defaultLoadingState), loadingState = _a[0], setLoadingState = _a[1];
|
|
23
26
|
var updateEntityLoadingState = useCallback(function (loading) {
|
|
@@ -26,11 +29,29 @@ var useEntityLoadingIndicationHook = function () {
|
|
|
26
29
|
var updateEntitiesNavigationLoadingState = useCallback(function (loading) {
|
|
27
30
|
setLoadingState(function (prevLoadingState) { return (__assign(__assign({}, prevLoadingState), { entitiesNavigation: loading })); });
|
|
28
31
|
}, []);
|
|
32
|
+
var updateEntityCleansingLoadingState = useCallback(function (loading) {
|
|
33
|
+
setLoadingState(function (prevLoadingState) { return (__assign(__assign({}, prevLoadingState), { entityCleansing: loading })); });
|
|
34
|
+
}, []);
|
|
29
35
|
var resetLoadingState = useCallback(function () {
|
|
30
36
|
setLoadingState(defaultLoadingState);
|
|
31
37
|
}, []);
|
|
38
|
+
var listenToActions = useActionsHook();
|
|
39
|
+
var cleanseLoadingListener = useMdmListener('cleanseLoadingListener');
|
|
40
|
+
var listenerCallback = useMemo(function () { return cleanseLoadingListener(updateEntityCleansingLoadingState); }, [cleanseLoadingListener, updateEntityCleansingLoadingState]);
|
|
41
|
+
useEffect(function () {
|
|
42
|
+
var stopListeningActions = listenToActions(listenerCallback);
|
|
43
|
+
return function () { return stopListeningActions(); };
|
|
44
|
+
}, [listenerCallback, listenToActions]);
|
|
32
45
|
var isLoading = Object.values(loadingState).includes(true);
|
|
33
|
-
|
|
46
|
+
var isEmptyState = pipe(omit(['entityCleansing']), values, includes(true))(loadingState);
|
|
47
|
+
return {
|
|
48
|
+
isLoading: isLoading,
|
|
49
|
+
isEmptyState: isEmptyState,
|
|
50
|
+
updateEntityLoadingState: updateEntityLoadingState,
|
|
51
|
+
updateEntitiesNavigationLoadingState: updateEntitiesNavigationLoadingState,
|
|
52
|
+
updateEntityCleansingLoadingState: updateEntityCleansingLoadingState,
|
|
53
|
+
resetLoadingState: resetLoadingState
|
|
54
|
+
};
|
|
34
55
|
};
|
|
35
56
|
export var EntityLoadingIndicationProvider = function (_a) {
|
|
36
57
|
var children = _a.children;
|
|
@@ -121,6 +121,7 @@ export type MdmModuleActionsContextProps = Partial<{
|
|
|
121
121
|
}>;
|
|
122
122
|
export type MdmModuleListenersContextProps = Partial<{
|
|
123
123
|
expandInvalidRelatonsListener: (callback: () => void) => (action: any) => void;
|
|
124
|
+
cleanseLoadingListener: (callback: (value: boolean) => void) => (action: AnyAction) => void;
|
|
124
125
|
searchNavigationListener: (action: AnyAction, state: any, dispatch: (action: AnyAction) => void) => void;
|
|
125
126
|
}>;
|
|
126
127
|
export declare const MdmModuleActionsContext: import("@fluentui/react-context-selector").Context<Partial<{
|
|
@@ -244,5 +245,6 @@ export declare const MdmModuleValuesContext: import("@fluentui/react-context-sel
|
|
|
244
245
|
}>>;
|
|
245
246
|
export declare const MdmModuleListenersContext: import("@fluentui/react-context-selector").Context<Partial<{
|
|
246
247
|
expandInvalidRelatonsListener: (callback: () => void) => (action: any) => void;
|
|
248
|
+
cleanseLoadingListener: (callback: (value: boolean) => void) => (action: AnyAction) => void;
|
|
247
249
|
searchNavigationListener: (action: AnyAction, state: any, dispatch: (action: AnyAction) => void) => void;
|
|
248
250
|
}>>;
|
|
@@ -136,7 +136,8 @@ export declare const useMdmAction: <T extends "openSearch" | "openHistoryEvent"
|
|
|
136
136
|
addRelation: (id: string, connection: import("@reltio/mdm-sdk").Connection) => void;
|
|
137
137
|
editRelation: (id: string, connection: import("@reltio/mdm-sdk").Connection) => void;
|
|
138
138
|
}>[T];
|
|
139
|
-
export declare const useMdmListener: <T extends "expandInvalidRelatonsListener" | "searchNavigationListener">(listener: T) => Partial<{
|
|
139
|
+
export declare const useMdmListener: <T extends "expandInvalidRelatonsListener" | "cleanseLoadingListener" | "searchNavigationListener">(listener: T) => Partial<{
|
|
140
140
|
expandInvalidRelatonsListener: (callback: () => void) => (action: any) => void;
|
|
141
|
+
cleanseLoadingListener: (callback: (value: boolean) => void) => (action: import("../..").AnyAction) => void;
|
|
141
142
|
searchNavigationListener: (action: import("../..").AnyAction, state: any, dispatch: (action: import("../..").AnyAction) => void) => void;
|
|
142
143
|
}>[T];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1670-hf",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"@date-io/moment": "^1.3.5",
|
|
9
9
|
"@fluentui/react-context-selector": "^9.1.26",
|
|
10
10
|
"@react-google-maps/api": "2.7.0",
|
|
11
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1670-hf",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|