@reltio/components 1.4.1998 → 1.4.2000
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/UpSetChart/UpSetChart.d.ts +5 -8
- package/cjs/UpSetChart/UpSetChart.js +61 -5
- package/cjs/UpSetChart/UpSetChart.test.js +198 -0
- package/cjs/UpSetChart/components/IntersectionsChart/IntersectionsChart.d.ts +15 -0
- package/cjs/UpSetChart/components/IntersectionsChart/IntersectionsChart.js +66 -0
- package/cjs/UpSetChart/components/IntersectionsChart/index.d.ts +1 -0
- package/cjs/UpSetChart/components/IntersectionsChart/index.js +5 -0
- package/cjs/UpSetChart/components/IntersectionsChart/styles.d.ts +1 -0
- package/cjs/UpSetChart/components/IntersectionsChart/styles.js +32 -0
- package/cjs/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.d.ts +10 -0
- package/cjs/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.js +64 -0
- package/cjs/UpSetChart/components/IntersectionsChartAxis/index.d.ts +1 -0
- package/cjs/UpSetChart/components/IntersectionsChartAxis/index.js +5 -0
- package/cjs/UpSetChart/components/IntersectionsChartAxis/styles.d.ts +1 -0
- package/cjs/UpSetChart/components/IntersectionsChartAxis/styles.js +32 -0
- package/cjs/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.d.ts +13 -0
- package/cjs/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.js +56 -0
- package/cjs/UpSetChart/components/IntersectionsMatrix/index.d.ts +1 -0
- package/cjs/UpSetChart/components/IntersectionsMatrix/index.js +5 -0
- package/cjs/UpSetChart/components/IntersectionsMatrix/styles.d.ts +1 -0
- package/cjs/UpSetChart/components/IntersectionsMatrix/styles.js +27 -0
- package/cjs/UpSetChart/components/SetsChart/SetsChart.d.ts +15 -0
- package/cjs/UpSetChart/components/SetsChart/SetsChart.js +58 -0
- package/cjs/UpSetChart/components/SetsChart/index.d.ts +1 -0
- package/cjs/UpSetChart/components/SetsChart/index.js +5 -0
- package/cjs/UpSetChart/components/SetsChart/styles.d.ts +1 -0
- package/cjs/UpSetChart/components/SetsChart/styles.js +43 -0
- package/cjs/UpSetChart/components/SetsChartAxis/SetsChartAxis.d.ts +6 -0
- package/cjs/UpSetChart/components/SetsChartAxis/SetsChartAxis.js +20 -0
- package/cjs/UpSetChart/components/SetsChartAxis/index.d.ts +1 -0
- package/cjs/UpSetChart/components/SetsChartAxis/index.js +5 -0
- package/cjs/UpSetChart/components/SetsChartAxis/styles.d.ts +1 -0
- package/cjs/UpSetChart/components/SetsChartAxis/styles.js +17 -0
- package/cjs/UpSetChart/constants.d.ts +16 -3
- package/cjs/UpSetChart/constants.js +20 -4
- package/cjs/UpSetChart/gameOfThrones.test-data.d.ts +4 -0
- package/cjs/UpSetChart/gameOfThrones.test-data.js +26 -0
- package/cjs/UpSetChart/helpers.d.ts +20 -0
- package/cjs/UpSetChart/helpers.js +127 -0
- package/cjs/UpSetChart/styles.d.ts +4 -1
- package/cjs/UpSetChart/styles.js +11 -12
- package/cjs/UpSetChart/types.d.ts +16 -0
- package/cjs/UpSetChart/types.js +2 -0
- package/cjs/UpSetChart/useUpSetChartSizes.d.ts +20 -0
- package/cjs/UpSetChart/useUpSetChartSizes.js +34 -0
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +36 -0
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.test-data.js +288 -0
- package/cjs/features/crosswalks/AttributesTable/AttributesTable.test.js +708 -370
- package/cjs/features/crosswalks/ColoredBlock/ColoredBlock.test.js +77 -15
- package/cjs/features/crosswalks/CopyableValueField/CopyableValueField.test.js +85 -15
- package/cjs/features/crosswalks/CrosswalkAttributes/CrosswalkAttributes.test.js +265 -193
- package/cjs/features/crosswalks/CrosswalkDateEditor/CrosswalkDateEditor.test.js +106 -12
- package/cjs/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.test.js +21 -9
- package/cjs/features/crosswalks/CrosswalkEditor/CrosswalkEditor.test.js +190 -90
- package/cjs/features/crosswalks/CrosswalkRow/CrosswalkRow.test.js +323 -225
- package/cjs/features/crosswalks/ShowDependentLink/ShowDependentLink.test.js +75 -12
- package/cjs/features/crosswalks/SourceCrosswalksRow/SourceCrosswalksRow.test.js +171 -138
- package/esm/UpSetChart/UpSetChart.d.ts +5 -8
- package/esm/UpSetChart/UpSetChart.js +38 -5
- package/esm/UpSetChart/UpSetChart.test.js +193 -0
- package/esm/UpSetChart/components/IntersectionsChart/IntersectionsChart.d.ts +15 -0
- package/esm/UpSetChart/components/IntersectionsChart/IntersectionsChart.js +39 -0
- package/esm/UpSetChart/components/IntersectionsChart/index.d.ts +1 -0
- package/esm/UpSetChart/components/IntersectionsChart/index.js +1 -0
- package/esm/UpSetChart/components/IntersectionsChart/styles.d.ts +1 -0
- package/esm/UpSetChart/components/IntersectionsChart/styles.js +29 -0
- package/esm/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.d.ts +10 -0
- package/esm/UpSetChart/components/IntersectionsChartAxis/IntersectionsChartAxis.js +34 -0
- package/esm/UpSetChart/components/IntersectionsChartAxis/index.d.ts +1 -0
- package/esm/UpSetChart/components/IntersectionsChartAxis/index.js +1 -0
- package/esm/UpSetChart/components/IntersectionsChartAxis/styles.d.ts +1 -0
- package/esm/UpSetChart/components/IntersectionsChartAxis/styles.js +29 -0
- package/esm/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.d.ts +13 -0
- package/esm/UpSetChart/components/IntersectionsMatrix/IntersectionsMatrix.js +26 -0
- package/esm/UpSetChart/components/IntersectionsMatrix/index.d.ts +1 -0
- package/esm/UpSetChart/components/IntersectionsMatrix/index.js +1 -0
- package/esm/UpSetChart/components/IntersectionsMatrix/styles.d.ts +1 -0
- package/esm/UpSetChart/components/IntersectionsMatrix/styles.js +24 -0
- package/esm/UpSetChart/components/SetsChart/SetsChart.d.ts +15 -0
- package/esm/UpSetChart/components/SetsChart/SetsChart.js +31 -0
- package/esm/UpSetChart/components/SetsChart/index.d.ts +1 -0
- package/esm/UpSetChart/components/SetsChart/index.js +1 -0
- package/esm/UpSetChart/components/SetsChart/styles.d.ts +1 -0
- package/esm/UpSetChart/components/SetsChart/styles.js +40 -0
- package/esm/UpSetChart/components/SetsChartAxis/SetsChartAxis.d.ts +6 -0
- package/esm/UpSetChart/components/SetsChartAxis/SetsChartAxis.js +13 -0
- package/esm/UpSetChart/components/SetsChartAxis/index.d.ts +1 -0
- package/esm/UpSetChart/components/SetsChartAxis/index.js +1 -0
- package/esm/UpSetChart/components/SetsChartAxis/styles.d.ts +1 -0
- package/esm/UpSetChart/components/SetsChartAxis/styles.js +14 -0
- package/esm/UpSetChart/constants.d.ts +16 -3
- package/esm/UpSetChart/constants.js +19 -3
- package/esm/UpSetChart/gameOfThrones.test-data.d.ts +4 -0
- package/esm/UpSetChart/gameOfThrones.test-data.js +23 -0
- package/esm/UpSetChart/helpers.d.ts +20 -0
- package/esm/UpSetChart/helpers.js +120 -0
- package/esm/UpSetChart/styles.d.ts +4 -1
- package/esm/UpSetChart/styles.js +11 -12
- package/esm/UpSetChart/types.d.ts +16 -0
- package/esm/UpSetChart/useUpSetChartSizes.d.ts +20 -0
- package/esm/UpSetChart/useUpSetChartSizes.js +30 -0
- package/esm/features/crosswalks/AttributesTable/AttributesTable.test-data.d.ts +36 -0
- package/esm/features/crosswalks/AttributesTable/AttributesTable.test-data.js +283 -0
- package/esm/features/crosswalks/AttributesTable/AttributesTable.test.js +711 -350
- package/esm/features/crosswalks/ColoredBlock/ColoredBlock.test.js +77 -15
- package/esm/features/crosswalks/CopyableValueField/CopyableValueField.test.js +85 -15
- package/esm/features/crosswalks/CrosswalkAttributes/CrosswalkAttributes.test.js +266 -194
- package/esm/features/crosswalks/CrosswalkDateEditor/CrosswalkDateEditor.test.js +106 -12
- package/esm/features/crosswalks/CrosswalkDragLayer/CrosswalkDragLayer.test.js +21 -9
- package/esm/features/crosswalks/CrosswalkEditor/CrosswalkEditor.test.js +190 -90
- package/esm/features/crosswalks/CrosswalkRow/CrosswalkRow.test.js +324 -226
- package/esm/features/crosswalks/ShowDependentLink/ShowDependentLink.test.js +75 -12
- package/esm/features/crosswalks/SourceCrosswalksRow/SourceCrosswalksRow.test.js +171 -138
- package/package.json +1 -1
- package/cjs/features/crosswalks/AttributesTable/IntegrationAttributesTable.test-data.d.ts +0 -3
- package/cjs/features/crosswalks/AttributesTable/IntegrationAttributesTable.test-data.js +0 -52
- package/cjs/features/crosswalks/AttributesTable/IntegrationAttributesTable.test.js +0 -323
- package/cjs/features/crosswalks/AttributesTable/components/AddAttributesButton/AddAttributesButton.test.js +0 -142
- package/cjs/features/crosswalks/AttributesTable/components/AttributeValuesRenderer/AttributeValuesRenderer.test.js +0 -146
- package/cjs/features/crosswalks/AttributesTable/components/AttributesHeadCellRenderer/AttributesHeadCellRenderer.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/AttributesHeadCellRenderer/AttributesHeadCellRenderer.test.js +0 -50
- package/cjs/features/crosswalks/AttributesTable/components/ConfirmEditIgnoredDialog/ConfirmEditIgnoredDialog.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/ConfirmEditIgnoredDialog/ConfirmEditIgnoredDialog.test.js +0 -58
- package/cjs/features/crosswalks/AttributesTable/components/CountRenderer/CountRenderer.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/CountRenderer/CountRenderer.test.js +0 -14
- package/cjs/features/crosswalks/AttributesTable/components/ImageAttributesRenderer/ImageAttributesRenderer.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/ImageAttributesRenderer/ImageAttributesRenderer.test.js +0 -110
- package/cjs/features/crosswalks/AttributesTable/components/NestedAttributesRenderer/NestedAttributesRenderer.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/NestedAttributesRenderer/NestedAttributesRenderer.test.js +0 -111
- package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.test.js +0 -67
- package/cjs/features/crosswalks/AttributesTable/components/ReferenceAttributesRenderer/ReferenceAttributesRenderer.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/ReferenceAttributesRenderer/ReferenceAttributesRenderer.test.js +0 -193
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.test.js +0 -22
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.test.js +0 -58
- package/cjs/features/crosswalks/AttributesTable/components/SimpleAttributesRenderer/SimpleAttributesRenderer.test.d.ts +0 -1
- package/cjs/features/crosswalks/AttributesTable/components/SimpleAttributesRenderer/SimpleAttributesRenderer.test.js +0 -69
- package/cjs/features/crosswalks/CrosswalkDateEditor/IntegrationCrosswalkDateEditor.test.d.ts +0 -1
- package/cjs/features/crosswalks/CrosswalkDateEditor/IntegrationCrosswalkDateEditor.test.js +0 -137
- package/cjs/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.test.d.ts +0 -1
- package/cjs/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.test.js +0 -56
- package/esm/features/crosswalks/AttributesTable/IntegrationAttributesTable.test-data.d.ts +0 -3
- package/esm/features/crosswalks/AttributesTable/IntegrationAttributesTable.test-data.js +0 -47
- package/esm/features/crosswalks/AttributesTable/IntegrationAttributesTable.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/IntegrationAttributesTable.test.js +0 -318
- package/esm/features/crosswalks/AttributesTable/components/AddAttributesButton/AddAttributesButton.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/AddAttributesButton/AddAttributesButton.test.js +0 -137
- package/esm/features/crosswalks/AttributesTable/components/AttributeValuesRenderer/AttributeValuesRenderer.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/AttributeValuesRenderer/AttributeValuesRenderer.test.js +0 -141
- package/esm/features/crosswalks/AttributesTable/components/AttributesHeadCellRenderer/AttributesHeadCellRenderer.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/AttributesHeadCellRenderer/AttributesHeadCellRenderer.test.js +0 -45
- package/esm/features/crosswalks/AttributesTable/components/ConfirmEditIgnoredDialog/ConfirmEditIgnoredDialog.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/ConfirmEditIgnoredDialog/ConfirmEditIgnoredDialog.test.js +0 -53
- package/esm/features/crosswalks/AttributesTable/components/CountRenderer/CountRenderer.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/CountRenderer/CountRenderer.test.js +0 -9
- package/esm/features/crosswalks/AttributesTable/components/ImageAttributesRenderer/ImageAttributesRenderer.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/ImageAttributesRenderer/ImageAttributesRenderer.test.js +0 -105
- package/esm/features/crosswalks/AttributesTable/components/NestedAttributesRenderer/NestedAttributesRenderer.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/NestedAttributesRenderer/NestedAttributesRenderer.test.js +0 -106
- package/esm/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/OvValuesRenderer/OvValuesRenderer.test.js +0 -62
- package/esm/features/crosswalks/AttributesTable/components/ReferenceAttributesRenderer/ReferenceAttributesRenderer.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/ReferenceAttributesRenderer/ReferenceAttributesRenderer.test.js +0 -188
- package/esm/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/RuleTypeInfoButton/RuleTypeInfoButton.test.js +0 -17
- package/esm/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/RuleTypeRenderer/RuleTypeRenderer.test.js +0 -53
- package/esm/features/crosswalks/AttributesTable/components/SimpleAttributesRenderer/SimpleAttributesRenderer.test.d.ts +0 -1
- package/esm/features/crosswalks/AttributesTable/components/SimpleAttributesRenderer/SimpleAttributesRenderer.test.js +0 -64
- package/esm/features/crosswalks/CrosswalkDateEditor/IntegrationCrosswalkDateEditor.test.d.ts +0 -1
- package/esm/features/crosswalks/CrosswalkDateEditor/IntegrationCrosswalkDateEditor.test.js +0 -132
- package/esm/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.test.d.ts +0 -1
- package/esm/features/crosswalks/CrosswalkDragLayer/components/CrosswalkDragPreview/CrosswalkDragPreview.test.js +0 -28
- /package/cjs/{features/crosswalks/AttributesTable/IntegrationAttributesTable.test.d.ts → UpSetChart/UpSetChart.test.d.ts} +0 -0
- /package/{cjs/features/crosswalks/AttributesTable/components/AddAttributesButton/AddAttributesButton.test.d.ts → esm/UpSetChart/UpSetChart.test.d.ts} +0 -0
- /package/{cjs/features/crosswalks/AttributesTable/components/AttributeValuesRenderer/AttributeValuesRenderer.test.d.ts → esm/UpSetChart/types.js} +0 -0
|
@@ -1,25 +1,88 @@
|
|
|
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 __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
|
+
};
|
|
2
49
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
51
|
};
|
|
5
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
53
|
var react_1 = __importDefault(require("react"));
|
|
7
|
-
var
|
|
8
|
-
var
|
|
54
|
+
var react_2 = require("@testing-library/react");
|
|
55
|
+
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
9
56
|
var ShowDependentLink_1 = require("./ShowDependentLink");
|
|
57
|
+
var onClick = jest.fn();
|
|
58
|
+
var props = {
|
|
59
|
+
showMore: true,
|
|
60
|
+
onClick: onClick
|
|
61
|
+
};
|
|
10
62
|
describe('ShowDependentLink tests', function () {
|
|
11
63
|
it('should render "View dependent crosswalks" link for props.showMore=true', function () {
|
|
12
|
-
|
|
13
|
-
expect(
|
|
64
|
+
(0, react_2.render)(react_1.default.createElement(ShowDependentLink_1.ShowDependentLink, __assign({}, props)));
|
|
65
|
+
expect(react_2.screen.getByText('View dependent crosswalks')).toBeInTheDocument();
|
|
66
|
+
expect(react_2.screen.queryByText('Hide dependent crosswalks')).not.toBeInTheDocument();
|
|
14
67
|
});
|
|
15
68
|
it('should render "Hide dependent crosswalks" link for props.showMore=false', function () {
|
|
16
|
-
|
|
17
|
-
expect(
|
|
18
|
-
|
|
19
|
-
it('should render call props.onClick on link click', function () {
|
|
20
|
-
var onClick = jest.fn();
|
|
21
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(ShowDependentLink_1.ShowDependentLink, { showMore: true, onClick: onClick }));
|
|
22
|
-
wrapper.find(Link_1.default).simulate('click');
|
|
23
|
-
expect(onClick).toHaveBeenCalled();
|
|
69
|
+
(0, react_2.render)(react_1.default.createElement(ShowDependentLink_1.ShowDependentLink, __assign({}, props, { showMore: false })));
|
|
70
|
+
expect(react_2.screen.getByText('Hide dependent crosswalks')).toBeInTheDocument();
|
|
71
|
+
expect(react_2.screen.queryByText('View dependent crosswalks')).not.toBeInTheDocument();
|
|
24
72
|
});
|
|
73
|
+
it('should render call props.onClick on link click', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
74
|
+
var user;
|
|
75
|
+
return __generator(this, function (_a) {
|
|
76
|
+
switch (_a.label) {
|
|
77
|
+
case 0:
|
|
78
|
+
user = user_event_1.default.setup();
|
|
79
|
+
(0, react_2.render)(react_1.default.createElement(ShowDependentLink_1.ShowDependentLink, __assign({}, props)));
|
|
80
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('button'))];
|
|
81
|
+
case 1:
|
|
82
|
+
_a.sent();
|
|
83
|
+
expect(onClick).toHaveBeenCalled();
|
|
84
|
+
return [2 /*return*/];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}); });
|
|
25
88
|
});
|
|
@@ -33,20 +33,75 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
33
33
|
__setModuleDefault(result, mod);
|
|
34
34
|
return result;
|
|
35
35
|
};
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
+
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);
|
|
47
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
|
+
function step(op) {
|
|
50
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
51
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
52
|
+
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;
|
|
53
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
54
|
+
switch (op[0]) {
|
|
55
|
+
case 0: case 1: t = op; break;
|
|
56
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
57
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
58
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
59
|
+
default:
|
|
60
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
61
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
62
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
63
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
64
|
+
if (t[2]) _.ops.pop();
|
|
65
|
+
_.trys.pop(); continue;
|
|
66
|
+
}
|
|
67
|
+
op = body.call(thisArg, _);
|
|
68
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
69
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
|
+
}
|
|
71
|
+
};
|
|
36
72
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
73
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
74
|
};
|
|
39
75
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
76
|
var react_1 = __importDefault(require("react"));
|
|
41
|
-
var
|
|
42
|
-
var
|
|
77
|
+
var react_2 = require("@testing-library/react");
|
|
78
|
+
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
79
|
+
var styles_1 = require("@mui/styles");
|
|
80
|
+
var styles_2 = require("@mui/material/styles");
|
|
43
81
|
var CrosswalksDisplay = __importStar(require("../../../contexts/CrosswalksDisplayContext"));
|
|
44
|
-
var DummyCrosswalkRow_1 = require("../DummyCrosswalkRow");
|
|
45
|
-
var ShowDependentLink_1 = require("../ShowDependentLink");
|
|
46
|
-
var CrosswalkRow_1 = require("../CrosswalkRow");
|
|
47
82
|
var SourceCrosswalksRow_1 = require("./SourceCrosswalksRow");
|
|
83
|
+
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
84
|
+
var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
|
|
85
|
+
jest.unmock('@mui/styles');
|
|
86
|
+
jest.mock('react-dnd', function () { return (__assign(__assign({}, jest.requireActual('react-dnd')), { useDrag: jest.fn().mockReturnValue([undefined, function () { return null; }, jest.fn()]) })); });
|
|
87
|
+
var metadata = {
|
|
88
|
+
sources: [
|
|
89
|
+
{
|
|
90
|
+
uri: 'configuration/sources/FB',
|
|
91
|
+
label: 'Facebook',
|
|
92
|
+
icon: 'images/source/fb.png',
|
|
93
|
+
abbreviation: 'Facebook'
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
uri: 'configuration/sources/Reltio',
|
|
97
|
+
label: 'Reltio',
|
|
98
|
+
icon: 'images/source/reltio.png',
|
|
99
|
+
abbreviation: 'Reltio'
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
};
|
|
48
103
|
describe('SourceCrosswalksRow tests', function () {
|
|
49
|
-
var
|
|
104
|
+
var defaultProps = {
|
|
50
105
|
source: 'configuration/sources/FB',
|
|
51
106
|
onEdit: jest.fn(),
|
|
52
107
|
onDelete: jest.fn(),
|
|
@@ -54,71 +109,49 @@ describe('SourceCrosswalksRow tests', function () {
|
|
|
54
109
|
showCrosswalkColors: true,
|
|
55
110
|
disableEditCrosswalk: false,
|
|
56
111
|
disableDeleteCrosswalk: false,
|
|
57
|
-
onToggleExpanded: jest.fn()
|
|
58
|
-
|
|
59
|
-
var useHighlightedCrosswalksMock = jest.spyOn(CrosswalksDisplay, 'useHighlightedCrosswalks').mockReturnValue([]);
|
|
60
|
-
beforeAll(function () {
|
|
61
|
-
jest.spyOn(CrosswalkRow_1.CrosswalkRow, 'type').mockImplementation(EmptyStub_1.EmptyStub);
|
|
62
|
-
});
|
|
63
|
-
it('should render dummy crosswalk if no simple and empty crosswalks, and show more link', function () {
|
|
64
|
-
var crosswalksByTypes = {
|
|
112
|
+
onToggleExpanded: jest.fn(),
|
|
113
|
+
crosswalksByTypes: {
|
|
65
114
|
empty: [],
|
|
66
115
|
simple: [],
|
|
67
116
|
dependent: [
|
|
68
117
|
{
|
|
69
118
|
uri: 'entities/2/crosswalks/1',
|
|
70
119
|
value: '456',
|
|
71
|
-
type: 'configuration/sources/
|
|
120
|
+
type: 'configuration/sources/Reltio'
|
|
72
121
|
}
|
|
73
122
|
]
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
var setUp = function (props) {
|
|
126
|
+
if (props === void 0) { props = defaultProps; }
|
|
127
|
+
var user = user_event_1.default.setup({ delay: null });
|
|
128
|
+
var Providers = function (_a) {
|
|
129
|
+
var children = _a.children;
|
|
130
|
+
return (react_1.default.createElement(MdmModuleContext_1.MdmModuleProvider, { values: { metadata: metadata } },
|
|
131
|
+
react_1.default.createElement(styles_1.ThemeProvider, { theme: (0, styles_2.createTheme)(mdm_sdk_1.theme) }, children)));
|
|
74
132
|
};
|
|
75
|
-
var
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
133
|
+
var renderer = (0, react_2.render)(react_1.default.createElement(SourceCrosswalksRow_1.SourceCrosswalksRow, __assign({}, props)), { wrapper: Providers });
|
|
134
|
+
return __assign(__assign({}, renderer), { user: user });
|
|
135
|
+
};
|
|
136
|
+
var useHighlightedCrosswalksMock = jest.spyOn(CrosswalksDisplay, 'useHighlightedCrosswalks').mockReturnValue([]);
|
|
137
|
+
it('should render dummy crosswalk if no simple and empty crosswalks, and show more link', function () {
|
|
138
|
+
setUp();
|
|
139
|
+
expect(react_2.screen.getByText('Facebook')).toBeInTheDocument();
|
|
140
|
+
expect(react_2.screen.getByText('View dependent crosswalks')).toBeInTheDocument();
|
|
81
141
|
});
|
|
82
142
|
it('should render dummy crosswalk and dependent if no simple and empty crosswalks, and show less link', function () {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
{
|
|
88
|
-
uri: 'entities/2/crosswalks/1',
|
|
89
|
-
value: '456',
|
|
90
|
-
type: 'configuration/sources/FB'
|
|
91
|
-
}
|
|
92
|
-
]
|
|
93
|
-
};
|
|
94
|
-
var wrapper = (0, enzyme_1.shallow)(react_1.default.createElement(SourceCrosswalksRow_1.SourceCrosswalksRow, __assign({}, props, { crosswalksByTypes: crosswalksByTypes, expanded: true })));
|
|
95
|
-
expect(wrapper.find(DummyCrosswalkRow_1.DummyCrosswalkRow).props()).toEqual({
|
|
96
|
-
crosswalkType: props.source,
|
|
97
|
-
focusable: props.crosswalksFocusEnabled
|
|
98
|
-
});
|
|
99
|
-
expect(wrapper.find(CrosswalkRow_1.CrosswalkRow).props()).toEqual({
|
|
100
|
-
crosswalk: {
|
|
101
|
-
uri: 'entities/2/crosswalks/1',
|
|
102
|
-
value: '456',
|
|
103
|
-
type: 'configuration/sources/FB'
|
|
104
|
-
},
|
|
105
|
-
isDependent: true,
|
|
106
|
-
disableEdit: props.disableEditCrosswalk,
|
|
107
|
-
disableDelete: props.disableDeleteCrosswalk,
|
|
108
|
-
onDelete: props.onDelete,
|
|
109
|
-
onEdit: props.onEdit,
|
|
110
|
-
isColored: props.showCrosswalkColors,
|
|
111
|
-
focusable: props.crosswalksFocusEnabled
|
|
112
|
-
});
|
|
113
|
-
expect(wrapper.find(ShowDependentLink_1.ShowDependentLink).prop('showMore')).toBe(false);
|
|
143
|
+
setUp(__assign(__assign({}, defaultProps), { expanded: true }));
|
|
144
|
+
expect(react_2.screen.getByText('Facebook')).toBeInTheDocument();
|
|
145
|
+
expect(react_2.screen.getByText('Reltio')).toBeInTheDocument();
|
|
146
|
+
expect(react_2.screen.getByText('Hide dependent crosswalks')).toBeInTheDocument();
|
|
114
147
|
});
|
|
115
|
-
it('should render
|
|
148
|
+
it('should render simple crosswalk and then empty crosswalks if present', function () {
|
|
116
149
|
var crosswalksByTypes = {
|
|
117
150
|
empty: [
|
|
118
151
|
{
|
|
119
152
|
uri: 'entities/2/crosswalks/1',
|
|
120
153
|
value: '123',
|
|
121
|
-
type: 'configuration/sources/
|
|
154
|
+
type: 'configuration/sources/Reltio'
|
|
122
155
|
}
|
|
123
156
|
],
|
|
124
157
|
simple: [
|
|
@@ -130,85 +163,85 @@ describe('SourceCrosswalksRow tests', function () {
|
|
|
130
163
|
],
|
|
131
164
|
dependent: []
|
|
132
165
|
};
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
expect(
|
|
137
|
-
expect(
|
|
138
|
-
|
|
139
|
-
uri: 'entities/2/crosswalks/2',
|
|
140
|
-
value: '456',
|
|
141
|
-
type: 'configuration/sources/FB'
|
|
142
|
-
},
|
|
143
|
-
disableEdit: props.disableEditCrosswalk,
|
|
144
|
-
disableDelete: props.disableDeleteCrosswalk,
|
|
145
|
-
onDelete: props.onDelete,
|
|
146
|
-
onEdit: props.onEdit,
|
|
147
|
-
isColored: props.showCrosswalkColors,
|
|
148
|
-
focusable: props.crosswalksFocusEnabled
|
|
149
|
-
});
|
|
150
|
-
expect(crosswalks.at(1).props()).toEqual({
|
|
151
|
-
crosswalk: {
|
|
152
|
-
uri: 'entities/2/crosswalks/1',
|
|
153
|
-
value: '123',
|
|
154
|
-
type: 'configuration/sources/FB'
|
|
155
|
-
},
|
|
156
|
-
isEmpty: true,
|
|
157
|
-
disableEdit: props.disableEditCrosswalk,
|
|
158
|
-
disableDelete: props.disableDeleteCrosswalk,
|
|
159
|
-
onDelete: props.onDelete,
|
|
160
|
-
onEdit: props.onEdit,
|
|
161
|
-
isColored: props.showCrosswalkColors,
|
|
162
|
-
focusable: props.crosswalksFocusEnabled
|
|
163
|
-
});
|
|
164
|
-
expect(wrapper.find(ShowDependentLink_1.ShowDependentLink)).toHaveLength(0);
|
|
166
|
+
setUp(__assign(__assign({}, defaultProps), { crosswalksByTypes: crosswalksByTypes }));
|
|
167
|
+
var blocks = react_2.screen.getAllByTestId('cw-colored-block');
|
|
168
|
+
expect((0, react_2.within)(blocks[0]).getByText('Facebook')).toBeInTheDocument();
|
|
169
|
+
expect((0, react_2.within)(blocks[0]).getByText('456')).toBeInTheDocument();
|
|
170
|
+
expect((0, react_2.within)(blocks[1]).getByText('Reltio')).toBeInTheDocument();
|
|
171
|
+
expect((0, react_2.within)(blocks[1]).getByText('123')).toBeInTheDocument();
|
|
165
172
|
});
|
|
166
|
-
it('should disable editing in CrosswalkRow if props.disableEditCrosswalk = true', function () {
|
|
167
|
-
var crosswalksByTypes
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
173
|
+
it('should disable editing in CrosswalkRow if props.disableEditCrosswalk = true', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
174
|
+
var crosswalksByTypes, user;
|
|
175
|
+
return __generator(this, function (_a) {
|
|
176
|
+
switch (_a.label) {
|
|
177
|
+
case 0:
|
|
178
|
+
crosswalksByTypes = {
|
|
179
|
+
empty: [
|
|
180
|
+
{
|
|
181
|
+
uri: 'entities/2/crosswalks/1',
|
|
182
|
+
value: '123',
|
|
183
|
+
type: 'configuration/sources/FB'
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
simple: [
|
|
187
|
+
{
|
|
188
|
+
uri: 'entities/2/crosswalks/2',
|
|
189
|
+
value: '456',
|
|
190
|
+
type: 'configuration/sources/FB'
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
dependent: []
|
|
194
|
+
};
|
|
195
|
+
user = setUp(__assign(__assign({}, defaultProps), { crosswalksByTypes: crosswalksByTypes, disableEditCrosswalk: true })).user;
|
|
196
|
+
return [4 /*yield*/, user.click(react_2.screen.getAllByTestId('arrow-expand-button')[0])];
|
|
197
|
+
case 1:
|
|
198
|
+
_a.sent();
|
|
199
|
+
return [4 /*yield*/, user.click(react_2.screen.getAllByTestId('arrow-expand-button')[1])];
|
|
200
|
+
case 2:
|
|
201
|
+
_a.sent();
|
|
202
|
+
expect(react_2.screen.queryByText('Add attributes')).not.toBeInTheDocument();
|
|
203
|
+
return [2 /*return*/];
|
|
204
|
+
}
|
|
187
205
|
});
|
|
188
|
-
});
|
|
189
|
-
it('should disable deleting in CrosswalkRow if props.disableDeleteCrosswalk = true', function () {
|
|
190
|
-
var crosswalksByTypes
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
206
|
+
}); });
|
|
207
|
+
it('should disable deleting in CrosswalkRow if props.disableDeleteCrosswalk = true', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
208
|
+
var crosswalksByTypes, user;
|
|
209
|
+
return __generator(this, function (_a) {
|
|
210
|
+
switch (_a.label) {
|
|
211
|
+
case 0:
|
|
212
|
+
crosswalksByTypes = {
|
|
213
|
+
empty: [
|
|
214
|
+
{
|
|
215
|
+
uri: 'entities/2/crosswalks/1',
|
|
216
|
+
value: '123',
|
|
217
|
+
type: 'configuration/sources/FB'
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
simple: [
|
|
221
|
+
{
|
|
222
|
+
uri: 'entities/2/crosswalks/2',
|
|
223
|
+
value: '456',
|
|
224
|
+
type: 'configuration/sources/FB'
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
dependent: []
|
|
228
|
+
};
|
|
229
|
+
user = setUp(__assign(__assign({}, defaultProps), { crosswalksByTypes: crosswalksByTypes, disableDeleteCrosswalk: true })).user;
|
|
230
|
+
return [4 /*yield*/, user.click(react_2.screen.getAllByTestId('arrow-expand-button')[0])];
|
|
231
|
+
case 1:
|
|
232
|
+
_a.sent();
|
|
233
|
+
expect((0, react_2.within)(react_2.screen.getByLabelText("You don't have permissions to delete")).getByRole('button')).toBeDisabled();
|
|
234
|
+
return [4 /*yield*/, user.click(react_2.screen.getAllByTestId('arrow-expand-button')[0])];
|
|
235
|
+
case 2:
|
|
236
|
+
_a.sent();
|
|
237
|
+
return [4 /*yield*/, user.click(react_2.screen.getAllByTestId('arrow-expand-button')[1])];
|
|
238
|
+
case 3:
|
|
239
|
+
_a.sent();
|
|
240
|
+
expect((0, react_2.within)(react_2.screen.getByLabelText("You don't have permissions to delete")).getByRole('button')).toBeDisabled();
|
|
241
|
+
return [2 /*return*/];
|
|
242
|
+
}
|
|
210
243
|
});
|
|
211
|
-
});
|
|
244
|
+
}); });
|
|
212
245
|
it('should not color crosswalks if props.showCrosswalkColors if false', function () {
|
|
213
246
|
var crosswalksByTypes = {
|
|
214
247
|
empty: [
|
|
@@ -227,10 +260,10 @@ describe('SourceCrosswalksRow tests', function () {
|
|
|
227
260
|
],
|
|
228
261
|
dependent: []
|
|
229
262
|
};
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
263
|
+
setUp(__assign(__assign({}, defaultProps), { crosswalksByTypes: crosswalksByTypes, expanded: true, showCrosswalkColors: false }));
|
|
264
|
+
var coloredBlocks = react_2.screen.getAllByTestId('cw-colored-block');
|
|
265
|
+
expect(getComputedStyle(coloredBlocks[0]).backgroundColor).toBe('rgb(202, 204, 209)');
|
|
266
|
+
expect(getComputedStyle(coloredBlocks[1]).backgroundColor).toBe('rgb(255, 255, 255)');
|
|
234
267
|
});
|
|
235
268
|
it('should expand crosswalks if highlighted crosswalks contains dependent crosswalk', function () {
|
|
236
269
|
var dependentCrosswalk = {
|
|
@@ -255,10 +288,10 @@ describe('SourceCrosswalksRow tests', function () {
|
|
|
255
288
|
],
|
|
256
289
|
dependent: [dependentCrosswalk]
|
|
257
290
|
};
|
|
258
|
-
var
|
|
259
|
-
expect(
|
|
291
|
+
var rerender = setUp(__assign(__assign({}, defaultProps), { crosswalksByTypes: crosswalksByTypes, crosswalksFocusEnabled: true })).rerender;
|
|
292
|
+
expect(defaultProps.onToggleExpanded).not.toHaveBeenCalled();
|
|
260
293
|
useHighlightedCrosswalksMock.mockReturnValueOnce([dependentCrosswalk]);
|
|
261
|
-
|
|
262
|
-
expect(
|
|
294
|
+
rerender(react_1.default.createElement(SourceCrosswalksRow_1.SourceCrosswalksRow, __assign({}, defaultProps, { crosswalksByTypes: crosswalksByTypes, crosswalksFocusEnabled: true, expanded: false })));
|
|
295
|
+
expect(defaultProps.onToggleExpanded).toHaveBeenCalled();
|
|
263
296
|
});
|
|
264
297
|
});
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
name: string;
|
|
4
|
-
sets: string[];
|
|
5
|
-
};
|
|
2
|
+
import { UpSetChartData } from './types';
|
|
6
3
|
type Props = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
data: UpSetChartData;
|
|
5
|
+
width?: number;
|
|
6
|
+
height?: number;
|
|
10
7
|
};
|
|
11
|
-
export declare const UpSetChart: ({ width, height
|
|
8
|
+
export declare const UpSetChart: ({ data, width, height }: Props) => React.JSX.Element;
|
|
12
9
|
export {};
|
|
@@ -1,7 +1,40 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { scaleBand } from 'd3-scale';
|
|
3
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
4
|
+
import { SetsChart } from './components/SetsChart';
|
|
5
|
+
import { IntersectionsMatrix } from './components/IntersectionsMatrix';
|
|
6
|
+
import { IntersectionsChart } from './components/IntersectionsChart';
|
|
7
|
+
import { useUpSetChartSizes } from './useUpSetChartSizes';
|
|
8
|
+
import { GAP_BEFORE_LEFT_BAR, TOP_GAP } from './constants';
|
|
9
|
+
import { findIntersections } from './helpers';
|
|
10
|
+
import { useStyles } from './styles';
|
|
2
11
|
export var UpSetChart = function (_a) {
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
12
|
+
var data = _a.data, width = _a.width, height = _a.height;
|
|
13
|
+
var styles = useStyles({ width: width, height: height });
|
|
14
|
+
var containerRef = useRef(null);
|
|
15
|
+
var _b = useState(null), hoveredSet = _b[0], setHoveredSet = _b[1];
|
|
16
|
+
var _c = useState(null), hoveredIntersection = _c[0], setHoveredIntersection = _c[1];
|
|
17
|
+
var _d = useState([width, height]), _e = _d[0], availableWidth = _e[0], availableHeight = _e[1], setAvailableSize = _d[1];
|
|
18
|
+
var _f = useMemo(function () { return findIntersections(data); }, [data]), intersections = _f.intersections, sets = _f.sets;
|
|
19
|
+
var hoveredElements = (hoveredIntersection === null || hoveredIntersection === void 0 ? void 0 : hoveredIntersection.elements) || (hoveredSet === null || hoveredSet === void 0 ? void 0 : hoveredSet.elements);
|
|
20
|
+
var tooltipTitle = hoveredIntersection === null || hoveredIntersection === void 0 ? void 0 : hoveredIntersection.sets.join(' ∩ ');
|
|
21
|
+
var _g = useUpSetChartSizes({ width: availableWidth, height: availableHeight, intersections: intersections, sets: sets }), labels = _g.labels, svgWidth = _g.svgWidth, svgHeight = _g.svgHeight, intersectionsChartWidth = _g.intersectionsChartWidth, intersectionsChartHeight = _g.intersectionsChartHeight, matrixY = _g.matrixY, matrixHeight = _g.matrixHeight, setsChartWidth = _g.setsChartWidth, leftPadding = _g.leftPadding;
|
|
22
|
+
var matrixXScale = useMemo(function () {
|
|
23
|
+
var domain = intersections.map(function (_, i) { return String(i); });
|
|
24
|
+
return scaleBand([0, intersectionsChartWidth]).domain(domain).paddingInner(0.2);
|
|
25
|
+
}, [intersections, intersectionsChartWidth]);
|
|
26
|
+
var matrixYScale = useMemo(function () {
|
|
27
|
+
var domain = sets.map(function (set) { return set.name; });
|
|
28
|
+
return scaleBand([0, matrixHeight]).domain(domain);
|
|
29
|
+
}, [sets, matrixHeight]);
|
|
30
|
+
useEffect(function () {
|
|
31
|
+
var _a = containerRef.current || {}, clientWidth = _a.clientWidth, clientHeight = _a.clientHeight;
|
|
32
|
+
setAvailableSize([clientWidth || width, clientHeight || height]);
|
|
33
|
+
}, [width, height]);
|
|
34
|
+
return (React.createElement("div", { ref: containerRef, className: styles.wrapper },
|
|
35
|
+
React.createElement(Tooltip, { title: tooltipTitle, followCursor: true },
|
|
36
|
+
React.createElement("svg", { className: styles.svg, width: svgWidth, height: svgHeight },
|
|
37
|
+
React.createElement(IntersectionsMatrix, { xScale: matrixXScale, yScale: matrixYScale, intersections: intersections, sets: sets, transform: "translate(".concat(leftPadding, ",").concat(matrixY, ")"), hoveredIntersection: hoveredIntersection }),
|
|
38
|
+
React.createElement(SetsChart, { yScale: matrixYScale, width: setsChartWidth, sets: sets, labels: labels, hoveredElements: hoveredElements, hoverAreaWidth: svgWidth, transform: "translate(".concat(GAP_BEFORE_LEFT_BAR, ",").concat(matrixY, ")"), onSetHover: setHoveredSet }),
|
|
39
|
+
React.createElement(IntersectionsChart, { xScale: matrixXScale, width: intersectionsChartWidth, height: intersectionsChartHeight, intersections: intersections, highlightedElements: hoveredElements, transform: "translate(".concat(leftPadding, ",").concat(TOP_GAP, ")"), matrixHeight: matrixHeight, onIntersectionHover: setHoveredIntersection })))));
|
|
7
40
|
};
|