@reltio/components 1.4.1995 → 1.4.1997
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/ResizablePanes/ResizablePanes.js +5 -6
- package/cjs/helpers/basicTable.js +5 -3
- package/cjs/hooks/useRelationsLoader/useRelationsLoader.d.ts +2 -1
- package/cjs/hooks/useRelationsLoader/useRelationsLoader.js +12 -5
- package/esm/ResizablePanes/ResizablePanes.js +5 -6
- package/esm/helpers/basicTable.js +6 -4
- package/esm/hooks/useRelationsLoader/useRelationsLoader.d.ts +2 -1
- package/esm/hooks/useRelationsLoader/useRelationsLoader.js +12 -5
- package/package.json +2 -2
|
@@ -91,10 +91,9 @@ var ResizablePanes = function (_a) {
|
|
|
91
91
|
(0, react_1.useEffect)(function () {
|
|
92
92
|
actualizeSizes();
|
|
93
93
|
}, [actualizeSizes, percentageMaxSize, percentageMinSize]);
|
|
94
|
-
var handleChange = (0, react_1.useCallback)((0, mdm_sdk_1.debounce)(function (size) {
|
|
95
|
-
if (size === undefined)
|
|
94
|
+
var handleChange = (0, react_1.useCallback)((0, mdm_sdk_1.debounce)(function (size, containerSize) {
|
|
95
|
+
if (size === undefined || containerSize === 0)
|
|
96
96
|
return;
|
|
97
|
-
var containerSize = getContainerSize();
|
|
98
97
|
onChange({
|
|
99
98
|
percentageSize: size + '%',
|
|
100
99
|
isMaxSize: +percentageMaxSize > 0
|
|
@@ -103,7 +102,7 @@ var ResizablePanes = function (_a) {
|
|
|
103
102
|
isMinSize: isEqualSize(size, percentageMinSize),
|
|
104
103
|
size: Math.round((size * containerSize) / 100)
|
|
105
104
|
});
|
|
106
|
-
}, debounceInterval), [onChange, percentageMaxSize, percentageMinSize
|
|
105
|
+
}, debounceInterval), [onChange, percentageMaxSize, percentageMinSize]);
|
|
107
106
|
var handleDragging = (0, react_1.useCallback)(function (isDragging) {
|
|
108
107
|
if (isDragging) {
|
|
109
108
|
// Why do we need handleChange() here?
|
|
@@ -113,10 +112,10 @@ var ResizablePanes = function (_a) {
|
|
|
113
112
|
disableAnimation();
|
|
114
113
|
}
|
|
115
114
|
else {
|
|
116
|
-
handleChange(panelRef.current.getSize());
|
|
115
|
+
handleChange(panelRef.current.getSize(), getContainerSize());
|
|
117
116
|
enableAnimation();
|
|
118
117
|
}
|
|
119
|
-
}, [disableAnimation, enableAnimation, handleChange]);
|
|
118
|
+
}, [disableAnimation, enableAnimation, handleChange, getContainerSize]);
|
|
120
119
|
var paneAnimationStyle = (0, react_1.useMemo)(function () { return ({
|
|
121
120
|
transition: theme.transitions.create('flex', {
|
|
122
121
|
easing: theme.transitions.easing.sharp,
|
|
@@ -66,11 +66,13 @@ exports.columnFilterToMdmFilter = columnFilterToMdmFilter;
|
|
|
66
66
|
var buildColumnsFilter = function (columnsData, filters) {
|
|
67
67
|
return mdm_sdk_1.Maybe.fromNull(filters)
|
|
68
68
|
.map(function (filters) {
|
|
69
|
-
return Object.entries(filters)
|
|
69
|
+
return Object.entries(filters)
|
|
70
|
+
.map(function (_a) {
|
|
70
71
|
var columnId = _a[0], columnFilter = _a[1];
|
|
71
72
|
var columnData = columnsData.find((0, ramda_1.propEq)('id', columnId));
|
|
72
|
-
return (0, exports.columnFilterToMdmFilter)(columnData, columnFilter);
|
|
73
|
-
})
|
|
73
|
+
return columnData && (0, exports.columnFilterToMdmFilter)(columnData, columnFilter);
|
|
74
|
+
})
|
|
75
|
+
.filter(ramda_1.identity);
|
|
74
76
|
})
|
|
75
77
|
.map((0, mdm_sdk_1.buildFilterQueryString)())
|
|
76
78
|
.orSome('');
|
|
@@ -12,9 +12,10 @@ type Props = {
|
|
|
12
12
|
relationActivityFilter?: ActivityFilter;
|
|
13
13
|
mode: Mode;
|
|
14
14
|
searchByOv?: boolean;
|
|
15
|
+
searchRelationsWithFilter?: boolean;
|
|
15
16
|
showSnackbarMessage?: (message: string) => void;
|
|
16
17
|
};
|
|
17
|
-
export declare const useRelationsLoader: ({ sorting, filter, page, rowsPerPage, config, entity, relationActivityFilter, mode, searchByOv, showSnackbarMessage }: Props) => {
|
|
18
|
+
export declare const useRelationsLoader: ({ sorting, filter, page, rowsPerPage, config, entity, relationActivityFilter, mode, searchByOv, searchRelationsWithFilter, showSnackbarMessage }: Props) => {
|
|
18
19
|
isLoading: boolean;
|
|
19
20
|
reload: () => void;
|
|
20
21
|
};
|
|
@@ -35,7 +35,7 @@ var isValidRequestConfig = function (config) {
|
|
|
35
35
|
return true;
|
|
36
36
|
};
|
|
37
37
|
var useRelationsLoader = function (_a) {
|
|
38
|
-
var sorting = _a.sorting, filter = _a.filter, page = _a.page, rowsPerPage = _a.rowsPerPage, config = _a.config, entity = _a.entity, relationActivityFilter = _a.relationActivityFilter, mode = _a.mode, _b = _a.searchByOv, searchByOv = _b === void 0 ? false : _b, showSnackbarMessage = _a.showSnackbarMessage;
|
|
38
|
+
var sorting = _a.sorting, filter = _a.filter, page = _a.page, rowsPerPage = _a.rowsPerPage, config = _a.config, entity = _a.entity, relationActivityFilter = _a.relationActivityFilter, mode = _a.mode, _b = _a.searchByOv, searchByOv = _b === void 0 ? false : _b, searchRelationsWithFilter = _a.searchRelationsWithFilter, showSnackbarMessage = _a.showSnackbarMessage;
|
|
39
39
|
var _c = (0, react_1.useState)(false), isLoading = _c[0], setIsLoading = _c[1];
|
|
40
40
|
var relationsLoaded = (0, MdmModuleContext_1.useMdmAction)('relationsLoaded');
|
|
41
41
|
var tenant = (0, MdmModuleContext_1.useMdmTenant)();
|
|
@@ -56,17 +56,24 @@ var useRelationsLoader = function (_a) {
|
|
|
56
56
|
var suggested = config.suggested;
|
|
57
57
|
var options = (0, react_1.useMemo)(function () { return ({
|
|
58
58
|
searchByOv: searchByOv,
|
|
59
|
-
sendMasked: (0, mdm_sdk_1.hasRelationMasking)(metadata) && mode === mdm_sdk_1.Mode.Viewing
|
|
60
|
-
|
|
59
|
+
sendMasked: (0, mdm_sdk_1.hasRelationMasking)(metadata) && mode === mdm_sdk_1.Mode.Viewing,
|
|
60
|
+
searchRelationsWithFilter: searchRelationsWithFilter
|
|
61
|
+
}); }, [searchByOv, metadata, mode, searchRelationsWithFilter]);
|
|
62
|
+
var filters = (0, react_1.useMemo)(function () {
|
|
63
|
+
var _a;
|
|
64
|
+
return (_a = {},
|
|
65
|
+
_a[searchRelationsWithFilter ? 'relationFilter' : 'filter'] = (0, mdm_sdk_1.addGlobalFilterToQuery)(globalFilter, filter) || undefined,
|
|
66
|
+
_a);
|
|
67
|
+
}, [searchRelationsWithFilter, globalFilter, filter]);
|
|
61
68
|
var modeRef = (0, react_1.useRef)(mode);
|
|
62
69
|
modeRef.current = mode;
|
|
63
70
|
var loadRelations = (0, react_1.useCallback)(function () {
|
|
64
71
|
if (entity === null || entity === void 0 ? void 0 : entity.uri) {
|
|
65
72
|
var processedConfig = processContent(config.content);
|
|
66
|
-
var requestConfig_1 = __assign(__assign({}, processedConfig), { sortBy: sorting === null || sorting === void 0 ? void 0 : sorting.field, order: sorting === null || sorting === void 0 ? void 0 : sorting.order, returnDates: true, returnObjects: true, activeness: {
|
|
73
|
+
var requestConfig_1 = __assign(__assign(__assign({}, processedConfig), { sortBy: sorting === null || sorting === void 0 ? void 0 : sorting.field, order: sorting === null || sorting === void 0 ? void 0 : sorting.order, returnDates: true, returnObjects: true, activeness: {
|
|
67
74
|
relation: relationActivityFilter || mdm_sdk_1.ActivityFilter.ALL,
|
|
68
75
|
entity: activityFilter
|
|
69
|
-
}, max: rowsPerPage, offset: page * rowsPerPage,
|
|
76
|
+
}, max: rowsPerPage, offset: page * rowsPerPage, suggested: buildSuggestedIds(suggested) }), filters);
|
|
70
77
|
var configs_1 = [requestConfig_1].concat((0, ramda_1.ifElse)(ramda_1.identity, (0, ramda_1.pipe)(mdm_sdk_1.wrapInArrayIfNeeded, function (suggested) {
|
|
71
78
|
return suggested.map(function (config, i) { return (__assign(__assign({}, config), { id: requestConfig_1.suggested[i] })); });
|
|
72
79
|
}), (0, ramda_1.always)([]))(suggested));
|
|
@@ -62,10 +62,9 @@ export var ResizablePanes = function (_a) {
|
|
|
62
62
|
useEffect(function () {
|
|
63
63
|
actualizeSizes();
|
|
64
64
|
}, [actualizeSizes, percentageMaxSize, percentageMinSize]);
|
|
65
|
-
var handleChange = useCallback(debounce(function (size) {
|
|
66
|
-
if (size === undefined)
|
|
65
|
+
var handleChange = useCallback(debounce(function (size, containerSize) {
|
|
66
|
+
if (size === undefined || containerSize === 0)
|
|
67
67
|
return;
|
|
68
|
-
var containerSize = getContainerSize();
|
|
69
68
|
onChange({
|
|
70
69
|
percentageSize: size + '%',
|
|
71
70
|
isMaxSize: +percentageMaxSize > 0
|
|
@@ -74,7 +73,7 @@ export var ResizablePanes = function (_a) {
|
|
|
74
73
|
isMinSize: isEqualSize(size, percentageMinSize),
|
|
75
74
|
size: Math.round((size * containerSize) / 100)
|
|
76
75
|
});
|
|
77
|
-
}, debounceInterval), [onChange, percentageMaxSize, percentageMinSize
|
|
76
|
+
}, debounceInterval), [onChange, percentageMaxSize, percentageMinSize]);
|
|
78
77
|
var handleDragging = useCallback(function (isDragging) {
|
|
79
78
|
if (isDragging) {
|
|
80
79
|
// Why do we need handleChange() here?
|
|
@@ -84,10 +83,10 @@ export var ResizablePanes = function (_a) {
|
|
|
84
83
|
disableAnimation();
|
|
85
84
|
}
|
|
86
85
|
else {
|
|
87
|
-
handleChange(panelRef.current.getSize());
|
|
86
|
+
handleChange(panelRef.current.getSize(), getContainerSize());
|
|
88
87
|
enableAnimation();
|
|
89
88
|
}
|
|
90
|
-
}, [disableAnimation, enableAnimation, handleChange]);
|
|
89
|
+
}, [disableAnimation, enableAnimation, handleChange, getContainerSize]);
|
|
91
90
|
var paneAnimationStyle = useMemo(function () { return ({
|
|
92
91
|
transition: theme.transitions.create('flex', {
|
|
93
92
|
easing: theme.transitions.easing.sharp,
|
|
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import React from 'react';
|
|
24
|
-
import { propEq } from 'ramda';
|
|
24
|
+
import { propEq, identity } from 'ramda';
|
|
25
25
|
import { DataTypes, buildFilterQueryString, Maybe } from '@reltio/mdm-sdk';
|
|
26
26
|
var BLOB_HEIGHT = 100;
|
|
27
27
|
var IMAGE_HEIGHT = 64;
|
|
@@ -57,11 +57,13 @@ export var columnFilterToMdmFilter = function (columnData, columnFilter) {
|
|
|
57
57
|
export var buildColumnsFilter = function (columnsData, filters) {
|
|
58
58
|
return Maybe.fromNull(filters)
|
|
59
59
|
.map(function (filters) {
|
|
60
|
-
return Object.entries(filters)
|
|
60
|
+
return Object.entries(filters)
|
|
61
|
+
.map(function (_a) {
|
|
61
62
|
var columnId = _a[0], columnFilter = _a[1];
|
|
62
63
|
var columnData = columnsData.find(propEq('id', columnId));
|
|
63
|
-
return columnFilterToMdmFilter(columnData, columnFilter);
|
|
64
|
-
})
|
|
64
|
+
return columnData && columnFilterToMdmFilter(columnData, columnFilter);
|
|
65
|
+
})
|
|
66
|
+
.filter(identity);
|
|
65
67
|
})
|
|
66
68
|
.map(buildFilterQueryString())
|
|
67
69
|
.orSome('');
|
|
@@ -12,9 +12,10 @@ type Props = {
|
|
|
12
12
|
relationActivityFilter?: ActivityFilter;
|
|
13
13
|
mode: Mode;
|
|
14
14
|
searchByOv?: boolean;
|
|
15
|
+
searchRelationsWithFilter?: boolean;
|
|
15
16
|
showSnackbarMessage?: (message: string) => void;
|
|
16
17
|
};
|
|
17
|
-
export declare const useRelationsLoader: ({ sorting, filter, page, rowsPerPage, config, entity, relationActivityFilter, mode, searchByOv, showSnackbarMessage }: Props) => {
|
|
18
|
+
export declare const useRelationsLoader: ({ sorting, filter, page, rowsPerPage, config, entity, relationActivityFilter, mode, searchByOv, searchRelationsWithFilter, showSnackbarMessage }: Props) => {
|
|
18
19
|
isLoading: boolean;
|
|
19
20
|
reload: () => void;
|
|
20
21
|
};
|
|
@@ -29,7 +29,7 @@ var isValidRequestConfig = function (config) {
|
|
|
29
29
|
return true;
|
|
30
30
|
};
|
|
31
31
|
export var useRelationsLoader = function (_a) {
|
|
32
|
-
var sorting = _a.sorting, filter = _a.filter, page = _a.page, rowsPerPage = _a.rowsPerPage, config = _a.config, entity = _a.entity, relationActivityFilter = _a.relationActivityFilter, mode = _a.mode, _b = _a.searchByOv, searchByOv = _b === void 0 ? false : _b, showSnackbarMessage = _a.showSnackbarMessage;
|
|
32
|
+
var sorting = _a.sorting, filter = _a.filter, page = _a.page, rowsPerPage = _a.rowsPerPage, config = _a.config, entity = _a.entity, relationActivityFilter = _a.relationActivityFilter, mode = _a.mode, _b = _a.searchByOv, searchByOv = _b === void 0 ? false : _b, searchRelationsWithFilter = _a.searchRelationsWithFilter, showSnackbarMessage = _a.showSnackbarMessage;
|
|
33
33
|
var _c = useState(false), isLoading = _c[0], setIsLoading = _c[1];
|
|
34
34
|
var relationsLoaded = useMdmAction('relationsLoaded');
|
|
35
35
|
var tenant = useMdmTenant();
|
|
@@ -50,17 +50,24 @@ export var useRelationsLoader = function (_a) {
|
|
|
50
50
|
var suggested = config.suggested;
|
|
51
51
|
var options = useMemo(function () { return ({
|
|
52
52
|
searchByOv: searchByOv,
|
|
53
|
-
sendMasked: hasRelationMasking(metadata) && mode === Mode.Viewing
|
|
54
|
-
|
|
53
|
+
sendMasked: hasRelationMasking(metadata) && mode === Mode.Viewing,
|
|
54
|
+
searchRelationsWithFilter: searchRelationsWithFilter
|
|
55
|
+
}); }, [searchByOv, metadata, mode, searchRelationsWithFilter]);
|
|
56
|
+
var filters = useMemo(function () {
|
|
57
|
+
var _a;
|
|
58
|
+
return (_a = {},
|
|
59
|
+
_a[searchRelationsWithFilter ? 'relationFilter' : 'filter'] = addGlobalFilterToQuery(globalFilter, filter) || undefined,
|
|
60
|
+
_a);
|
|
61
|
+
}, [searchRelationsWithFilter, globalFilter, filter]);
|
|
55
62
|
var modeRef = useRef(mode);
|
|
56
63
|
modeRef.current = mode;
|
|
57
64
|
var loadRelations = useCallback(function () {
|
|
58
65
|
if (entity === null || entity === void 0 ? void 0 : entity.uri) {
|
|
59
66
|
var processedConfig = processContent(config.content);
|
|
60
|
-
var requestConfig_1 = __assign(__assign({}, processedConfig), { sortBy: sorting === null || sorting === void 0 ? void 0 : sorting.field, order: sorting === null || sorting === void 0 ? void 0 : sorting.order, returnDates: true, returnObjects: true, activeness: {
|
|
67
|
+
var requestConfig_1 = __assign(__assign(__assign({}, processedConfig), { sortBy: sorting === null || sorting === void 0 ? void 0 : sorting.field, order: sorting === null || sorting === void 0 ? void 0 : sorting.order, returnDates: true, returnObjects: true, activeness: {
|
|
61
68
|
relation: relationActivityFilter || ActivityFilter.ALL,
|
|
62
69
|
entity: activityFilter
|
|
63
|
-
}, max: rowsPerPage, offset: page * rowsPerPage,
|
|
70
|
+
}, max: rowsPerPage, offset: page * rowsPerPage, suggested: buildSuggestedIds(suggested) }), filters);
|
|
64
71
|
var configs_1 = [requestConfig_1].concat(ifElse(identity, pipe(wrapInArrayIfNeeded, function (suggested) {
|
|
65
72
|
return suggested.map(function (config, i) { return (__assign(__assign({}, config), { id: requestConfig_1.suggested[i] })); });
|
|
66
73
|
}), always([]))(suggested));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1997",
|
|
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
|
"@fluentui/react-context-selector": "^9.1.26",
|
|
9
9
|
"@react-google-maps/api": "2.7.0",
|
|
10
10
|
"@react-sigma/core": "3.4.0",
|
|
11
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1890",
|
|
12
12
|
"d3-cloud": "^1.2.5",
|
|
13
13
|
"d3-geo": "^2.0.1",
|
|
14
14
|
"d3-hierarchy": "^2.0.0",
|