@reltio/components 1.4.2246 → 1.4.2248
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/index.d.ts +0 -1
- package/cjs/index.js +5 -7
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/package.json +2 -2
- package/UpSetChart/UpSetChart.d.ts +0 -9
- package/UpSetChart/UpSetChart.js +0 -40
- package/UpSetChart/UpSetChart.test.d.ts +0 -1
- package/UpSetChart/UpSetChart.test.js +0 -193
- package/UpSetChart/components/IntersectionsChart/IntersectionsChart.d.ts +0 -15
- package/UpSetChart/components/IntersectionsChart/IntersectionsChart.js +0 -39
- package/UpSetChart/components/IntersectionsChart/index.d.ts +0 -1
- package/UpSetChart/components/IntersectionsChart/index.js +0 -1
- package/UpSetChart/components/IntersectionsChart/styles.d.ts +0 -1
- package/UpSetChart/components/IntersectionsChart/styles.js +0 -29
- package/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.d.ts +0 -10
- package/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.js +0 -34
- package/UpSetChart/components/IntersectionsChartAxis/index.d.ts +0 -1
- package/UpSetChart/components/IntersectionsChartAxis/index.js +0 -1
- package/UpSetChart/components/IntersectionsChartAxis/styles.d.ts +0 -1
- package/UpSetChart/components/IntersectionsChartAxis/styles.js +0 -29
- package/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.d.ts +0 -13
- package/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.js +0 -26
- package/UpSetChart/components/IntersectionsMatrix/index.d.ts +0 -1
- package/UpSetChart/components/IntersectionsMatrix/index.js +0 -1
- package/UpSetChart/components/IntersectionsMatrix/styles.d.ts +0 -1
- package/UpSetChart/components/IntersectionsMatrix/styles.js +0 -24
- package/UpSetChart/components/SetsChart/SetsChart.d.ts +0 -15
- package/UpSetChart/components/SetsChart/SetsChart.js +0 -31
- package/UpSetChart/components/SetsChart/index.d.ts +0 -1
- package/UpSetChart/components/SetsChart/index.js +0 -1
- package/UpSetChart/components/SetsChart/styles.d.ts +0 -1
- package/UpSetChart/components/SetsChart/styles.js +0 -40
- package/UpSetChart/components/SetsChartAxis/SetsChartAxis.d.ts +0 -6
- package/UpSetChart/components/SetsChartAxis/SetsChartAxis.js +0 -13
- package/UpSetChart/components/SetsChartAxis/index.d.ts +0 -1
- package/UpSetChart/components/SetsChartAxis/index.js +0 -1
- package/UpSetChart/components/SetsChartAxis/styles.d.ts +0 -1
- package/UpSetChart/components/SetsChartAxis/styles.js +0 -14
- package/UpSetChart/constants.d.ts +0 -17
- package/UpSetChart/constants.js +0 -20
- package/UpSetChart/gameOfThrones.test-data.d.ts +0 -4
- package/UpSetChart/gameOfThrones.test-data.js +0 -23
- package/UpSetChart/helpers.d.ts +0 -20
- package/UpSetChart/helpers.js +0 -120
- package/UpSetChart/index.d.ts +0 -1
- package/UpSetChart/index.js +0 -1
- package/UpSetChart/styles.d.ts +0 -4
- package/UpSetChart/styles.js +0 -15
- package/UpSetChart/types.d.ts +0 -16
- package/UpSetChart/types.js +0 -1
- package/UpSetChart/useUpSetChartSizes.d.ts +0 -20
- package/UpSetChart/useUpSetChartSizes.js +0 -30
- package/cjs/UpSetChart/UpSetChart.d.ts +0 -9
- package/cjs/UpSetChart/UpSetChart.js +0 -70
- package/cjs/UpSetChart/UpSetChart.test.d.ts +0 -1
- package/cjs/UpSetChart/UpSetChart.test.js +0 -198
- package/cjs/UpSetChart/components/IntersectionsChart/IntersectionsChart.d.ts +0 -15
- package/cjs/UpSetChart/components/IntersectionsChart/IntersectionsChart.js +0 -66
- package/cjs/UpSetChart/components/IntersectionsChart/index.d.ts +0 -1
- package/cjs/UpSetChart/components/IntersectionsChart/index.js +0 -5
- package/cjs/UpSetChart/components/IntersectionsChart/styles.d.ts +0 -1
- package/cjs/UpSetChart/components/IntersectionsChart/styles.js +0 -32
- package/cjs/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.d.ts +0 -10
- package/cjs/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.js +0 -64
- package/cjs/UpSetChart/components/IntersectionsChartAxis/index.d.ts +0 -1
- package/cjs/UpSetChart/components/IntersectionsChartAxis/index.js +0 -5
- package/cjs/UpSetChart/components/IntersectionsChartAxis/styles.d.ts +0 -1
- package/cjs/UpSetChart/components/IntersectionsChartAxis/styles.js +0 -32
- package/cjs/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.d.ts +0 -13
- package/cjs/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.js +0 -56
- package/cjs/UpSetChart/components/IntersectionsMatrix/index.d.ts +0 -1
- package/cjs/UpSetChart/components/IntersectionsMatrix/index.js +0 -5
- package/cjs/UpSetChart/components/IntersectionsMatrix/styles.d.ts +0 -1
- package/cjs/UpSetChart/components/IntersectionsMatrix/styles.js +0 -27
- package/cjs/UpSetChart/components/SetsChart/SetsChart.d.ts +0 -15
- package/cjs/UpSetChart/components/SetsChart/SetsChart.js +0 -58
- package/cjs/UpSetChart/components/SetsChart/index.d.ts +0 -1
- package/cjs/UpSetChart/components/SetsChart/index.js +0 -5
- package/cjs/UpSetChart/components/SetsChart/styles.d.ts +0 -1
- package/cjs/UpSetChart/components/SetsChart/styles.js +0 -43
- package/cjs/UpSetChart/components/SetsChartAxis/SetsChartAxis.d.ts +0 -6
- package/cjs/UpSetChart/components/SetsChartAxis/SetsChartAxis.js +0 -20
- package/cjs/UpSetChart/components/SetsChartAxis/index.d.ts +0 -1
- package/cjs/UpSetChart/components/SetsChartAxis/index.js +0 -5
- package/cjs/UpSetChart/components/SetsChartAxis/styles.d.ts +0 -1
- package/cjs/UpSetChart/components/SetsChartAxis/styles.js +0 -17
- package/cjs/UpSetChart/constants.d.ts +0 -17
- package/cjs/UpSetChart/constants.js +0 -23
- package/cjs/UpSetChart/gameOfThrones.test-data.d.ts +0 -4
- package/cjs/UpSetChart/gameOfThrones.test-data.js +0 -26
- package/cjs/UpSetChart/helpers.d.ts +0 -20
- package/cjs/UpSetChart/helpers.js +0 -127
- package/cjs/UpSetChart/index.d.ts +0 -1
- package/cjs/UpSetChart/index.js +0 -5
- package/cjs/UpSetChart/styles.d.ts +0 -4
- package/cjs/UpSetChart/styles.js +0 -18
- package/cjs/UpSetChart/types.d.ts +0 -16
- package/cjs/UpSetChart/types.js +0 -2
- package/cjs/UpSetChart/useUpSetChartSizes.d.ts +0 -20
- package/cjs/UpSetChart/useUpSetChartSizes.js +0 -34
|
@@ -1,198 +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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
-
};
|
|
52
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
var react_1 = __importDefault(require("react"));
|
|
54
|
-
var react_2 = require("@testing-library/react");
|
|
55
|
-
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
56
|
-
var gameOfThrones_test_data_1 = require("./gameOfThrones.test-data");
|
|
57
|
-
var UpSetChart_1 = require("./UpSetChart");
|
|
58
|
-
var originalGetBBox = Object.getOwnPropertyDescriptor(SVGElement.prototype, 'getBBox');
|
|
59
|
-
describe('UpSetChart', function () {
|
|
60
|
-
beforeAll(function () {
|
|
61
|
-
Object.defineProperty(SVGElement.prototype, 'getBBox', {
|
|
62
|
-
configurable: true,
|
|
63
|
-
value: function () { return ({ x: 0, y: 0, width: 150 }); }
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
afterAll(function () {
|
|
67
|
-
Object.defineProperty(SVGElement.prototype, 'getBBox', { value: originalGetBBox });
|
|
68
|
-
});
|
|
69
|
-
var setUp = function (_a) {
|
|
70
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.data, data = _c === void 0 ? gameOfThrones_test_data_1.gameOfThronesData : _c, _d = _b.width, width = _d === void 0 ? 1400 : _d, _e = _b.height, height = _e === void 0 ? 400 : _e;
|
|
71
|
-
var user = user_event_1.default.setup();
|
|
72
|
-
return __assign({ user: user }, (0, react_2.render)(react_1.default.createElement(UpSetChart_1.UpSetChart, { data: data, width: width, height: height })));
|
|
73
|
-
};
|
|
74
|
-
it('should work fine with complex data', function () {
|
|
75
|
-
var asFragment = setUp().asFragment;
|
|
76
|
-
expect(asFragment()).toMatchSnapshot();
|
|
77
|
-
});
|
|
78
|
-
it('should truncate labels and add scrollbar when chart not fit in width', function () {
|
|
79
|
-
var asFragment = setUp({ width: 800 }).asFragment;
|
|
80
|
-
expect(asFragment()).toMatchSnapshot();
|
|
81
|
-
});
|
|
82
|
-
it('should add scrollbar when chart not fit in height', function () {
|
|
83
|
-
var asFragment = setUp({ width: 200 }).asFragment;
|
|
84
|
-
expect(asFragment()).toMatchSnapshot();
|
|
85
|
-
});
|
|
86
|
-
it('should highlight intersection column on hover', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
87
|
-
var _a, user, asFragment, _b, maleAndWasKilled;
|
|
88
|
-
return __generator(this, function (_c) {
|
|
89
|
-
switch (_c.label) {
|
|
90
|
-
case 0:
|
|
91
|
-
_a = setUp(), user = _a.user, asFragment = _a.asFragment;
|
|
92
|
-
_b = react_2.screen.getAllByTestId('intersection-hover-area'), maleAndWasKilled = _b[2];
|
|
93
|
-
return [4 /*yield*/, user.hover(maleAndWasKilled)];
|
|
94
|
-
case 1:
|
|
95
|
-
_c.sent();
|
|
96
|
-
expect(asFragment()).toMatchSnapshot();
|
|
97
|
-
return [2 /*return*/];
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}); });
|
|
101
|
-
it('should highlight set row on hover', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
102
|
-
var _a, user, asFragment, _b, lannister;
|
|
103
|
-
return __generator(this, function (_c) {
|
|
104
|
-
switch (_c.label) {
|
|
105
|
-
case 0:
|
|
106
|
-
_a = setUp(), user = _a.user, asFragment = _a.asFragment;
|
|
107
|
-
_b = react_2.screen.getAllByTestId('set-hover-area'), lannister = _b[1];
|
|
108
|
-
return [4 /*yield*/, user.hover(lannister)];
|
|
109
|
-
case 1:
|
|
110
|
-
_c.sent();
|
|
111
|
-
expect(asFragment()).toMatchSnapshot();
|
|
112
|
-
return [2 /*return*/];
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}); });
|
|
116
|
-
it('should show correct tooltip on hover', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
117
|
-
var user, _a, wasKilled, maleAndWasKilled;
|
|
118
|
-
return __generator(this, function (_b) {
|
|
119
|
-
switch (_b.label) {
|
|
120
|
-
case 0:
|
|
121
|
-
user = setUp().user;
|
|
122
|
-
expect(react_2.screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
|
123
|
-
_a = react_2.screen.getAllByTestId('intersection-hover-area'), wasKilled = _a[0], maleAndWasKilled = _a[2];
|
|
124
|
-
return [4 /*yield*/, user.hover(wasKilled)];
|
|
125
|
-
case 1:
|
|
126
|
-
_b.sent();
|
|
127
|
-
expect(react_2.screen.getByRole('tooltip').textContent).toBe('was killed');
|
|
128
|
-
return [4 /*yield*/, user.hover(maleAndWasKilled)];
|
|
129
|
-
case 2:
|
|
130
|
-
_b.sent();
|
|
131
|
-
expect(react_2.screen.getByRole('tooltip').textContent).toBe('male ∩ was killed');
|
|
132
|
-
return [4 /*yield*/, user.unhover(maleAndWasKilled)];
|
|
133
|
-
case 3:
|
|
134
|
-
_b.sent();
|
|
135
|
-
expect(react_2.screen.queryByRole('tooltip')).not.toBeInTheDocument();
|
|
136
|
-
return [2 /*return*/];
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
}); });
|
|
140
|
-
it('should work correctly with simple data', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
141
|
-
var data, _a, user, asFragment;
|
|
142
|
-
return __generator(this, function (_b) {
|
|
143
|
-
switch (_b.label) {
|
|
144
|
-
case 0:
|
|
145
|
-
data = [
|
|
146
|
-
{ name: 'A', sets: ['S1', 'S2'] },
|
|
147
|
-
{ name: 'B', sets: ['S1'] },
|
|
148
|
-
{ name: 'C', sets: ['S2'] },
|
|
149
|
-
{ name: 'D', sets: ['S1', 'S3'] }
|
|
150
|
-
];
|
|
151
|
-
_a = setUp({ data: data, width: 400, height: 300 }), user = _a.user, asFragment = _a.asFragment;
|
|
152
|
-
expect(asFragment()).toMatchSnapshot();
|
|
153
|
-
return [4 /*yield*/, user.hover(react_2.screen.getAllByTestId('set-hover-area')[0])];
|
|
154
|
-
case 1:
|
|
155
|
-
_b.sent();
|
|
156
|
-
expect(asFragment()).toMatchSnapshot();
|
|
157
|
-
return [2 /*return*/];
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
}); });
|
|
161
|
-
it('should work correctly with long labels', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
162
|
-
var data, asFragment;
|
|
163
|
-
return __generator(this, function (_a) {
|
|
164
|
-
data = [
|
|
165
|
-
{ name: 'A', sets: ['S1', 'S2'] },
|
|
166
|
-
{ name: 'B', sets: ['S1'] },
|
|
167
|
-
{ name: 'C', sets: ['S2'] },
|
|
168
|
-
{ name: 'D', sets: ['S1', 'S3testS3testS3testS3test'] }
|
|
169
|
-
];
|
|
170
|
-
asFragment = setUp({ data: data, width: 400, height: 300 }).asFragment;
|
|
171
|
-
expect(asFragment()).toMatchSnapshot();
|
|
172
|
-
return [2 /*return*/];
|
|
173
|
-
});
|
|
174
|
-
}); });
|
|
175
|
-
it('should work correctly with one set', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
176
|
-
var data, asFragment;
|
|
177
|
-
return __generator(this, function (_a) {
|
|
178
|
-
data = [
|
|
179
|
-
{ name: 'A', sets: ['S1'] },
|
|
180
|
-
{ name: 'B', sets: ['S1'] },
|
|
181
|
-
{ name: 'C', sets: ['S1'] },
|
|
182
|
-
{ name: 'D', sets: ['S1'] }
|
|
183
|
-
];
|
|
184
|
-
asFragment = setUp({ data: data, width: 400, height: 300 }).asFragment;
|
|
185
|
-
expect(asFragment()).toMatchSnapshot();
|
|
186
|
-
return [2 /*return*/];
|
|
187
|
-
});
|
|
188
|
-
}); });
|
|
189
|
-
it('should work correctly with one entry', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
190
|
-
var data, asFragment;
|
|
191
|
-
return __generator(this, function (_a) {
|
|
192
|
-
data = [{ name: 'A', sets: ['S1', 'S2', 'S3'] }];
|
|
193
|
-
asFragment = setUp({ data: data, width: 400, height: 300 }).asFragment;
|
|
194
|
-
expect(asFragment()).toMatchSnapshot();
|
|
195
|
-
return [2 /*return*/];
|
|
196
|
-
});
|
|
197
|
-
}); });
|
|
198
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ScaleBand } from 'd3-scale';
|
|
3
|
-
import { Intersection } from '../../types';
|
|
4
|
-
type Props = {
|
|
5
|
-
xScale: ScaleBand<string>;
|
|
6
|
-
width: number;
|
|
7
|
-
height: number;
|
|
8
|
-
transform?: string;
|
|
9
|
-
matrixHeight: number;
|
|
10
|
-
intersections: Intersection[];
|
|
11
|
-
highlightedElements?: string[];
|
|
12
|
-
onIntersectionHover: (intersection: Intersection) => void;
|
|
13
|
-
};
|
|
14
|
-
export declare const IntersectionsChart: ({ xScale, width, height, transform, matrixHeight, intersections, highlightedElements, onIntersectionHover }: Props) => React.JSX.Element;
|
|
15
|
-
export {};
|
|
@@ -1,66 +0,0 @@
|
|
|
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
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
26
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
27
|
-
if (ar || !(i in from)) {
|
|
28
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
29
|
-
ar[i] = from[i];
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.IntersectionsChart = void 0;
|
|
36
|
-
var react_1 = __importStar(require("react"));
|
|
37
|
-
var d3_scale_1 = require("d3-scale");
|
|
38
|
-
var IntersectionsChartAxis_1 = require("../IntersectionsChartAxis");
|
|
39
|
-
var constants_1 = require("../../constants");
|
|
40
|
-
var styles_1 = require("./styles");
|
|
41
|
-
var IntersectionsChart = function (_a) {
|
|
42
|
-
var xScale = _a.xScale, width = _a.width, height = _a.height, transform = _a.transform, matrixHeight = _a.matrixHeight, intersections = _a.intersections, highlightedElements = _a.highlightedElements, onIntersectionHover = _a.onIntersectionHover;
|
|
43
|
-
var styles = (0, styles_1.useStyles)();
|
|
44
|
-
var yScale = (0, react_1.useMemo)(function () {
|
|
45
|
-
var intersectionsSizes = intersections.map(function (intersection) { return intersection.size; });
|
|
46
|
-
var domain = [0, Math.max.apply(Math, __spreadArray([0], intersectionsSizes, false))];
|
|
47
|
-
return (0, d3_scale_1.scaleLinear)([height, 0]).domain(domain);
|
|
48
|
-
}, [intersections, height]);
|
|
49
|
-
return (react_1.default.createElement("g", { transform: transform },
|
|
50
|
-
react_1.default.createElement(IntersectionsChartAxis_1.IntersectionsChartAxis, { xScale: xScale, yScale: yScale, width: width, height: height }),
|
|
51
|
-
intersections.map(function (intersection, i) {
|
|
52
|
-
var elements = intersection.elements, size = intersection.size;
|
|
53
|
-
var x = xScale(String(i));
|
|
54
|
-
var y = yScale(size);
|
|
55
|
-
var width = xScale.bandwidth();
|
|
56
|
-
var barY = highlightedElements
|
|
57
|
-
? yScale(elements.filter(function (el) { return highlightedElements.includes(el); }).length)
|
|
58
|
-
: y;
|
|
59
|
-
return (react_1.default.createElement("g", { key: "intersection-group-".concat(i) },
|
|
60
|
-
react_1.default.createElement("rect", { className: styles.barBackground, x: x, y: y, width: width, height: height - y }),
|
|
61
|
-
react_1.default.createElement("text", { className: styles.barLabel, x: x + width / 2, y: y - 4 }, size),
|
|
62
|
-
react_1.default.createElement("rect", { className: styles.bar, x: x, y: barY, width: width, height: height - barY }),
|
|
63
|
-
react_1.default.createElement("rect", { className: styles.hoverBar, "data-reltio-id": "intersection-hover-area", x: x, y: y, width: width, height: height - y + matrixHeight + constants_1.GAP_BETWEEN_TABLE_AND_CHART - 1, onMouseEnter: function () { return onIntersectionHover(intersection); }, onMouseLeave: function () { return onIntersectionHover(null); } })));
|
|
64
|
-
})));
|
|
65
|
-
};
|
|
66
|
-
exports.IntersectionsChart = IntersectionsChart;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { IntersectionsChart } from './IntersectionsChart';
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IntersectionsChart = void 0;
|
|
4
|
-
var IntersectionsChart_1 = require("./IntersectionsChart");
|
|
5
|
-
Object.defineProperty(exports, "IntersectionsChart", { enumerable: true, get: function () { return IntersectionsChart_1.IntersectionsChart; } });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"bar" | "hoverBar" | "barBackground" | "barLabel">;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useStyles = void 0;
|
|
4
|
-
var styles_1 = require("@mui/styles");
|
|
5
|
-
var constants_1 = require("../../constants");
|
|
6
|
-
exports.useStyles = (0, styles_1.makeStyles)(function () { return ({
|
|
7
|
-
bar: {
|
|
8
|
-
fill: constants_1.PRIMARY_COLOR,
|
|
9
|
-
transition: 'y ease-in-out 0.3s, height ease-in-out 0.3s'
|
|
10
|
-
},
|
|
11
|
-
barBackground: {
|
|
12
|
-
fill: constants_1.PRIMARY_COLOR,
|
|
13
|
-
opacity: 0.2,
|
|
14
|
-
transition: 'y ease-in-out 0.3s, height ease-in-out 0.3s'
|
|
15
|
-
},
|
|
16
|
-
barLabel: {
|
|
17
|
-
fill: constants_1.TEXT_COLOR,
|
|
18
|
-
fontSize: '12px',
|
|
19
|
-
textAnchor: 'middle'
|
|
20
|
-
},
|
|
21
|
-
hoverBar: {
|
|
22
|
-
fill: 'transparent',
|
|
23
|
-
stroke: constants_1.PRIMARY_COLOR,
|
|
24
|
-
strokeWidth: '1px',
|
|
25
|
-
cursor: 'pointer',
|
|
26
|
-
transition: 'opacity ease-in-out 0.3s',
|
|
27
|
-
opacity: 0,
|
|
28
|
-
'&:hover': {
|
|
29
|
-
opacity: 1
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}); });
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ScaleBand, ScaleLinear } from 'd3-scale';
|
|
3
|
-
type Props = {
|
|
4
|
-
xScale: ScaleBand<string>;
|
|
5
|
-
yScale: ScaleLinear<number, number>;
|
|
6
|
-
width: number;
|
|
7
|
-
height: number;
|
|
8
|
-
};
|
|
9
|
-
export declare const IntersectionsChartAxis: ({ xScale, yScale, width, height }: Props) => React.JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.IntersectionsChartAxis = void 0;
|
|
30
|
-
var react_1 = __importStar(require("react"));
|
|
31
|
-
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
32
|
-
var styles_1 = require("./styles");
|
|
33
|
-
var helpers_1 = require("../../helpers");
|
|
34
|
-
var IntersectionsChartAxis = function (_a) {
|
|
35
|
-
var xScale = _a.xScale, yScale = _a.yScale, width = _a.width, height = _a.height;
|
|
36
|
-
var styles = (0, styles_1.useStyles)();
|
|
37
|
-
var ticksRef = (0, react_1.useRef)(null);
|
|
38
|
-
var ticks = (0, react_1.useMemo)(function () {
|
|
39
|
-
return yScale
|
|
40
|
-
.nice()
|
|
41
|
-
.ticks()
|
|
42
|
-
.filter(function (tick) { return Number.isInteger(tick); });
|
|
43
|
-
}, [yScale]);
|
|
44
|
-
var ticksWidth = (0, react_1.useMemo)(function () { return (0, helpers_1.calculateTicksWidth)(ticks); }, [ticks]);
|
|
45
|
-
return (react_1.default.createElement("g", null,
|
|
46
|
-
xScale.domain().map(function (d, i) {
|
|
47
|
-
var x = xScale(d) + xScale.bandwidth() / 2;
|
|
48
|
-
return react_1.default.createElement("line", { key: "v-grid-".concat(i), className: styles.verticalGrid, x1: x, x2: x, y1: 0, y2: height });
|
|
49
|
-
}),
|
|
50
|
-
ticks.map(function (tick, i) {
|
|
51
|
-
var y = yScale(tick);
|
|
52
|
-
return react_1.default.createElement("line", { key: "h-grid-".concat(i), className: styles.horizontalGrid, x1: 0, x2: width, y1: y, y2: y });
|
|
53
|
-
}),
|
|
54
|
-
react_1.default.createElement("g", { ref: ticksRef }, ticks.map(function (tick, i) {
|
|
55
|
-
var y = yScale(tick);
|
|
56
|
-
return (react_1.default.createElement("g", { key: "x-tick-".concat(i), transform: "translate(0,".concat(y, ")") },
|
|
57
|
-
react_1.default.createElement("line", { className: styles.axis, x1: -4, x2: 0, y1: 0, y2: 0 }),
|
|
58
|
-
react_1.default.createElement("text", { className: styles.axisTickLabel, x: -8, y: 4 }, tick)));
|
|
59
|
-
})),
|
|
60
|
-
react_1.default.createElement("line", { className: styles.axis, x1: 0, x2: 0, y1: 0, y2: height }),
|
|
61
|
-
react_1.default.createElement("line", { className: styles.axis, x1: 0, x2: width, y1: height, y2: height }),
|
|
62
|
-
react_1.default.createElement("text", { className: styles.axisLabel, transform: "translate(".concat(-ticksWidth - 12, ",").concat(height / 2, ") rotate(-90)") }, ui_i18n_1.default.text('No. of unified profiles'))));
|
|
63
|
-
};
|
|
64
|
-
exports.IntersectionsChartAxis = IntersectionsChartAxis;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { IntersectionsChartAxis } from './IntersectionsChartAxis';
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IntersectionsChartAxis = void 0;
|
|
4
|
-
var IntersectionsChartAxis_1 = require("./IntersectionsChartAxis");
|
|
5
|
-
Object.defineProperty(exports, "IntersectionsChartAxis", { enumerable: true, get: function () { return IntersectionsChartAxis_1.IntersectionsChartAxis; } });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"axis" | "axisTickLabel" | "axisLabel" | "verticalGrid" | "horizontalGrid">;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useStyles = void 0;
|
|
4
|
-
var styles_1 = require("@mui/styles");
|
|
5
|
-
var constants_1 = require("../../constants");
|
|
6
|
-
exports.useStyles = (0, styles_1.makeStyles)(function () { return ({
|
|
7
|
-
axis: {
|
|
8
|
-
stroke: '#000000',
|
|
9
|
-
strokeWidth: '1px'
|
|
10
|
-
},
|
|
11
|
-
axisLabel: {
|
|
12
|
-
fill: '#000000',
|
|
13
|
-
opacity: 0.54,
|
|
14
|
-
fontSize: '10px',
|
|
15
|
-
textAnchor: 'middle'
|
|
16
|
-
},
|
|
17
|
-
axisTickLabel: {
|
|
18
|
-
fontSize: constants_1.AXIS_TICK_LABEL_SIZE,
|
|
19
|
-
textAnchor: 'end'
|
|
20
|
-
},
|
|
21
|
-
verticalGrid: {
|
|
22
|
-
stroke: '#000000',
|
|
23
|
-
opacity: 0.04,
|
|
24
|
-
strokeWidth: '1px',
|
|
25
|
-
strokeDasharray: '2'
|
|
26
|
-
},
|
|
27
|
-
horizontalGrid: {
|
|
28
|
-
stroke: '#000000',
|
|
29
|
-
opacity: 0.04,
|
|
30
|
-
strokeWidth: '1px'
|
|
31
|
-
}
|
|
32
|
-
}); });
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ScaleBand } from 'd3-scale';
|
|
3
|
-
import { DataSet, Intersection } from '../../types';
|
|
4
|
-
type Props = {
|
|
5
|
-
xScale: ScaleBand<string>;
|
|
6
|
-
yScale: ScaleBand<string>;
|
|
7
|
-
intersections: Intersection[];
|
|
8
|
-
sets: DataSet[];
|
|
9
|
-
transform: string;
|
|
10
|
-
hoveredIntersection: Intersection;
|
|
11
|
-
};
|
|
12
|
-
export declare const IntersectionsMatrix: ({ xScale, yScale, intersections, sets, transform, hoveredIntersection }: Props) => React.JSX.Element;
|
|
13
|
-
export {};
|
|
@@ -1,56 +0,0 @@
|
|
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.IntersectionsMatrix = void 0;
|
|
30
|
-
var react_1 = __importStar(require("react"));
|
|
31
|
-
var classnames_1 = __importDefault(require("classnames"));
|
|
32
|
-
var helpers_1 = require("../../helpers");
|
|
33
|
-
var styles_1 = require("./styles");
|
|
34
|
-
var IntersectionsMatrix = function (_a) {
|
|
35
|
-
var xScale = _a.xScale, yScale = _a.yScale, intersections = _a.intersections, sets = _a.sets, transform = _a.transform, hoveredIntersection = _a.hoveredIntersection;
|
|
36
|
-
var styles = (0, styles_1.useStyles)();
|
|
37
|
-
var _b = (0, react_1.useMemo)(function () { return (0, helpers_1.getMatrixData)(xScale, yScale, intersections, sets); }, [xScale, yScale, intersections, sets]), circles = _b.circles, lines = _b.lines;
|
|
38
|
-
var checkDimmed = function (i) { return hoveredIntersection && hoveredIntersection.index !== i; };
|
|
39
|
-
return (react_1.default.createElement("g", { transform: transform },
|
|
40
|
-
circles.map(function (_a, i) {
|
|
41
|
-
var _b;
|
|
42
|
-
var cx = _a.cx, cy = _a.cy, isPresent = _a.isPresent, intersectionIndex = _a.intersectionIndex;
|
|
43
|
-
return (react_1.default.createElement("circle", { key: "matrix-circle-".concat(i), cx: cx, cy: cy, r: 8, className: (0, classnames_1.default)(styles.circle, (_b = {},
|
|
44
|
-
_b[styles.activeCircle] = isPresent,
|
|
45
|
-
_b[styles.dimmedCircle] = isPresent && checkDimmed(intersectionIndex),
|
|
46
|
-
_b)) }));
|
|
47
|
-
}),
|
|
48
|
-
lines.map(function (_a, i) {
|
|
49
|
-
var _b;
|
|
50
|
-
var x = _a.x, y1 = _a.y1, y2 = _a.y2, intersectionIndex = _a.intersectionIndex;
|
|
51
|
-
return (react_1.default.createElement("line", { key: "matrix-line-".concat(i), x1: x, y1: y1, x2: x, y2: y2, className: (0, classnames_1.default)(styles.link, (_b = {},
|
|
52
|
-
_b[styles.dimmedLine] = checkDimmed(intersectionIndex),
|
|
53
|
-
_b)) }));
|
|
54
|
-
})));
|
|
55
|
-
};
|
|
56
|
-
exports.IntersectionsMatrix = IntersectionsMatrix;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { IntersectionsMatrix } from './IntersectionsMatrix';
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IntersectionsMatrix = void 0;
|
|
4
|
-
var IntersectionsMatrix_1 = require("./IntersectionsMatrix");
|
|
5
|
-
Object.defineProperty(exports, "IntersectionsMatrix", { enumerable: true, get: function () { return IntersectionsMatrix_1.IntersectionsMatrix; } });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"circle" | "link" | "activeCircle" | "dimmedCircle" | "dimmedLine">;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useStyles = void 0;
|
|
4
|
-
var styles_1 = require("@mui/styles");
|
|
5
|
-
var constants_1 = require("../../constants");
|
|
6
|
-
exports.useStyles = (0, styles_1.makeStyles)(function () { return ({
|
|
7
|
-
circle: {
|
|
8
|
-
strokeWidth: '2px',
|
|
9
|
-
fill: '#EEEEEE',
|
|
10
|
-
stroke: '#EEEEEE',
|
|
11
|
-
transition: 'fill ease-in-out 0.3s'
|
|
12
|
-
},
|
|
13
|
-
activeCircle: {
|
|
14
|
-
fill: constants_1.PRIMARY_COLOR
|
|
15
|
-
},
|
|
16
|
-
dimmedCircle: {
|
|
17
|
-
fill: constants_1.DIMMED_COLOR
|
|
18
|
-
},
|
|
19
|
-
link: {
|
|
20
|
-
stroke: constants_1.PRIMARY_COLOR,
|
|
21
|
-
strokeWidth: '2px',
|
|
22
|
-
transition: 'stroke ease-in-out 0.3s'
|
|
23
|
-
},
|
|
24
|
-
dimmedLine: {
|
|
25
|
-
stroke: constants_1.DIMMED_COLOR
|
|
26
|
-
}
|
|
27
|
-
}); });
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ScaleBand } from 'd3-scale';
|
|
3
|
-
import { DataSet } from '../../types';
|
|
4
|
-
type Props = {
|
|
5
|
-
sets: DataSet[];
|
|
6
|
-
width: number;
|
|
7
|
-
yScale: ScaleBand<string>;
|
|
8
|
-
labels: string[];
|
|
9
|
-
transform?: string;
|
|
10
|
-
hoverAreaWidth: number;
|
|
11
|
-
hoveredElements?: string[];
|
|
12
|
-
onSetHover: (set: DataSet) => void;
|
|
13
|
-
};
|
|
14
|
-
export declare const SetsChart: ({ sets, width, yScale, transform, labels, hoveredElements, hoverAreaWidth, onSetHover }: Props) => React.JSX.Element;
|
|
15
|
-
export {};
|
|
@@ -1,58 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.SetsChart = void 0;
|
|
27
|
-
var react_1 = __importStar(require("react"));
|
|
28
|
-
var d3_scale_1 = require("d3-scale");
|
|
29
|
-
var SetsChartAxis_1 = require("../SetsChartAxis");
|
|
30
|
-
var constants_1 = require("../../constants");
|
|
31
|
-
var styles_1 = require("./styles");
|
|
32
|
-
var SetsChart = function (_a) {
|
|
33
|
-
var sets = _a.sets, width = _a.width, yScale = _a.yScale, transform = _a.transform, labels = _a.labels, hoveredElements = _a.hoveredElements, hoverAreaWidth = _a.hoverAreaWidth, onSetHover = _a.onSetHover;
|
|
34
|
-
var styles = (0, styles_1.useStyles)();
|
|
35
|
-
var containerRef = react_1.default.useRef(null);
|
|
36
|
-
var xScale = (0, react_1.useMemo)(function () {
|
|
37
|
-
var maxSetSize = sets.length > 0 ? Math.max.apply(Math, sets.map(function (set) { return set.size; })) : 0;
|
|
38
|
-
return (0, d3_scale_1.scaleLinear)().domain([0, maxSetSize]).range([0, width]);
|
|
39
|
-
}, [width, sets]);
|
|
40
|
-
return (react_1.default.createElement("g", { ref: containerRef, transform: transform },
|
|
41
|
-
react_1.default.createElement(SetsChartAxis_1.SetsChartAxis, { width: width }),
|
|
42
|
-
sets.map(function (set, i) {
|
|
43
|
-
var name = set.name, size = set.size, elements = set.elements;
|
|
44
|
-
var label = labels[i];
|
|
45
|
-
var height = yScale.bandwidth();
|
|
46
|
-
var y = yScale(name) + height / 2 - constants_1.SET_BAR_HEIGHT / 2;
|
|
47
|
-
var lineY = yScale(name) + height;
|
|
48
|
-
var barSize = hoveredElements ? elements.filter(function (el) { return hoveredElements.includes(el); }).length : size;
|
|
49
|
-
return (react_1.default.createElement("g", { key: "set-group-".concat(i) },
|
|
50
|
-
react_1.default.createElement("rect", { className: styles.setsBarBackground, x: 0, y: y, width: width, height: constants_1.SET_BAR_HEIGHT }),
|
|
51
|
-
react_1.default.createElement("rect", { className: styles.setsBarDimmed, x: width - xScale(size), y: y, width: xScale(size), height: constants_1.SET_BAR_HEIGHT }),
|
|
52
|
-
react_1.default.createElement("rect", { className: styles.setsBar, x: width - xScale(barSize), y: y, width: xScale(barSize), height: constants_1.SET_BAR_HEIGHT }),
|
|
53
|
-
i !== sets.length - 1 && (react_1.default.createElement("line", { className: styles.gridLine, x1: 0, x2: hoverAreaWidth, y1: lineY, y2: lineY })),
|
|
54
|
-
react_1.default.createElement("text", { className: styles.setsLabel, x: width + constants_1.TEXT_GAP, y: yScale(name) + height / 2 }, label),
|
|
55
|
-
react_1.default.createElement("rect", { className: styles.hoverBar, "data-reltio-id": "set-hover-area", x: -constants_1.GAP_BEFORE_LEFT_BAR + 1, y: yScale(name), width: hoverAreaWidth - 2, height: height, onMouseEnter: function () { return onSetHover(set); }, onMouseLeave: function () { return onSetHover(null); } })));
|
|
56
|
-
})));
|
|
57
|
-
};
|
|
58
|
-
exports.SetsChart = SetsChart;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SetsChart } from './SetsChart';
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SetsChart = void 0;
|
|
4
|
-
var SetsChart_1 = require("./SetsChart");
|
|
5
|
-
Object.defineProperty(exports, "SetsChart", { enumerable: true, get: function () { return SetsChart_1.SetsChart; } });
|