@reltio/components 1.4.1649 → 1.4.1650
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/attributes/PivotingAttributes/PivotingTooltip.js +7 -1
- package/cjs/components/attributes/PivotingAttributes/PivotingTooltipContent.d.ts +5 -5
- package/cjs/components/attributes/PivotingAttributes/PivotingTooltipContent.js +4 -60
- package/cjs/hooks/usePivotingDataLoader/usePivotingDataLoader.d.ts +14 -0
- package/cjs/hooks/usePivotingDataLoader/usePivotingDataLoader.js +44 -0
- package/esm/components/attributes/PivotingAttributes/PivotingTooltip.js +7 -1
- package/esm/components/attributes/PivotingAttributes/PivotingTooltipContent.d.ts +5 -5
- package/esm/components/attributes/PivotingAttributes/PivotingTooltipContent.js +4 -37
- package/esm/hooks/usePivotingDataLoader/usePivotingDataLoader.d.ts +14 -0
- package/esm/hooks/usePivotingDataLoader/usePivotingDataLoader.js +40 -0
- package/package.json +2 -2
|
@@ -32,6 +32,7 @@ var Tooltip_1 = __importDefault(require("@mui/material/Tooltip"));
|
|
|
32
32
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
33
33
|
var ramda_1 = require("ramda");
|
|
34
34
|
var contexts_1 = require("../../../contexts");
|
|
35
|
+
var usePivotingDataLoader_1 = require("../../../hooks/usePivotingDataLoader/usePivotingDataLoader");
|
|
35
36
|
var helpers_1 = require("./helpers");
|
|
36
37
|
var PivotingIcon_1 = __importDefault(require("../../../icons/PivotingIcon"));
|
|
37
38
|
var PivotingTooltipContent_1 = require("./PivotingTooltipContent");
|
|
@@ -67,7 +68,12 @@ var PivotingTooltip = function (_a) {
|
|
|
67
68
|
var handleSeeAllClick = function () {
|
|
68
69
|
openPivotingPerspective({ value: generatedValue, attributeType: attributeType });
|
|
69
70
|
};
|
|
70
|
-
|
|
71
|
+
var _b = (0, usePivotingDataLoader_1.usePivotingDataLoader)({
|
|
72
|
+
value: pivotingValue,
|
|
73
|
+
attributeType: attributeType,
|
|
74
|
+
config: pivotingAttribute === null || pivotingAttribute === void 0 ? void 0 : pivotingAttribute.popup
|
|
75
|
+
}), entities = _b.entities, total = _b.total, loadPivotingData = _b.loadPivotingData;
|
|
76
|
+
return isPivotingAttribute ? (react_1.default.createElement(Tooltip_1.default, { arrow: true, placement: "right-start", classes: styles, disableInteractive: false, onOpen: loadPivotingData, title: react_1.default.createElement(PivotingTooltipContent_1.PivotingTooltipContent, { generatedValue: generatedValue, attributeType: attributeType, config: pivotingAttribute.popup, onSeeAllClick: handleSeeAllClick, entities: entities, total: total }) },
|
|
71
77
|
react_1.default.createElement("span", { className: className },
|
|
72
78
|
react_1.default.createElement(PivotingIcon_1.default, { className: contentStyles.icon }),
|
|
73
79
|
react_1.default.createElement(PivotingUriLink_1.default, { onClick: handleSeeAllClick, className: contentStyles.content, value: generatedValue, attributeType: attributeType }, children)))) : (react_1.default.createElement(react_1.default.Fragment, null, children));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AttributeType,
|
|
2
|
+
import { AttributeType, Entity, PivotingValue } from '@reltio/mdm-sdk';
|
|
3
3
|
export type Props = {
|
|
4
|
-
value: PivotingValue[] | PrimitiveValue;
|
|
5
|
-
generatedValue: PivotingValue[];
|
|
6
4
|
attributeType: AttributeType;
|
|
7
5
|
config: {
|
|
8
6
|
label?: string;
|
|
9
|
-
entityType?: string;
|
|
10
7
|
};
|
|
8
|
+
entities: Entity[];
|
|
9
|
+
generatedValue: PivotingValue[];
|
|
11
10
|
onSeeAllClick: () => void;
|
|
11
|
+
total: number;
|
|
12
12
|
};
|
|
13
|
-
export declare const PivotingTooltipContent: ({
|
|
13
|
+
export declare const PivotingTooltipContent: ({ attributeType, config, entities, generatedValue, onSeeAllClick, total }: Props) => JSX.Element;
|
|
@@ -1,77 +1,21 @@
|
|
|
1
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
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
4
|
};
|
|
39
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
6
|
exports.PivotingTooltipContent = void 0;
|
|
41
|
-
var react_1 =
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
42
8
|
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
43
9
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
44
10
|
var EntityAvatar_1 = __importDefault(require("../../EntityAvatar/EntityAvatar"));
|
|
45
11
|
var EntityUriLink_1 = __importDefault(require("../../EntityUriLink/EntityUriLink"));
|
|
46
12
|
var PivotingUriLink_1 = __importDefault(require("../../PivotingUriLink/PivotingUriLink"));
|
|
47
|
-
var
|
|
48
|
-
var contexts_1 = require("../../../contexts");
|
|
13
|
+
var usePivotingDataLoader_1 = require("../../../hooks/usePivotingDataLoader/usePivotingDataLoader");
|
|
49
14
|
var styles_1 = require("./styles");
|
|
50
|
-
var MAX_ENTITIES_PIVOTING_TOOLTIP = 6;
|
|
51
15
|
var PivotingTooltipContent = function (_a) {
|
|
52
|
-
var
|
|
53
|
-
var _c = (0, react_1.useState)([]), entities = _c[0], setEntities = _c[1];
|
|
54
|
-
var _d = (0, react_1.useState)(0), total = _d[0], setTotal = _d[1];
|
|
55
|
-
var safePromise = (0, hooks_1.useSafePromise)();
|
|
16
|
+
var attributeType = _a.attributeType, _b = _a.config, config = _b === void 0 ? {} : _b, entities = _a.entities, generatedValue = _a.generatedValue, onSeeAllClick = _a.onSeeAllClick, total = _a.total;
|
|
56
17
|
var styles = (0, styles_1.useStyles)();
|
|
57
|
-
var
|
|
58
|
-
var globalSearchRequestOptions = (0, contexts_1.useMdmGlobalSearchRequestOptions)() || {};
|
|
59
|
-
var entityType = config.entityType || entity.type;
|
|
60
|
-
var shouldShowSeeAllButton = total > MAX_ENTITIES_PIVOTING_TOOLTIP;
|
|
61
|
-
(0, react_1.useEffect)(function () {
|
|
62
|
-
var filters = (0, mdm_sdk_1.convertPivotingValueToSearchFilters)({ value: value, attributeType: attributeType, entityType: entityType });
|
|
63
|
-
var options = __assign({ max: MAX_ENTITIES_PIVOTING_TOOLTIP }, globalSearchRequestOptions);
|
|
64
|
-
safePromise(Promise.all([(0, mdm_sdk_1.getFilteredEntities)(filters, options), (0, mdm_sdk_1.getTotals)(filters, options)]))
|
|
65
|
-
.then(function (results) {
|
|
66
|
-
var entities = results[0], total = results[1].total;
|
|
67
|
-
setEntities(Array.isArray(entities) ? entities : []);
|
|
68
|
-
setTotal(total);
|
|
69
|
-
})
|
|
70
|
-
.catch(function () {
|
|
71
|
-
setEntities([]);
|
|
72
|
-
setTotal(0);
|
|
73
|
-
});
|
|
74
|
-
}, []);
|
|
18
|
+
var shouldShowSeeAllButton = total > usePivotingDataLoader_1.MAX_ENTITIES_PIVOTING_TOOLTIP;
|
|
75
19
|
var hasEntityTypeLabel = Boolean(config.label);
|
|
76
20
|
return (react_1.default.createElement("div", { className: styles.container },
|
|
77
21
|
react_1.default.createElement("div", { className: styles.header },
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AttributeType, Entity, PivotingValue, PrimitiveValue } from '@reltio/mdm-sdk';
|
|
2
|
+
export declare const MAX_ENTITIES_PIVOTING_TOOLTIP = 6;
|
|
3
|
+
export type Props = {
|
|
4
|
+
value: PivotingValue[] | PrimitiveValue;
|
|
5
|
+
attributeType: AttributeType;
|
|
6
|
+
config: {
|
|
7
|
+
entityType?: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare const usePivotingDataLoader: ({ value, attributeType, config }: Props) => {
|
|
11
|
+
entities: Entity[];
|
|
12
|
+
total: number;
|
|
13
|
+
loadPivotingData: () => void;
|
|
14
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.usePivotingDataLoader = exports.MAX_ENTITIES_PIVOTING_TOOLTIP = void 0;
|
|
15
|
+
var react_1 = require("react");
|
|
16
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
17
|
+
var contexts_1 = require("../../contexts");
|
|
18
|
+
var useSafePromise_1 = require("../useSafePromise");
|
|
19
|
+
exports.MAX_ENTITIES_PIVOTING_TOOLTIP = 6;
|
|
20
|
+
var usePivotingDataLoader = function (_a) {
|
|
21
|
+
var value = _a.value, attributeType = _a.attributeType, _b = _a.config, config = _b === void 0 ? {} : _b;
|
|
22
|
+
var _c = (0, react_1.useState)([]), entities = _c[0], setEntities = _c[1];
|
|
23
|
+
var _d = (0, react_1.useState)(0), total = _d[0], setTotal = _d[1];
|
|
24
|
+
var safePromise = (0, useSafePromise_1.useSafePromise)();
|
|
25
|
+
var entity = (0, contexts_1.useMdmEntity)() || {};
|
|
26
|
+
var globalSearchRequestOptions = (0, contexts_1.useMdmGlobalSearchRequestOptions)();
|
|
27
|
+
var entityType = config.entityType || entity.type;
|
|
28
|
+
var filters = (0, react_1.useMemo)(function () { return (0, mdm_sdk_1.convertPivotingValueToSearchFilters)({ value: value, attributeType: attributeType, entityType: entityType }); }, [attributeType, entityType, value]);
|
|
29
|
+
var options = (0, react_1.useMemo)(function () { return (__assign({ max: exports.MAX_ENTITIES_PIVOTING_TOOLTIP, sort: 'label' }, (globalSearchRequestOptions || {}))); }, [globalSearchRequestOptions]);
|
|
30
|
+
var loadPivotingData = (0, react_1.useCallback)(function () {
|
|
31
|
+
safePromise(Promise.all([(0, mdm_sdk_1.getFilteredEntities)(filters, options), (0, mdm_sdk_1.getTotals)(filters, options)]))
|
|
32
|
+
.then(function (results) {
|
|
33
|
+
var entities = results[0], total = results[1].total;
|
|
34
|
+
setEntities(Array.isArray(entities) ? entities : []);
|
|
35
|
+
setTotal(total);
|
|
36
|
+
})
|
|
37
|
+
.catch(function () {
|
|
38
|
+
setEntities([]);
|
|
39
|
+
setTotal(0);
|
|
40
|
+
});
|
|
41
|
+
}, [filters, options, safePromise]);
|
|
42
|
+
return { entities: entities, total: total, loadPivotingData: loadPivotingData };
|
|
43
|
+
};
|
|
44
|
+
exports.usePivotingDataLoader = usePivotingDataLoader;
|
|
@@ -3,6 +3,7 @@ import Tooltip from '@mui/material/Tooltip';
|
|
|
3
3
|
import { isNested } from '@reltio/mdm-sdk';
|
|
4
4
|
import { isNil } from 'ramda';
|
|
5
5
|
import { PivotingAttributeContext, useMdmAction, useMdmMetadata } from '../../../contexts';
|
|
6
|
+
import { usePivotingDataLoader } from '../../../hooks/usePivotingDataLoader/usePivotingDataLoader';
|
|
6
7
|
import { convertNestedAttributePivotingValue, convertSimpleAttributePivotingValue, generatePivotingValue, preparePivotingAttributeValue } from './helpers';
|
|
7
8
|
import PivotingIcon from '../../../icons/PivotingIcon';
|
|
8
9
|
import { PivotingTooltipContent } from './PivotingTooltipContent';
|
|
@@ -38,7 +39,12 @@ export var PivotingTooltip = function (_a) {
|
|
|
38
39
|
var handleSeeAllClick = function () {
|
|
39
40
|
openPivotingPerspective({ value: generatedValue, attributeType: attributeType });
|
|
40
41
|
};
|
|
41
|
-
|
|
42
|
+
var _b = usePivotingDataLoader({
|
|
43
|
+
value: pivotingValue,
|
|
44
|
+
attributeType: attributeType,
|
|
45
|
+
config: pivotingAttribute === null || pivotingAttribute === void 0 ? void 0 : pivotingAttribute.popup
|
|
46
|
+
}), entities = _b.entities, total = _b.total, loadPivotingData = _b.loadPivotingData;
|
|
47
|
+
return isPivotingAttribute ? (React.createElement(Tooltip, { arrow: true, placement: "right-start", classes: styles, disableInteractive: false, onOpen: loadPivotingData, title: React.createElement(PivotingTooltipContent, { generatedValue: generatedValue, attributeType: attributeType, config: pivotingAttribute.popup, onSeeAllClick: handleSeeAllClick, entities: entities, total: total }) },
|
|
42
48
|
React.createElement("span", { className: className },
|
|
43
49
|
React.createElement(PivotingIcon, { className: contentStyles.icon }),
|
|
44
50
|
React.createElement(PivotingUriLink, { onClick: handleSeeAllClick, className: contentStyles.content, value: generatedValue, attributeType: attributeType }, children)))) : (React.createElement(React.Fragment, null, children));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AttributeType,
|
|
2
|
+
import { AttributeType, Entity, PivotingValue } from '@reltio/mdm-sdk';
|
|
3
3
|
export type Props = {
|
|
4
|
-
value: PivotingValue[] | PrimitiveValue;
|
|
5
|
-
generatedValue: PivotingValue[];
|
|
6
4
|
attributeType: AttributeType;
|
|
7
5
|
config: {
|
|
8
6
|
label?: string;
|
|
9
|
-
entityType?: string;
|
|
10
7
|
};
|
|
8
|
+
entities: Entity[];
|
|
9
|
+
generatedValue: PivotingValue[];
|
|
11
10
|
onSeeAllClick: () => void;
|
|
11
|
+
total: number;
|
|
12
12
|
};
|
|
13
|
-
export declare const PivotingTooltipContent: ({
|
|
13
|
+
export declare const PivotingTooltipContent: ({ attributeType, config, entities, generatedValue, onSeeAllClick, total }: Props) => JSX.Element;
|
|
@@ -1,48 +1,15 @@
|
|
|
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, { useEffect, useState } from 'react';
|
|
1
|
+
import React from 'react';
|
|
13
2
|
import i18n from 'ui-i18n';
|
|
14
|
-
import { getEntityUriForLink,
|
|
3
|
+
import { getEntityUriForLink, getLabel } from '@reltio/mdm-sdk';
|
|
15
4
|
import EntityAvatar from '../../EntityAvatar/EntityAvatar';
|
|
16
5
|
import EntityUriLink from '../../EntityUriLink/EntityUriLink';
|
|
17
6
|
import PivotingUriLink from '../../PivotingUriLink/PivotingUriLink';
|
|
18
|
-
import {
|
|
19
|
-
import { useMdmEntity, useMdmGlobalSearchRequestOptions } from '../../../contexts';
|
|
7
|
+
import { MAX_ENTITIES_PIVOTING_TOOLTIP } from '../../../hooks/usePivotingDataLoader/usePivotingDataLoader';
|
|
20
8
|
import { useStyles } from './styles';
|
|
21
|
-
var MAX_ENTITIES_PIVOTING_TOOLTIP = 6;
|
|
22
9
|
export var PivotingTooltipContent = function (_a) {
|
|
23
|
-
var
|
|
24
|
-
var _c = useState([]), entities = _c[0], setEntities = _c[1];
|
|
25
|
-
var _d = useState(0), total = _d[0], setTotal = _d[1];
|
|
26
|
-
var safePromise = useSafePromise();
|
|
10
|
+
var attributeType = _a.attributeType, _b = _a.config, config = _b === void 0 ? {} : _b, entities = _a.entities, generatedValue = _a.generatedValue, onSeeAllClick = _a.onSeeAllClick, total = _a.total;
|
|
27
11
|
var styles = useStyles();
|
|
28
|
-
var entity = useMdmEntity() || {};
|
|
29
|
-
var globalSearchRequestOptions = useMdmGlobalSearchRequestOptions() || {};
|
|
30
|
-
var entityType = config.entityType || entity.type;
|
|
31
12
|
var shouldShowSeeAllButton = total > MAX_ENTITIES_PIVOTING_TOOLTIP;
|
|
32
|
-
useEffect(function () {
|
|
33
|
-
var filters = convertPivotingValueToSearchFilters({ value: value, attributeType: attributeType, entityType: entityType });
|
|
34
|
-
var options = __assign({ max: MAX_ENTITIES_PIVOTING_TOOLTIP }, globalSearchRequestOptions);
|
|
35
|
-
safePromise(Promise.all([getFilteredEntities(filters, options), getTotals(filters, options)]))
|
|
36
|
-
.then(function (results) {
|
|
37
|
-
var entities = results[0], total = results[1].total;
|
|
38
|
-
setEntities(Array.isArray(entities) ? entities : []);
|
|
39
|
-
setTotal(total);
|
|
40
|
-
})
|
|
41
|
-
.catch(function () {
|
|
42
|
-
setEntities([]);
|
|
43
|
-
setTotal(0);
|
|
44
|
-
});
|
|
45
|
-
}, []);
|
|
46
13
|
var hasEntityTypeLabel = Boolean(config.label);
|
|
47
14
|
return (React.createElement("div", { className: styles.container },
|
|
48
15
|
React.createElement("div", { className: styles.header },
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AttributeType, Entity, PivotingValue, PrimitiveValue } from '@reltio/mdm-sdk';
|
|
2
|
+
export declare const MAX_ENTITIES_PIVOTING_TOOLTIP = 6;
|
|
3
|
+
export type Props = {
|
|
4
|
+
value: PivotingValue[] | PrimitiveValue;
|
|
5
|
+
attributeType: AttributeType;
|
|
6
|
+
config: {
|
|
7
|
+
entityType?: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare const usePivotingDataLoader: ({ value, attributeType, config }: Props) => {
|
|
11
|
+
entities: Entity[];
|
|
12
|
+
total: number;
|
|
13
|
+
loadPivotingData: () => void;
|
|
14
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
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 { useCallback, useState, useMemo } from 'react';
|
|
13
|
+
import { convertPivotingValueToSearchFilters, getFilteredEntities, getTotals } from '@reltio/mdm-sdk';
|
|
14
|
+
import { useMdmEntity, useMdmGlobalSearchRequestOptions } from '../../contexts';
|
|
15
|
+
import { useSafePromise } from '../useSafePromise';
|
|
16
|
+
export var MAX_ENTITIES_PIVOTING_TOOLTIP = 6;
|
|
17
|
+
export var usePivotingDataLoader = function (_a) {
|
|
18
|
+
var value = _a.value, attributeType = _a.attributeType, _b = _a.config, config = _b === void 0 ? {} : _b;
|
|
19
|
+
var _c = useState([]), entities = _c[0], setEntities = _c[1];
|
|
20
|
+
var _d = useState(0), total = _d[0], setTotal = _d[1];
|
|
21
|
+
var safePromise = useSafePromise();
|
|
22
|
+
var entity = useMdmEntity() || {};
|
|
23
|
+
var globalSearchRequestOptions = useMdmGlobalSearchRequestOptions();
|
|
24
|
+
var entityType = config.entityType || entity.type;
|
|
25
|
+
var filters = useMemo(function () { return convertPivotingValueToSearchFilters({ value: value, attributeType: attributeType, entityType: entityType }); }, [attributeType, entityType, value]);
|
|
26
|
+
var options = useMemo(function () { return (__assign({ max: MAX_ENTITIES_PIVOTING_TOOLTIP, sort: 'label' }, (globalSearchRequestOptions || {}))); }, [globalSearchRequestOptions]);
|
|
27
|
+
var loadPivotingData = useCallback(function () {
|
|
28
|
+
safePromise(Promise.all([getFilteredEntities(filters, options), getTotals(filters, options)]))
|
|
29
|
+
.then(function (results) {
|
|
30
|
+
var entities = results[0], total = results[1].total;
|
|
31
|
+
setEntities(Array.isArray(entities) ? entities : []);
|
|
32
|
+
setTotal(total);
|
|
33
|
+
})
|
|
34
|
+
.catch(function () {
|
|
35
|
+
setEntities([]);
|
|
36
|
+
setTotal(0);
|
|
37
|
+
});
|
|
38
|
+
}, [filters, options, safePromise]);
|
|
39
|
+
return { entities: entities, total: total, loadPivotingData: loadPivotingData };
|
|
40
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1650",
|
|
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.1650",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|