@reltio/components 1.4.1957 → 1.4.1959
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/RCTree/RCTree.d.ts +3 -2
- package/cjs/RCTree/RCTree.js +10 -4
- package/cjs/RCTree/helper.js +1 -3
- package/cjs/RCTree/styles.js +2 -2
- package/cjs/UpSetChart/UpSetChart.js +3 -38
- package/esm/RCTree/RCTree.d.ts +3 -2
- package/esm/RCTree/RCTree.js +10 -4
- package/esm/RCTree/helper.js +1 -3
- package/esm/RCTree/styles.js +2 -2
- package/esm/UpSetChart/UpSetChart.js +3 -15
- package/package.json +1 -5
- package/cjs/UpSetChart/UpSetChart.test.d.ts +0 -1
- package/cjs/UpSetChart/UpSetChart.test.js +0 -67
- package/esm/UpSetChart/UpSetChart.test.d.ts +0 -1
- package/esm/UpSetChart/UpSetChart.test.js +0 -62
package/cjs/RCTree/RCTree.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { TreeNodeProps } from 'rc-tree';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { RCTreeNode } from './types';
|
|
4
4
|
type Props = {
|
|
5
5
|
treeData: RCTreeNode[];
|
|
@@ -14,7 +14,8 @@ type Props = {
|
|
|
14
14
|
className?: string;
|
|
15
15
|
minItemHeight?: number;
|
|
16
16
|
isLeaf?: (node: TreeNodeProps & Record<string, unknown>) => boolean;
|
|
17
|
+
scrollToNode?: RCTreeNode;
|
|
17
18
|
onChange?: (node: RCTreeNode[]) => void;
|
|
18
19
|
};
|
|
19
|
-
export declare const RCTree: ({ treeData, isVirtualized, canDrag, canDrop, onLoadChildren, height, defaultExpandAll, SwitchRenderer, className, renderNode, minItemHeight, isLeaf,
|
|
20
|
+
export declare const RCTree: ({ treeData, isVirtualized, canDrag, canDrop, onLoadChildren, height, defaultExpandAll, SwitchRenderer, className, renderNode, minItemHeight, isLeaf, scrollToNode, onChange }: Props) => React.JSX.Element;
|
|
20
21
|
export {};
|
package/cjs/RCTree/RCTree.js
CHANGED
|
@@ -27,18 +27,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.RCTree = void 0;
|
|
30
|
-
var
|
|
30
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
31
31
|
var ramda_1 = require("ramda");
|
|
32
32
|
var rc_tree_1 = __importDefault(require("rc-tree"));
|
|
33
|
-
var
|
|
33
|
+
var react_1 = __importStar(require("react"));
|
|
34
34
|
var DefaultSwitchRenderer_1 = require("./DefaultSwitchRenderer");
|
|
35
35
|
var helper_1 = require("./helper");
|
|
36
36
|
var styles_1 = require("./styles");
|
|
37
37
|
var MIN_ROW_HEIGHT = 28;
|
|
38
38
|
var RCTree = function (_a) {
|
|
39
|
-
var treeData = _a.treeData, _b = _a.isVirtualized, isVirtualized = _b === void 0 ? true : _b, _c = _a.canDrag, canDrag = _c === void 0 ? false : _c, _d = _a.canDrop, canDrop = _d === void 0 ? function () { return false; } : _d, onLoadChildren = _a.onLoadChildren, height = _a.height, _e = _a.defaultExpandAll, defaultExpandAll = _e === void 0 ? false : _e, _f = _a.SwitchRenderer, SwitchRenderer = _f === void 0 ? DefaultSwitchRenderer_1.DefaultSwitchRenderer : _f, className = _a.className, renderNode = _a.renderNode, _g = _a.minItemHeight, minItemHeight = _g === void 0 ? MIN_ROW_HEIGHT : _g, _h = _a.isLeaf, isLeaf = _h === void 0 ? helper_1.defaultIsLeaf : _h, _j = _a.onChange, onChange = _j === void 0 ? ramda_1.identity : _j;
|
|
39
|
+
var treeData = _a.treeData, _b = _a.isVirtualized, isVirtualized = _b === void 0 ? true : _b, _c = _a.canDrag, canDrag = _c === void 0 ? false : _c, _d = _a.canDrop, canDrop = _d === void 0 ? function () { return false; } : _d, onLoadChildren = _a.onLoadChildren, height = _a.height, _e = _a.defaultExpandAll, defaultExpandAll = _e === void 0 ? false : _e, _f = _a.SwitchRenderer, SwitchRenderer = _f === void 0 ? DefaultSwitchRenderer_1.DefaultSwitchRenderer : _f, className = _a.className, renderNode = _a.renderNode, _g = _a.minItemHeight, minItemHeight = _g === void 0 ? MIN_ROW_HEIGHT : _g, _h = _a.isLeaf, isLeaf = _h === void 0 ? helper_1.defaultIsLeaf : _h, scrollToNode = _a.scrollToNode, _j = _a.onChange, onChange = _j === void 0 ? ramda_1.identity : _j;
|
|
40
40
|
var styles = (0, styles_1.useStyles)();
|
|
41
41
|
var internalTreeData = (0, react_1.useMemo)(function () { return (0, helper_1.convertTreeData)({ data: treeData, isLeaf: isLeaf }); }, [isLeaf, treeData]);
|
|
42
|
+
var treeRef = (0, react_1.useRef)(null);
|
|
43
|
+
(0, react_1.useEffect)(function () {
|
|
44
|
+
if (treeRef.current && scrollToNode) {
|
|
45
|
+
treeRef.current.scrollTo({ key: String(scrollToNode.nodeId) });
|
|
46
|
+
}
|
|
47
|
+
}, [scrollToNode]);
|
|
42
48
|
// eslint-disable-next-line no-unused-vars
|
|
43
49
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
44
50
|
var handleDrop = function (_a) {
|
|
@@ -69,6 +75,6 @@ var RCTree = function (_a) {
|
|
|
69
75
|
return (0, helper_1.getExpandedKeys)(treeData);
|
|
70
76
|
}, [treeData]);
|
|
71
77
|
var renderSwitcherIcon = (0, react_1.useCallback)(function (node) { return react_1.default.createElement(SwitchRenderer, { node: node }); }, []);
|
|
72
|
-
return internalTreeData ? (react_1.default.createElement(rc_tree_1.default, { allowDrop: canDrop, draggable: canDrag, onDragStart: function () { }, onDragEnter: handleDragEnter, onDrop: handleDrop, virtual: isVirtualized, itemHeight: minItemHeight, height: height, onExpand: handleExpand, showIcon: false, showLine: true, expandedKeys: expandedKeys, switcherIcon: renderSwitcherIcon, defaultExpandAll: defaultExpandAll, className: (0, classnames_1.default)(className, styles.treeWrapper), titleRender: renderNode ? function (node) { return renderNode(node.value); } : undefined, treeData: internalTreeData, selectable: false, loadData: onLoadChildren ? function (node) { return onLoadChildren(node.value); } : undefined, "data-reltio-id": "rc-tree" })) : null;
|
|
78
|
+
return internalTreeData ? (react_1.default.createElement(rc_tree_1.default, { allowDrop: canDrop, draggable: canDrag, onDragStart: function () { }, onDragEnter: handleDragEnter, onDrop: handleDrop, virtual: isVirtualized, itemHeight: minItemHeight, height: height, onExpand: handleExpand, showIcon: false, showLine: true, expandedKeys: expandedKeys, switcherIcon: renderSwitcherIcon, defaultExpandAll: defaultExpandAll, className: (0, classnames_1.default)(className, styles.treeWrapper), titleRender: renderNode ? function (node) { return renderNode(node.value); } : undefined, treeData: internalTreeData, selectable: false, loadData: onLoadChildren ? function (node) { return onLoadChildren(node.value); } : undefined, "data-reltio-id": "rc-tree", ref: treeRef })) : null;
|
|
73
79
|
};
|
|
74
80
|
exports.RCTree = RCTree;
|
package/cjs/RCTree/helper.js
CHANGED
|
@@ -49,9 +49,7 @@ exports.changeNodeAtPosition = changeNodeAtPosition;
|
|
|
49
49
|
var getExpandedKeys = function (nodes) {
|
|
50
50
|
if (nodes === void 0) { nodes = []; }
|
|
51
51
|
return nodes.reduce(function (expandedKeys, node) {
|
|
52
|
-
return expandedKeys
|
|
53
|
-
.concat(node.expanded ? [String(node.nodeId)] : [])
|
|
54
|
-
.concat((0, exports.getExpandedKeys)(node.children));
|
|
52
|
+
return expandedKeys.concat(node.expanded ? [String(node.nodeId)] : []).concat((0, exports.getExpandedKeys)(node.children));
|
|
55
53
|
}, []);
|
|
56
54
|
};
|
|
57
55
|
exports.getExpandedKeys = getExpandedKeys;
|
package/cjs/RCTree/styles.js
CHANGED
|
@@ -214,7 +214,7 @@ exports.useStyles = (0, styles_1.makeStyles)(function () { return ({
|
|
|
214
214
|
outline: 0,
|
|
215
215
|
'&:hover': {
|
|
216
216
|
backgroundColor: 'rgba(0,0,0,0.06)'
|
|
217
|
-
}
|
|
217
|
+
}
|
|
218
218
|
},
|
|
219
219
|
'.rc-tree-treenode': {
|
|
220
220
|
display: 'flex'
|
|
@@ -225,6 +225,6 @@ exports.useStyles = (0, styles_1.makeStyles)(function () { return ({
|
|
|
225
225
|
'.rc-tree-title': {
|
|
226
226
|
display: 'inline-block',
|
|
227
227
|
width: '100%'
|
|
228
|
-
}
|
|
228
|
+
}
|
|
229
229
|
}
|
|
230
230
|
}); });
|
|
@@ -1,49 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
6
|
exports.UpSetChart = void 0;
|
|
30
|
-
var react_1 =
|
|
31
|
-
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
32
|
-
var react_2 = require("@upsetjs/react");
|
|
33
|
-
var constants_1 = require("./constants");
|
|
34
|
-
var styles_1 = require("./styles");
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
35
8
|
var UpSetChart = function (_a) {
|
|
36
9
|
var width = _a.width, height = _a.height, data = _a.data;
|
|
37
|
-
|
|
38
|
-
var _b = (0, react_1.useState)(null), selection = _b[0], setSelection = _b[1];
|
|
39
|
-
var _c = (0, react_1.useMemo)(function () { return (0, react_2.extractCombinations)(data); }, [data]), sets = _c.sets, combinations = _c.combinations;
|
|
40
|
-
if (!width || !height)
|
|
10
|
+
if (!width || !height || !data)
|
|
41
11
|
return null;
|
|
42
|
-
return
|
|
43
|
-
setLabel: styles.setLabel,
|
|
44
|
-
barLabel: styles.barLabel,
|
|
45
|
-
axisTick: styles.axisTick,
|
|
46
|
-
chartLabel: styles.chartLabel
|
|
47
|
-
} }));
|
|
12
|
+
return react_1.default.createElement("div", null, "UpSet");
|
|
48
13
|
};
|
|
49
14
|
exports.UpSetChart = UpSetChart;
|
package/esm/RCTree/RCTree.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { TreeNodeProps } from 'rc-tree';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { RCTreeNode } from './types';
|
|
4
4
|
type Props = {
|
|
5
5
|
treeData: RCTreeNode[];
|
|
@@ -14,7 +14,8 @@ type Props = {
|
|
|
14
14
|
className?: string;
|
|
15
15
|
minItemHeight?: number;
|
|
16
16
|
isLeaf?: (node: TreeNodeProps & Record<string, unknown>) => boolean;
|
|
17
|
+
scrollToNode?: RCTreeNode;
|
|
17
18
|
onChange?: (node: RCTreeNode[]) => void;
|
|
18
19
|
};
|
|
19
|
-
export declare const RCTree: ({ treeData, isVirtualized, canDrag, canDrop, onLoadChildren, height, defaultExpandAll, SwitchRenderer, className, renderNode, minItemHeight, isLeaf,
|
|
20
|
+
export declare const RCTree: ({ treeData, isVirtualized, canDrag, canDrop, onLoadChildren, height, defaultExpandAll, SwitchRenderer, className, renderNode, minItemHeight, isLeaf, scrollToNode, onChange }: Props) => React.JSX.Element;
|
|
20
21
|
export {};
|
package/esm/RCTree/RCTree.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import classnames from 'classnames';
|
|
2
2
|
import { assoc, identity } from 'ramda';
|
|
3
3
|
import Tree from 'rc-tree';
|
|
4
|
-
import
|
|
4
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
5
5
|
import { DefaultSwitchRenderer } from './DefaultSwitchRenderer';
|
|
6
6
|
import { changeNodeAtPosition, convertTreeData, defaultIsLeaf, getExpandedKeys } from './helper';
|
|
7
7
|
import { useStyles } from './styles';
|
|
8
8
|
var MIN_ROW_HEIGHT = 28;
|
|
9
9
|
export var RCTree = function (_a) {
|
|
10
|
-
var treeData = _a.treeData, _b = _a.isVirtualized, isVirtualized = _b === void 0 ? true : _b, _c = _a.canDrag, canDrag = _c === void 0 ? false : _c, _d = _a.canDrop, canDrop = _d === void 0 ? function () { return false; } : _d, onLoadChildren = _a.onLoadChildren, height = _a.height, _e = _a.defaultExpandAll, defaultExpandAll = _e === void 0 ? false : _e, _f = _a.SwitchRenderer, SwitchRenderer = _f === void 0 ? DefaultSwitchRenderer : _f, className = _a.className, renderNode = _a.renderNode, _g = _a.minItemHeight, minItemHeight = _g === void 0 ? MIN_ROW_HEIGHT : _g, _h = _a.isLeaf, isLeaf = _h === void 0 ? defaultIsLeaf : _h, _j = _a.onChange, onChange = _j === void 0 ? identity : _j;
|
|
10
|
+
var treeData = _a.treeData, _b = _a.isVirtualized, isVirtualized = _b === void 0 ? true : _b, _c = _a.canDrag, canDrag = _c === void 0 ? false : _c, _d = _a.canDrop, canDrop = _d === void 0 ? function () { return false; } : _d, onLoadChildren = _a.onLoadChildren, height = _a.height, _e = _a.defaultExpandAll, defaultExpandAll = _e === void 0 ? false : _e, _f = _a.SwitchRenderer, SwitchRenderer = _f === void 0 ? DefaultSwitchRenderer : _f, className = _a.className, renderNode = _a.renderNode, _g = _a.minItemHeight, minItemHeight = _g === void 0 ? MIN_ROW_HEIGHT : _g, _h = _a.isLeaf, isLeaf = _h === void 0 ? defaultIsLeaf : _h, scrollToNode = _a.scrollToNode, _j = _a.onChange, onChange = _j === void 0 ? identity : _j;
|
|
11
11
|
var styles = useStyles();
|
|
12
12
|
var internalTreeData = useMemo(function () { return convertTreeData({ data: treeData, isLeaf: isLeaf }); }, [isLeaf, treeData]);
|
|
13
|
+
var treeRef = useRef(null);
|
|
14
|
+
useEffect(function () {
|
|
15
|
+
if (treeRef.current && scrollToNode) {
|
|
16
|
+
treeRef.current.scrollTo({ key: String(scrollToNode.nodeId) });
|
|
17
|
+
}
|
|
18
|
+
}, [scrollToNode]);
|
|
13
19
|
// eslint-disable-next-line no-unused-vars
|
|
14
20
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
21
|
var handleDrop = function (_a) {
|
|
@@ -40,5 +46,5 @@ export var RCTree = function (_a) {
|
|
|
40
46
|
return getExpandedKeys(treeData);
|
|
41
47
|
}, [treeData]);
|
|
42
48
|
var renderSwitcherIcon = useCallback(function (node) { return React.createElement(SwitchRenderer, { node: node }); }, []);
|
|
43
|
-
return internalTreeData ? (React.createElement(Tree, { allowDrop: canDrop, draggable: canDrag, onDragStart: function () { }, onDragEnter: handleDragEnter, onDrop: handleDrop, virtual: isVirtualized, itemHeight: minItemHeight, height: height, onExpand: handleExpand, showIcon: false, showLine: true, expandedKeys: expandedKeys, switcherIcon: renderSwitcherIcon, defaultExpandAll: defaultExpandAll, className: classnames(className, styles.treeWrapper), titleRender: renderNode ? function (node) { return renderNode(node.value); } : undefined, treeData: internalTreeData, selectable: false, loadData: onLoadChildren ? function (node) { return onLoadChildren(node.value); } : undefined, "data-reltio-id": "rc-tree" })) : null;
|
|
49
|
+
return internalTreeData ? (React.createElement(Tree, { allowDrop: canDrop, draggable: canDrag, onDragStart: function () { }, onDragEnter: handleDragEnter, onDrop: handleDrop, virtual: isVirtualized, itemHeight: minItemHeight, height: height, onExpand: handleExpand, showIcon: false, showLine: true, expandedKeys: expandedKeys, switcherIcon: renderSwitcherIcon, defaultExpandAll: defaultExpandAll, className: classnames(className, styles.treeWrapper), titleRender: renderNode ? function (node) { return renderNode(node.value); } : undefined, treeData: internalTreeData, selectable: false, loadData: onLoadChildren ? function (node) { return onLoadChildren(node.value); } : undefined, "data-reltio-id": "rc-tree", ref: treeRef })) : null;
|
|
44
50
|
};
|
package/esm/RCTree/helper.js
CHANGED
|
@@ -43,8 +43,6 @@ export var changeNodeAtPosition = function (treeData, pos, changeNode) {
|
|
|
43
43
|
export var getExpandedKeys = function (nodes) {
|
|
44
44
|
if (nodes === void 0) { nodes = []; }
|
|
45
45
|
return nodes.reduce(function (expandedKeys, node) {
|
|
46
|
-
return expandedKeys
|
|
47
|
-
.concat(node.expanded ? [String(node.nodeId)] : [])
|
|
48
|
-
.concat(getExpandedKeys(node.children));
|
|
46
|
+
return expandedKeys.concat(node.expanded ? [String(node.nodeId)] : []).concat(getExpandedKeys(node.children));
|
|
49
47
|
}, []);
|
|
50
48
|
};
|
package/esm/RCTree/styles.js
CHANGED
|
@@ -211,7 +211,7 @@ export var useStyles = makeStyles(function () { return ({
|
|
|
211
211
|
outline: 0,
|
|
212
212
|
'&:hover': {
|
|
213
213
|
backgroundColor: 'rgba(0,0,0,0.06)'
|
|
214
|
-
}
|
|
214
|
+
}
|
|
215
215
|
},
|
|
216
216
|
'.rc-tree-treenode': {
|
|
217
217
|
display: 'flex'
|
|
@@ -222,6 +222,6 @@ export var useStyles = makeStyles(function () { return ({
|
|
|
222
222
|
'.rc-tree-title': {
|
|
223
223
|
display: 'inline-block',
|
|
224
224
|
width: '100%'
|
|
225
|
-
}
|
|
225
|
+
}
|
|
226
226
|
}
|
|
227
227
|
}); });
|
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import i18n from 'ui-i18n';
|
|
3
|
-
import { extractCombinations, UpSetJS } from '@upsetjs/react';
|
|
4
|
-
import { NOT_MEMBER_COLOR, PRIMARY_COLOR, SECONDARY_COLOR, TEXT_COLOR } from './constants';
|
|
5
|
-
import { useStyles } from './styles';
|
|
1
|
+
import React from 'react';
|
|
6
2
|
export var UpSetChart = function (_a) {
|
|
7
3
|
var width = _a.width, height = _a.height, data = _a.data;
|
|
8
|
-
|
|
9
|
-
var _b = useState(null), selection = _b[0], setSelection = _b[1];
|
|
10
|
-
var _c = useMemo(function () { return extractCombinations(data); }, [data]), sets = _c.sets, combinations = _c.combinations;
|
|
11
|
-
if (!width || !height)
|
|
4
|
+
if (!width || !height || !data)
|
|
12
5
|
return null;
|
|
13
|
-
return
|
|
14
|
-
setLabel: styles.setLabel,
|
|
15
|
-
barLabel: styles.barLabel,
|
|
16
|
-
axisTick: styles.axisTick,
|
|
17
|
-
chartLabel: styles.chartLabel
|
|
18
|
-
} }));
|
|
6
|
+
return React.createElement("div", null, "UpSet");
|
|
19
7
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1959",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
"@react-google-maps/api": "2.7.0",
|
|
10
10
|
"@react-sigma/core": "3.4.0",
|
|
11
11
|
"@reltio/mdm-sdk": "^1.4.1866",
|
|
12
|
-
"@upsetjs/react": "^1.11.0",
|
|
13
12
|
"d3-cloud": "^1.2.5",
|
|
14
13
|
"d3-geo": "^2.0.1",
|
|
15
14
|
"d3-hierarchy": "^2.0.0",
|
|
@@ -57,8 +56,5 @@
|
|
|
57
56
|
"publishConfig": {
|
|
58
57
|
"access": "public"
|
|
59
58
|
},
|
|
60
|
-
"overrides": {
|
|
61
|
-
"@types/lz-string": "1.3.34"
|
|
62
|
-
},
|
|
63
59
|
"sideEffects": false
|
|
64
60
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,67 +0,0 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
var react_1 = __importDefault(require("react"));
|
|
18
|
-
var react_2 = require("@testing-library/react");
|
|
19
|
-
var UpSetChart_1 = require("./UpSetChart");
|
|
20
|
-
var defaultData = [
|
|
21
|
-
{ name: '1', sets: ['Salesforce'] },
|
|
22
|
-
{ name: '2', sets: ['SAP'] },
|
|
23
|
-
{ name: '3', sets: ['ServiceNow'] },
|
|
24
|
-
{ name: '4', sets: ['D&B'] },
|
|
25
|
-
{ name: '5', sets: ['Reltio'] },
|
|
26
|
-
{ name: '6', sets: ['Salesforce', 'SAP'] },
|
|
27
|
-
{ name: '7', sets: ['Salesforce', 'D&B'] },
|
|
28
|
-
{ name: '8', sets: ['Salesforce', 'Reltio'] },
|
|
29
|
-
{ name: '9', sets: ['ServiceNow', 'Reltio'] },
|
|
30
|
-
{ name: '10', sets: ['Salesforce', 'D&B'] },
|
|
31
|
-
{ name: '11', sets: ['SAP', 'D&B'] },
|
|
32
|
-
{ name: '12', sets: ['SAP', 'ServiceNow'] },
|
|
33
|
-
{ name: '13', sets: ['Salesforce', 'D&B', 'Reltio'] },
|
|
34
|
-
{ name: '14', sets: ['Salesforce', 'SAP', 'Reltio'] },
|
|
35
|
-
{ name: '15', sets: ['Salesforce', 'ServiceNow'] }
|
|
36
|
-
];
|
|
37
|
-
var defaultProps = {
|
|
38
|
-
data: defaultData,
|
|
39
|
-
width: 600,
|
|
40
|
-
height: 400
|
|
41
|
-
};
|
|
42
|
-
var setUp = function (props) {
|
|
43
|
-
if (props === void 0) { props = defaultProps; }
|
|
44
|
-
return (0, react_2.render)(react_1.default.createElement(UpSetChart_1.UpSetChart, __assign({}, props)));
|
|
45
|
-
};
|
|
46
|
-
describe('UpSetChart', function () {
|
|
47
|
-
beforeEach(function () {
|
|
48
|
-
jest.spyOn(Math, 'random').mockReturnValue(0.5);
|
|
49
|
-
});
|
|
50
|
-
afterEach(function () {
|
|
51
|
-
jest.spyOn(Math, 'random').mockRestore();
|
|
52
|
-
});
|
|
53
|
-
it('should render correctly', function () {
|
|
54
|
-
var container = setUp().container;
|
|
55
|
-
expect(container).toMatchSnapshot();
|
|
56
|
-
});
|
|
57
|
-
it('should render nothing if width is 0 or undefined', function () {
|
|
58
|
-
var props = __assign(__assign({}, defaultProps), { width: 0 });
|
|
59
|
-
var container = setUp(props).container;
|
|
60
|
-
expect(container).toBeEmptyDOMElement();
|
|
61
|
-
});
|
|
62
|
-
it('should render nothing if height is 0 or undefined', function () {
|
|
63
|
-
var props = __assign(__assign({}, defaultProps), { height: 0 });
|
|
64
|
-
var container = setUp(props).container;
|
|
65
|
-
expect(container).toBeEmptyDOMElement();
|
|
66
|
-
});
|
|
67
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,62 +0,0 @@
|
|
|
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 React from 'react';
|
|
13
|
-
import { render } from '@testing-library/react';
|
|
14
|
-
import { UpSetChart } from './UpSetChart';
|
|
15
|
-
var defaultData = [
|
|
16
|
-
{ name: '1', sets: ['Salesforce'] },
|
|
17
|
-
{ name: '2', sets: ['SAP'] },
|
|
18
|
-
{ name: '3', sets: ['ServiceNow'] },
|
|
19
|
-
{ name: '4', sets: ['D&B'] },
|
|
20
|
-
{ name: '5', sets: ['Reltio'] },
|
|
21
|
-
{ name: '6', sets: ['Salesforce', 'SAP'] },
|
|
22
|
-
{ name: '7', sets: ['Salesforce', 'D&B'] },
|
|
23
|
-
{ name: '8', sets: ['Salesforce', 'Reltio'] },
|
|
24
|
-
{ name: '9', sets: ['ServiceNow', 'Reltio'] },
|
|
25
|
-
{ name: '10', sets: ['Salesforce', 'D&B'] },
|
|
26
|
-
{ name: '11', sets: ['SAP', 'D&B'] },
|
|
27
|
-
{ name: '12', sets: ['SAP', 'ServiceNow'] },
|
|
28
|
-
{ name: '13', sets: ['Salesforce', 'D&B', 'Reltio'] },
|
|
29
|
-
{ name: '14', sets: ['Salesforce', 'SAP', 'Reltio'] },
|
|
30
|
-
{ name: '15', sets: ['Salesforce', 'ServiceNow'] }
|
|
31
|
-
];
|
|
32
|
-
var defaultProps = {
|
|
33
|
-
data: defaultData,
|
|
34
|
-
width: 600,
|
|
35
|
-
height: 400
|
|
36
|
-
};
|
|
37
|
-
var setUp = function (props) {
|
|
38
|
-
if (props === void 0) { props = defaultProps; }
|
|
39
|
-
return render(React.createElement(UpSetChart, __assign({}, props)));
|
|
40
|
-
};
|
|
41
|
-
describe('UpSetChart', function () {
|
|
42
|
-
beforeEach(function () {
|
|
43
|
-
jest.spyOn(Math, 'random').mockReturnValue(0.5);
|
|
44
|
-
});
|
|
45
|
-
afterEach(function () {
|
|
46
|
-
jest.spyOn(Math, 'random').mockRestore();
|
|
47
|
-
});
|
|
48
|
-
it('should render correctly', function () {
|
|
49
|
-
var container = setUp().container;
|
|
50
|
-
expect(container).toMatchSnapshot();
|
|
51
|
-
});
|
|
52
|
-
it('should render nothing if width is 0 or undefined', function () {
|
|
53
|
-
var props = __assign(__assign({}, defaultProps), { width: 0 });
|
|
54
|
-
var container = setUp(props).container;
|
|
55
|
-
expect(container).toBeEmptyDOMElement();
|
|
56
|
-
});
|
|
57
|
-
it('should render nothing if height is 0 or undefined', function () {
|
|
58
|
-
var props = __assign(__assign({}, defaultProps), { height: 0 });
|
|
59
|
-
var container = setUp(props).container;
|
|
60
|
-
expect(container).toBeEmptyDOMElement();
|
|
61
|
-
});
|
|
62
|
-
});
|