datastake-daf 0.6.367 → 0.6.369
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/dist/components/index.js +127 -54
- package/package.json +1 -1
- package/src/@daf/core/components/Graphs/StakeholderMappings/index.jsx +50 -6
- package/src/@daf/core/components/Graphs/components/Edges/DefaultEdge.jsx +22 -11
- package/src/@daf/core/components/Graphs/components/Edges/TooltipEdge.jsx +24 -12
- package/src/@daf/core/components/Graphs/components/Nodes/NameNode.jsx +16 -9
- package/src/@daf/core/components/Graphs/components/Nodes/PrimaryNode.jsx +19 -6
package/dist/components/index.js
CHANGED
|
@@ -51013,12 +51013,14 @@ function DualAxesChart(_ref) {
|
|
|
51013
51013
|
});
|
|
51014
51014
|
}
|
|
51015
51015
|
|
|
51016
|
+
// components/Nodes/PrimaryNode.jsx
|
|
51016
51017
|
const MAIN_NODE_WIDTH = 300;
|
|
51017
51018
|
const MAIN_NODE_HEIGHT = 150;
|
|
51018
51019
|
function PrimaryNode({
|
|
51019
51020
|
id,
|
|
51020
51021
|
data
|
|
51021
51022
|
}) {
|
|
51023
|
+
const isPdf = data?.isPdf; // Get isPdf from data prop
|
|
51022
51024
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
51023
51025
|
children: [/*#__PURE__*/jsxRuntime.jsx(react.Handle, {
|
|
51024
51026
|
type: "source",
|
|
@@ -51037,8 +51039,9 @@ function PrimaryNode({
|
|
|
51037
51039
|
opacity: 0
|
|
51038
51040
|
}
|
|
51039
51041
|
}), /*#__PURE__*/jsxRuntime.jsxs(Style$f, {
|
|
51042
|
+
$isPdf: isPdf,
|
|
51040
51043
|
className: "flex",
|
|
51041
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
51044
|
+
children: [" ", /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
51042
51045
|
className: "left flex flex-column justify-center",
|
|
51043
51046
|
style: {
|
|
51044
51047
|
background: data.backgroundColor || "#ade9e1",
|
|
@@ -51148,13 +51151,20 @@ function PrimaryNode({
|
|
|
51148
51151
|
}
|
|
51149
51152
|
const Style$f = dt.div`
|
|
51150
51153
|
width: ${MAIN_NODE_WIDTH}px;
|
|
51154
|
+
height: ${MAIN_NODE_HEIGHT}px; /* Explicitly set height */
|
|
51151
51155
|
display: flex;
|
|
51152
51156
|
background: white;
|
|
51153
51157
|
border-radius: 8px;
|
|
51154
|
-
box-shadow: 0px 3.76px 10.03px 0px #00000014;
|
|
51155
|
-
box-shadow: 0px 1.88px 3.76px -2.51px #0000001f;
|
|
51156
51158
|
overflow: hidden;
|
|
51157
|
-
|
|
51159
|
+
/* Conditional styles for PDF vs screen */
|
|
51160
|
+
${props => props.$isPdf ? `
|
|
51161
|
+
border: 1px solid var(--base-gray-30); /* Ensure a visible border in PDF */
|
|
51162
|
+
box-shadow: none; /* Remove shadow for PDF */
|
|
51163
|
+
` : `
|
|
51164
|
+
box-shadow: 0px 3.76px 10.03px 0px #00000014, 0px 1.88px 3.76px -2.51px #0000001f, 0px 5.64px 17.56px 5.02px #0000000d;
|
|
51165
|
+
`}
|
|
51166
|
+
-webkit-print-color-adjust: exact;
|
|
51167
|
+
print-color-adjust: exact;
|
|
51158
51168
|
|
|
51159
51169
|
.left {
|
|
51160
51170
|
width: 32px;
|
|
@@ -51246,7 +51256,8 @@ PrimaryNode.propTypes = {
|
|
|
51246
51256
|
icon: PropTypes__default["default"].string,
|
|
51247
51257
|
backgroundColor: PropTypes__default["default"].string,
|
|
51248
51258
|
totalSources: PropTypes__default["default"].number,
|
|
51249
|
-
onClick: PropTypes__default["default"].func
|
|
51259
|
+
onClick: PropTypes__default["default"].func,
|
|
51260
|
+
isPdf: PropTypes__default["default"].bool
|
|
51250
51261
|
})
|
|
51251
51262
|
};
|
|
51252
51263
|
|
|
@@ -51367,7 +51378,9 @@ const Style$e = dt.div`
|
|
|
51367
51378
|
}
|
|
51368
51379
|
`;
|
|
51369
51380
|
|
|
51381
|
+
// components/Nodes/NameNode.jsx
|
|
51370
51382
|
const NAME_CARD_WIDTH = 315;
|
|
51383
|
+
const NAME_CARD_HEIGHT = 37;
|
|
51371
51384
|
const {
|
|
51372
51385
|
useToken: useToken$7
|
|
51373
51386
|
} = antd.theme;
|
|
@@ -51486,16 +51499,17 @@ function NameNode({
|
|
|
51486
51499
|
}
|
|
51487
51500
|
const Style$d = dt.div`
|
|
51488
51501
|
width: ${NAME_CARD_WIDTH}px;
|
|
51502
|
+
height: ${NAME_CARD_HEIGHT}px;
|
|
51489
51503
|
display: flex;
|
|
51490
51504
|
background: white;
|
|
51491
51505
|
border-radius: 8px;
|
|
51492
|
-
/* Box-shadows for screen */
|
|
51493
|
-
box-shadow: 0px 3.76px 10.03px 0px #00000014;
|
|
51494
|
-
box-shadow: 0px 1.88px 3.76px -2.51px #0000001f;
|
|
51495
51506
|
overflow: hidden;
|
|
51496
|
-
|
|
51497
|
-
|
|
51498
|
-
|
|
51507
|
+
${props => props.$isPdf ? `
|
|
51508
|
+
border: 1px solid var(--base-gray-30);
|
|
51509
|
+
box-shadow: none;
|
|
51510
|
+
` : `
|
|
51511
|
+
box-shadow: 0px 3.76px 10.03px 0px #00000014, 0px 1.88px 3.76px -2.51px #0000001f, 0px 5.64px 17.56px 5.02px #0000000d;
|
|
51512
|
+
`}
|
|
51499
51513
|
-webkit-print-color-adjust: exact;
|
|
51500
51514
|
print-color-adjust: exact;
|
|
51501
51515
|
|
|
@@ -51507,9 +51521,11 @@ const Style$d = dt.div`
|
|
|
51507
51521
|
}
|
|
51508
51522
|
|
|
51509
51523
|
.right {
|
|
51510
|
-
padding:
|
|
51524
|
+
padding: 0px 12px;
|
|
51511
51525
|
width: 100%;
|
|
51512
|
-
|
|
51526
|
+
display: flex;
|
|
51527
|
+
align-items: center;
|
|
51528
|
+
border-bottom: none;
|
|
51513
51529
|
}
|
|
51514
51530
|
`;
|
|
51515
51531
|
|
|
@@ -51736,6 +51752,7 @@ function ExpandedNode({
|
|
|
51736
51752
|
});
|
|
51737
51753
|
}
|
|
51738
51754
|
|
|
51755
|
+
// components/Edges/TooltipEdge.jsx
|
|
51739
51756
|
function ToolTipEdge({
|
|
51740
51757
|
sourceX,
|
|
51741
51758
|
sourceY,
|
|
@@ -51745,7 +51762,20 @@ function ToolTipEdge({
|
|
|
51745
51762
|
data,
|
|
51746
51763
|
targetPosition
|
|
51747
51764
|
}) {
|
|
51748
|
-
const
|
|
51765
|
+
const {
|
|
51766
|
+
isOnlyOne,
|
|
51767
|
+
isPdf
|
|
51768
|
+
} = data; // Destructure isPdf from data
|
|
51769
|
+
|
|
51770
|
+
const [edgePath] = isPdf && isOnlyOne // Condition for straight path in PDF for single nodes
|
|
51771
|
+
? react.getStraightPath({
|
|
51772
|
+
sourceX,
|
|
51773
|
+
sourceY,
|
|
51774
|
+
sourcePosition,
|
|
51775
|
+
targetX,
|
|
51776
|
+
targetY,
|
|
51777
|
+
targetPosition
|
|
51778
|
+
}) : react.getSmoothStepPath({
|
|
51749
51779
|
sourceX,
|
|
51750
51780
|
sourceY,
|
|
51751
51781
|
sourcePosition,
|
|
@@ -51762,8 +51792,8 @@ function ToolTipEdge({
|
|
|
51762
51792
|
});
|
|
51763
51793
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
51764
51794
|
children: [/*#__PURE__*/jsxRuntime.jsx(react.BaseEdge, {
|
|
51765
|
-
path:
|
|
51766
|
-
}), /*#__PURE__*/jsxRuntime.jsx(react.EdgeLabelRenderer, {
|
|
51795
|
+
path: edgePath
|
|
51796
|
+
}), " ", /*#__PURE__*/jsxRuntime.jsx(react.EdgeLabelRenderer, {
|
|
51767
51797
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
51768
51798
|
className: "button-edge__label nodrag nopan",
|
|
51769
51799
|
style: {
|
|
@@ -51961,6 +51991,7 @@ function VerticalPathEdge({
|
|
|
51961
51991
|
});
|
|
51962
51992
|
}
|
|
51963
51993
|
|
|
51994
|
+
// components/Edges/DefaultEdge.jsx
|
|
51964
51995
|
const ACTIVE_OPACITY = 1;
|
|
51965
51996
|
const DISABLED_OPACITY = 0.5;
|
|
51966
51997
|
const EDGE_STROKE = "#9DA4AE";
|
|
@@ -51980,12 +52011,22 @@ function DefaultEdge({
|
|
|
51980
52011
|
associatedNodes = [],
|
|
51981
52012
|
renderTooltipItems = () => [],
|
|
51982
52013
|
getTotal = () => 0,
|
|
51983
|
-
tooltipTitle
|
|
52014
|
+
tooltipTitle,
|
|
52015
|
+
isPdf // Destructure isPdf from data
|
|
51984
52016
|
} = data;
|
|
51985
52017
|
const isSelected = associatedNodes?.includes(source) && associatedNodes?.includes(target) && activeNode;
|
|
51986
52018
|
const opacity = activeNode ? isSelected ? ACTIVE_OPACITY : DISABLED_OPACITY : ACTIVE_OPACITY;
|
|
51987
52019
|
const arrowHeadId = `arrow-head-${id}`;
|
|
51988
|
-
const [edgePath] =
|
|
52020
|
+
const [edgePath] = isPdf // Use straight path for PDF
|
|
52021
|
+
? react.getStraightPath({
|
|
52022
|
+
sourceX,
|
|
52023
|
+
sourceY,
|
|
52024
|
+
sourcePosition: data.type === "left" ? react.Position.Left : react.Position.Right,
|
|
52025
|
+
targetX,
|
|
52026
|
+
targetY,
|
|
52027
|
+
targetPosition: data.type === "left" ? react.Position.Right : react.Position.Left
|
|
52028
|
+
}) : react.getSmoothStepPath({
|
|
52029
|
+
// Use smooth path for normal rendering
|
|
51989
52030
|
sourceX,
|
|
51990
52031
|
sourceY,
|
|
51991
52032
|
targetX,
|
|
@@ -52613,7 +52654,7 @@ const DATA_NODE_SIZE = {
|
|
|
52613
52654
|
},
|
|
52614
52655
|
nameNode: {
|
|
52615
52656
|
width: NAME_CARD_WIDTH,
|
|
52616
|
-
height:
|
|
52657
|
+
height: NAME_CARD_HEIGHT
|
|
52617
52658
|
}
|
|
52618
52659
|
};
|
|
52619
52660
|
function positionIconNodes(_ref) {
|
|
@@ -52678,19 +52719,40 @@ function positionDataNodes(_ref2) {
|
|
|
52678
52719
|
}
|
|
52679
52720
|
return DEFAULT_SIBLING_SPACE;
|
|
52680
52721
|
};
|
|
52681
|
-
|
|
52722
|
+
siblingSpace();
|
|
52682
52723
|
const X_SPACE_FROM_ICON_NODE = 130;
|
|
52683
|
-
|
|
52684
|
-
|
|
52685
|
-
const
|
|
52686
|
-
|
|
52687
|
-
|
|
52688
|
-
|
|
52689
|
-
|
|
52690
|
-
|
|
52691
|
-
|
|
52692
|
-
|
|
52693
|
-
|
|
52724
|
+
iconNode.position.y + ICON_NODE_HEIGHT / 2 + (hasContent ? 26.5 : type === "primaryNode" ? 15 : 16.5);
|
|
52725
|
+
let yPosition;
|
|
52726
|
+
const iconNodeHandleCenterY = iconNode.position.y + ICON_NODE_HEIGHT / 2 + (hasContent ? 10 : 0);
|
|
52727
|
+
if (type === "nameNode" && total === 1) {
|
|
52728
|
+
yPosition = iconNodeHandleCenterY - DATA_NODE_HEIGHT / 2;
|
|
52729
|
+
} else {
|
|
52730
|
+
const siblingSpace = () => {
|
|
52731
|
+
var _iconNode$data2;
|
|
52732
|
+
if (type === "primaryNode") {
|
|
52733
|
+
var _iconNode$data$childr2;
|
|
52734
|
+
if ((iconNode === null || iconNode === void 0 || (_iconNode$data$childr2 = iconNode.data.children) === null || _iconNode$data$childr2 === void 0 ? void 0 : _iconNode$data$childr2.length) === 1 && hasContent) {
|
|
52735
|
+
return SINGLE_CHILDREN_PRIMARY_WITH_CONTENT_SPACE;
|
|
52736
|
+
}
|
|
52737
|
+
return DEFAULT_PRIMARY_NODE_SPACE;
|
|
52738
|
+
}
|
|
52739
|
+
if ((iconNode === null || iconNode === void 0 || (_iconNode$data2 = iconNode.data) === null || _iconNode$data2 === void 0 || (_iconNode$data2 = _iconNode$data2.children) === null || _iconNode$data2 === void 0 ? void 0 : _iconNode$data2.length) === 0) {
|
|
52740
|
+
return NO_CHILDREN_SIBLING_SPACE;
|
|
52741
|
+
}
|
|
52742
|
+
return DEFAULT_SIBLING_SPACE;
|
|
52743
|
+
};
|
|
52744
|
+
const Y_SPACE_FROM_SIBLINGS = siblingSpace();
|
|
52745
|
+
const MIN_SPACE_REQUIRED = Y_SPACE_FROM_SIBLINGS + DATA_NODE_HEIGHT;
|
|
52746
|
+
const totalHeight = total * MIN_SPACE_REQUIRED;
|
|
52747
|
+
const startY = iconNodeHandleCenterY - totalHeight / 2;
|
|
52748
|
+
const END_Y = startY + totalHeight;
|
|
52749
|
+
const yOffset = index * MIN_SPACE_REQUIRED;
|
|
52750
|
+
yPosition = startY + yOffset;
|
|
52751
|
+
if (isAboveMainNode && END_Y >= mainNode.position.y + DATA_NODE_HEIGHT / 2) {
|
|
52752
|
+
yPosition = mainNode.position.y + DATA_NODE_HEIGHT / 2 - totalHeight + yOffset;
|
|
52753
|
+
} else if (!isAboveMainNode && startY < mainNode.position.y + DATA_NODE_HEIGHT / 2) {
|
|
52754
|
+
yPosition = mainNode.position.y + DATA_NODE_HEIGHT / 2 + yOffset;
|
|
52755
|
+
}
|
|
52694
52756
|
}
|
|
52695
52757
|
return {
|
|
52696
52758
|
x: isLeftSide ? iconNode.position.x - (DATA_NODE_WIDTH + X_SPACE_FROM_ICON_NODE) : iconNode.position.x + (X_SPACE_FROM_ICON_NODE + ICON_NODE_WIDTH),
|
|
@@ -52736,7 +52798,8 @@ function StakeholderMappings(_ref3) {
|
|
|
52736
52798
|
isEmpty: true,
|
|
52737
52799
|
name: emptyString,
|
|
52738
52800
|
icon: (data === null || data === void 0 ? void 0 : data.icon) || "DashboardStakeholder",
|
|
52739
|
-
t: t
|
|
52801
|
+
t: t,
|
|
52802
|
+
isPdf: isPdf
|
|
52740
52803
|
},
|
|
52741
52804
|
position: {
|
|
52742
52805
|
x: centerX - MAIN_NODE_WIDTH / 2,
|
|
@@ -52758,7 +52821,8 @@ function StakeholderMappings(_ref3) {
|
|
|
52758
52821
|
onClick: (data === null || data === void 0 ? void 0 : data.onClick) || undefined,
|
|
52759
52822
|
totalSources: data === null || data === void 0 ? void 0 : data.totalSources,
|
|
52760
52823
|
backgroundColor: (data === null || data === void 0 ? void 0 : data.backgroundColor) || "#ade9e1",
|
|
52761
|
-
iconColor: (data === null || data === void 0 ? void 0 : data.iconColor) || "#08949a"
|
|
52824
|
+
iconColor: (data === null || data === void 0 ? void 0 : data.iconColor) || "#08949a",
|
|
52825
|
+
isPdf: isPdf
|
|
52762
52826
|
},
|
|
52763
52827
|
position: {
|
|
52764
52828
|
x: centerX - MAIN_NODE_WIDTH / 2,
|
|
@@ -52808,11 +52872,13 @@ function StakeholderMappings(_ref3) {
|
|
|
52808
52872
|
setSelectedIconNodes(openIconNOdes.map(node => node.id));
|
|
52809
52873
|
}
|
|
52810
52874
|
const dataNodes = openIconNOdes.flatMap(node => {
|
|
52875
|
+
var _node$data, _node$data2;
|
|
52811
52876
|
const children = node.data.children || [];
|
|
52812
52877
|
const total = (children === null || children === void 0 ? void 0 : children.length) || 0;
|
|
52813
52878
|
const iconNodeId = node.id;
|
|
52879
|
+
(node === null || node === void 0 || (_node$data = node.data) === null || _node$data === void 0 ? void 0 : _node$data.content) !== undefined && (node === null || node === void 0 || (_node$data2 = node.data) === null || _node$data2 === void 0 ? void 0 : _node$data2.content) !== null;
|
|
52814
52880
|
if (children.length === 0) {
|
|
52815
|
-
var _node$
|
|
52881
|
+
var _node$data3, _node$data4, _node$data5, _node$data6, _node$data7;
|
|
52816
52882
|
iconEdges.push({
|
|
52817
52883
|
id: "".concat(node.id, "-empty"),
|
|
52818
52884
|
source: node.id,
|
|
@@ -52820,7 +52886,8 @@ function StakeholderMappings(_ref3) {
|
|
|
52820
52886
|
type: "tooltipEdge",
|
|
52821
52887
|
data: {
|
|
52822
52888
|
isEmpty: true,
|
|
52823
|
-
isOnlyOne: true
|
|
52889
|
+
isOnlyOne: true,
|
|
52890
|
+
isPdf: isPdf
|
|
52824
52891
|
},
|
|
52825
52892
|
targetHandle: node.data.order % 2 === 0 ? "left-handle-target" : "right-handle-target"
|
|
52826
52893
|
});
|
|
@@ -52830,9 +52897,10 @@ function StakeholderMappings(_ref3) {
|
|
|
52830
52897
|
type: "nameNode",
|
|
52831
52898
|
data: {
|
|
52832
52899
|
isEmpty: true,
|
|
52833
|
-
name: ((_node$
|
|
52834
|
-
icon: (_node$
|
|
52835
|
-
t: t
|
|
52900
|
+
name: ((_node$data3 = node.data) === null || _node$data3 === void 0 ? void 0 : _node$data3.emptyName) || "No".concat((_node$data4 = node.data) === null || _node$data4 === void 0 ? void 0 : _node$data4.name, " identified"),
|
|
52901
|
+
icon: (_node$data5 = node.data) === null || _node$data5 === void 0 ? void 0 : _node$data5.type,
|
|
52902
|
+
t: t,
|
|
52903
|
+
isPdf: isPdf
|
|
52836
52904
|
},
|
|
52837
52905
|
position: positionDataNodes({
|
|
52838
52906
|
isLeftSide: node.data.order % 2 !== 0,
|
|
@@ -52842,21 +52910,22 @@ function StakeholderMappings(_ref3) {
|
|
|
52842
52910
|
total: 1,
|
|
52843
52911
|
mainNode,
|
|
52844
52912
|
type: "nameNode",
|
|
52845
|
-
hasContent: (node === null || node === void 0 || (_node$
|
|
52913
|
+
hasContent: (node === null || node === void 0 || (_node$data6 = node.data) === null || _node$data6 === void 0 ? void 0 : _node$data6.content) !== undefined && (node === null || node === void 0 || (_node$data7 = node.data) === null || _node$data7 === void 0 ? void 0 : _node$data7.content) !== null ? true : false
|
|
52846
52914
|
})
|
|
52847
52915
|
}];
|
|
52848
52916
|
}
|
|
52849
52917
|
if (isPdf) {
|
|
52850
|
-
var _node$
|
|
52918
|
+
var _node$data8, _node$data9, _node$data10, _node$data11, _node$data12, _node$data13, _node$data14, _node$data15, _node$data16;
|
|
52851
52919
|
iconEdges.push({
|
|
52852
52920
|
id: "".concat(node.id, "-empty"),
|
|
52853
52921
|
source: node.id,
|
|
52854
52922
|
target: node.data.name + "-name-node",
|
|
52855
52923
|
type: "tooltipEdge",
|
|
52856
52924
|
data: {
|
|
52857
|
-
name: node === null || node === void 0 || (_node$
|
|
52858
|
-
content: node === null || node === void 0 || (_node$
|
|
52859
|
-
isOnlyOne: true
|
|
52925
|
+
name: node === null || node === void 0 || (_node$data8 = node.data) === null || _node$data8 === void 0 ? void 0 : _node$data8.name,
|
|
52926
|
+
content: node === null || node === void 0 || (_node$data9 = node.data) === null || _node$data9 === void 0 ? void 0 : _node$data9.content,
|
|
52927
|
+
isOnlyOne: true,
|
|
52928
|
+
isPdf: true
|
|
52860
52929
|
},
|
|
52861
52930
|
targetHandle: node.data.order % 2 === 0 ? "left-handle-target" : "right-handle-target"
|
|
52862
52931
|
});
|
|
@@ -52865,11 +52934,11 @@ function StakeholderMappings(_ref3) {
|
|
|
52865
52934
|
id: node.data.name + "-name-node",
|
|
52866
52935
|
type: "nameNode",
|
|
52867
52936
|
data: {
|
|
52868
|
-
name: node === null || node === void 0 || (_node$
|
|
52869
|
-
content: node === null || node === void 0 || (_node$
|
|
52870
|
-
icon: (_node$
|
|
52871
|
-
backgroundColor: node === null || node === void 0 || (_node$
|
|
52872
|
-
iconColor: node === null || node === void 0 || (_node$
|
|
52937
|
+
name: node === null || node === void 0 || (_node$data10 = node.data) === null || _node$data10 === void 0 ? void 0 : _node$data10.name,
|
|
52938
|
+
content: node === null || node === void 0 || (_node$data11 = node.data) === null || _node$data11 === void 0 ? void 0 : _node$data11.content,
|
|
52939
|
+
icon: (_node$data12 = node.data) === null || _node$data12 === void 0 ? void 0 : _node$data12.type,
|
|
52940
|
+
backgroundColor: node === null || node === void 0 || (_node$data13 = node.data) === null || _node$data13 === void 0 ? void 0 : _node$data13.activeColour,
|
|
52941
|
+
iconColor: node === null || node === void 0 || (_node$data14 = node.data) === null || _node$data14 === void 0 ? void 0 : _node$data14.hoverColor,
|
|
52873
52942
|
isPdf: true,
|
|
52874
52943
|
t: t
|
|
52875
52944
|
},
|
|
@@ -52882,12 +52951,12 @@ function StakeholderMappings(_ref3) {
|
|
|
52882
52951
|
total: 1,
|
|
52883
52952
|
mainNode,
|
|
52884
52953
|
type: "nameNode",
|
|
52885
|
-
hasContent: (node === null || node === void 0 || (_node$
|
|
52954
|
+
hasContent: (node === null || node === void 0 || (_node$data15 = node.data) === null || _node$data15 === void 0 ? void 0 : _node$data15.content) !== undefined && (node === null || node === void 0 || (_node$data16 = node.data) === null || _node$data16 === void 0 ? void 0 : _node$data16.content) !== null ? true : false
|
|
52886
52955
|
})
|
|
52887
52956
|
}];
|
|
52888
52957
|
}
|
|
52889
52958
|
return children.map((child, index) => {
|
|
52890
|
-
var _node$
|
|
52959
|
+
var _node$data17;
|
|
52891
52960
|
iconEdges.push({
|
|
52892
52961
|
id: "".concat(node.id, "-").concat(child.id),
|
|
52893
52962
|
source: node.id,
|
|
@@ -52899,7 +52968,8 @@ function StakeholderMappings(_ref3) {
|
|
|
52899
52968
|
value: child.value,
|
|
52900
52969
|
tooltipHeader: child.tooltipHeader,
|
|
52901
52970
|
tooltipLabel: (child === null || child === void 0 ? void 0 : child.tooltipLabel) || "Holding",
|
|
52902
|
-
totalSources: child.totalSources || 0
|
|
52971
|
+
totalSources: child.totalSources || 0,
|
|
52972
|
+
isPdf: isPdf
|
|
52903
52973
|
},
|
|
52904
52974
|
targetHandle: node.data.order % 2 === 0 ? "left-handle-target" : "right-handle-target"
|
|
52905
52975
|
});
|
|
@@ -52926,7 +52996,8 @@ function StakeholderMappings(_ref3) {
|
|
|
52926
52996
|
backgroundColor: child.backgroundColor || "#ade9e1",
|
|
52927
52997
|
iconColor: child.iconColor || "#08949a",
|
|
52928
52998
|
icon: child.icon || "UserCircle",
|
|
52929
|
-
content: children.length
|
|
52999
|
+
content: children.length,
|
|
53000
|
+
isPdf: isPdf
|
|
52930
53001
|
},
|
|
52931
53002
|
position: positionDataNodes({
|
|
52932
53003
|
isLeftSide,
|
|
@@ -52936,7 +53007,8 @@ function StakeholderMappings(_ref3) {
|
|
|
52936
53007
|
total,
|
|
52937
53008
|
mainNode,
|
|
52938
53009
|
type: child.type || "primaryNode",
|
|
52939
|
-
hasContent: node !== null && node !== void 0 && (_node$
|
|
53010
|
+
hasContent: node !== null && node !== void 0 && (_node$data17 = node.data) !== null && _node$data17 !== void 0 && _node$data17.content ? true : false,
|
|
53011
|
+
isPdf: isPdf
|
|
52940
53012
|
})
|
|
52941
53013
|
};
|
|
52942
53014
|
});
|
|
@@ -52950,7 +53022,8 @@ function StakeholderMappings(_ref3) {
|
|
|
52950
53022
|
type: "default",
|
|
52951
53023
|
data: {
|
|
52952
53024
|
group: child.id,
|
|
52953
|
-
type: "mainNode"
|
|
53025
|
+
type: "mainNode",
|
|
53026
|
+
isPdf: isPdf
|
|
52954
53027
|
}
|
|
52955
53028
|
};
|
|
52956
53029
|
});
|
package/package.json
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
MAIN_NODE_HEIGHT,
|
|
15
15
|
ICON_NODE_WIDTH,
|
|
16
16
|
ICON_NODE_HEIGHT,
|
|
17
|
+
NAME_CARD_HEIGHT,
|
|
17
18
|
} from "../components/Nodes/index.jsx";
|
|
18
19
|
|
|
19
20
|
const DATA_NODE_SIZE = {
|
|
@@ -27,7 +28,7 @@ const DATA_NODE_SIZE = {
|
|
|
27
28
|
},
|
|
28
29
|
nameNode: {
|
|
29
30
|
width: NAME_CARD_WIDTH,
|
|
30
|
-
height:
|
|
31
|
+
height: NAME_CARD_HEIGHT,
|
|
31
32
|
},
|
|
32
33
|
};
|
|
33
34
|
|
|
@@ -104,13 +105,46 @@ function positionDataNodes({
|
|
|
104
105
|
const END_Y = startY + totalHeight;
|
|
105
106
|
|
|
106
107
|
const yOffset = index * MIN_SPACE_REQUIRED;
|
|
108
|
+
let yPosition;
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
const iconNodeHandleCenterY = iconNode.position.y + (ICON_NODE_HEIGHT / 2) + (hasContent ? 10 : 0);
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
if (type === "nameNode" && total === 1) {
|
|
115
|
+
yPosition = iconNodeHandleCenterY - (DATA_NODE_HEIGHT / 2);
|
|
116
|
+
} else {
|
|
117
|
+
|
|
118
|
+
const siblingSpace = () => {
|
|
119
|
+
if (type === "primaryNode") {
|
|
120
|
+
if (iconNode?.data.children?.length === 1 && hasContent) {
|
|
121
|
+
return SINGLE_CHILDREN_PRIMARY_WITH_CONTENT_SPACE;
|
|
122
|
+
}
|
|
123
|
+
return DEFAULT_PRIMARY_NODE_SPACE;
|
|
124
|
+
}
|
|
125
|
+
if (iconNode?.data?.children?.length === 0) {
|
|
126
|
+
return NO_CHILDREN_SIBLING_SPACE;
|
|
127
|
+
}
|
|
128
|
+
return DEFAULT_SIBLING_SPACE;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const Y_SPACE_FROM_SIBLINGS = siblingSpace();
|
|
132
|
+
const MIN_SPACE_REQUIRED = Y_SPACE_FROM_SIBLINGS + DATA_NODE_HEIGHT;
|
|
133
|
+
|
|
134
|
+
const totalHeight = total * MIN_SPACE_REQUIRED;
|
|
107
135
|
|
|
108
|
-
|
|
136
|
+
const startY = iconNodeHandleCenterY - totalHeight / 2;
|
|
137
|
+
const END_Y = startY + totalHeight;
|
|
109
138
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
139
|
+
const yOffset = index * MIN_SPACE_REQUIRED;
|
|
140
|
+
|
|
141
|
+
yPosition = startY + yOffset;
|
|
142
|
+
|
|
143
|
+
if (isAboveMainNode && END_Y >= mainNode.position.y + DATA_NODE_HEIGHT / 2) {
|
|
144
|
+
yPosition = mainNode.position.y + DATA_NODE_HEIGHT / 2 - totalHeight + yOffset;
|
|
145
|
+
} else if (!isAboveMainNode && startY < mainNode.position.y + DATA_NODE_HEIGHT / 2) {
|
|
146
|
+
yPosition = mainNode.position.y + DATA_NODE_HEIGHT / 2 + yOffset;
|
|
147
|
+
}
|
|
114
148
|
}
|
|
115
149
|
|
|
116
150
|
return {
|
|
@@ -161,6 +195,7 @@ function StakeholderMappings({
|
|
|
161
195
|
name: emptyString,
|
|
162
196
|
icon: data?.icon || "DashboardStakeholder",
|
|
163
197
|
t: t,
|
|
198
|
+
isPdf: isPdf,
|
|
164
199
|
},
|
|
165
200
|
position: {
|
|
166
201
|
x: centerX - MAIN_NODE_WIDTH / 2,
|
|
@@ -184,6 +219,7 @@ function StakeholderMappings({
|
|
|
184
219
|
totalSources: data?.totalSources,
|
|
185
220
|
backgroundColor: data?.backgroundColor || "#ade9e1",
|
|
186
221
|
iconColor: data?.iconColor || "#08949a",
|
|
222
|
+
isPdf: isPdf,
|
|
187
223
|
},
|
|
188
224
|
position: {
|
|
189
225
|
x: centerX - MAIN_NODE_WIDTH / 2,
|
|
@@ -248,6 +284,7 @@ function StakeholderMappings({
|
|
|
248
284
|
const children = node.data.children || [];
|
|
249
285
|
const total = children?.length || 0;
|
|
250
286
|
const iconNodeId = node.id;
|
|
287
|
+
const iconNodeHasContent = node?.data?.content !== undefined && node?.data?.content !== null;
|
|
251
288
|
|
|
252
289
|
if (children.length === 0) {
|
|
253
290
|
iconEdges.push({
|
|
@@ -258,6 +295,7 @@ function StakeholderMappings({
|
|
|
258
295
|
data: {
|
|
259
296
|
isEmpty: true,
|
|
260
297
|
isOnlyOne: true,
|
|
298
|
+
isPdf: isPdf,
|
|
261
299
|
},
|
|
262
300
|
targetHandle:
|
|
263
301
|
node.data.order % 2 === 0 ? "left-handle-target" : "right-handle-target",
|
|
@@ -274,6 +312,7 @@ function StakeholderMappings({
|
|
|
274
312
|
name: node.data?.emptyName || `No${node.data?.name} identified`,
|
|
275
313
|
icon: node.data?.type,
|
|
276
314
|
t: t,
|
|
315
|
+
isPdf: isPdf,
|
|
277
316
|
},
|
|
278
317
|
position: positionDataNodes({
|
|
279
318
|
isLeftSide: node.data.order % 2 !== 0,
|
|
@@ -302,6 +341,7 @@ function StakeholderMappings({
|
|
|
302
341
|
name: node?.data?.name,
|
|
303
342
|
content: node?.data?.content,
|
|
304
343
|
isOnlyOne: true,
|
|
344
|
+
isPdf: true,
|
|
305
345
|
},
|
|
306
346
|
targetHandle:
|
|
307
347
|
node.data.order % 2 === 0 ? "left-handle-target" : "right-handle-target",
|
|
@@ -353,6 +393,7 @@ function StakeholderMappings({
|
|
|
353
393
|
tooltipHeader: child.tooltipHeader,
|
|
354
394
|
tooltipLabel: child?.tooltipLabel || "Holding",
|
|
355
395
|
totalSources: child.totalSources || 0,
|
|
396
|
+
isPdf: isPdf,
|
|
356
397
|
},
|
|
357
398
|
targetHandle:
|
|
358
399
|
node.data.order % 2 === 0 ? "left-handle-target" : "right-handle-target",
|
|
@@ -384,6 +425,7 @@ function StakeholderMappings({
|
|
|
384
425
|
iconColor: child.iconColor || "#08949a",
|
|
385
426
|
icon: child.icon || "UserCircle",
|
|
386
427
|
content: children.length,
|
|
428
|
+
isPdf: isPdf,
|
|
387
429
|
},
|
|
388
430
|
position: positionDataNodes({
|
|
389
431
|
isLeftSide,
|
|
@@ -394,6 +436,7 @@ function StakeholderMappings({
|
|
|
394
436
|
mainNode,
|
|
395
437
|
type: child.type || "primaryNode",
|
|
396
438
|
hasContent: node?.data?.content ? true : false,
|
|
439
|
+
isPdf: isPdf,
|
|
397
440
|
}),
|
|
398
441
|
};
|
|
399
442
|
});
|
|
@@ -409,6 +452,7 @@ function StakeholderMappings({
|
|
|
409
452
|
data: {
|
|
410
453
|
group: child.id,
|
|
411
454
|
type: "mainNode",
|
|
455
|
+
isPdf: isPdf,
|
|
412
456
|
},
|
|
413
457
|
};
|
|
414
458
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
// components/Edges/DefaultEdge.jsx
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { Popover } from "antd";
|
|
3
|
-
import { BaseEdge, EdgeLabelRenderer, getSmoothStepPath, Position } from "@xyflow/react";
|
|
4
|
+
import { BaseEdge, EdgeLabelRenderer, getSmoothStepPath, Position, getStraightPath } from "@xyflow/react"; // Import getStraightPath
|
|
4
5
|
import { renderTooltipJsx } from "../../../../../utils/tooltip.js";
|
|
5
6
|
// import { activeOpacity, disabledOpacity, edgeStroke, edgeStrokeActive } from '../../config';
|
|
6
7
|
|
|
@@ -25,21 +26,31 @@ export default function DefaultEdge({
|
|
|
25
26
|
renderTooltipItems = () => [],
|
|
26
27
|
getTotal = () => 0,
|
|
27
28
|
tooltipTitle,
|
|
29
|
+
isPdf, // Destructure isPdf from data
|
|
28
30
|
} = data;
|
|
29
31
|
const isSelected =
|
|
30
32
|
associatedNodes?.includes(source) && associatedNodes?.includes(target) && activeNode;
|
|
31
33
|
const opacity = activeNode ? (isSelected ? ACTIVE_OPACITY : DISABLED_OPACITY) : ACTIVE_OPACITY;
|
|
32
34
|
const arrowHeadId = `arrow-head-${id}`;
|
|
33
35
|
|
|
34
|
-
const [edgePath] =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
const [edgePath] = isPdf // Use straight path for PDF
|
|
37
|
+
? getStraightPath({
|
|
38
|
+
sourceX,
|
|
39
|
+
sourceY,
|
|
40
|
+
sourcePosition: data.type === "left" ? Position.Left : Position.Right,
|
|
41
|
+
targetX,
|
|
42
|
+
targetY,
|
|
43
|
+
targetPosition: data.type === "left" ? Position.Right : Position.Left,
|
|
44
|
+
})
|
|
45
|
+
: getSmoothStepPath({ // Use smooth path for normal rendering
|
|
46
|
+
sourceX,
|
|
47
|
+
sourceY,
|
|
48
|
+
targetX,
|
|
49
|
+
targetY,
|
|
50
|
+
sourcePosition: data.type === "left" ? Position.Left : Position.Right,
|
|
51
|
+
targetPosition: data.type === "left" ? Position.Right : Position.Left,
|
|
52
|
+
borderRadius: 20,
|
|
53
|
+
});
|
|
43
54
|
|
|
44
55
|
const centerY = data.moreLeft ? sourceY : targetY;
|
|
45
56
|
|
|
@@ -123,4 +134,4 @@ export default function DefaultEdge({
|
|
|
123
134
|
/>
|
|
124
135
|
</g>
|
|
125
136
|
);
|
|
126
|
-
}
|
|
137
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
// components/Edges/TooltipEdge.jsx
|
|
1
2
|
import { Popover, Tag } from "antd";
|
|
2
3
|
import {
|
|
3
4
|
BaseEdge,
|
|
4
5
|
EdgeLabelRenderer,
|
|
5
6
|
getEdgeCenter,
|
|
6
7
|
getSmoothStepPath,
|
|
7
|
-
// getStraightPath
|
|
8
|
+
getStraightPath, // Import getStraightPath
|
|
8
9
|
} from "@xyflow/react";
|
|
9
10
|
import { renderTooltipJsx } from "../../../../../utils/tooltip.js";
|
|
10
11
|
import CustomIcon from "../../../Icon/CustomIcon.jsx";
|
|
@@ -30,15 +31,26 @@ export default function ToolTipEdge({
|
|
|
30
31
|
data,
|
|
31
32
|
targetPosition,
|
|
32
33
|
}) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
const { isOnlyOne, isPdf } = data; // Destructure isPdf from data
|
|
35
|
+
|
|
36
|
+
const [edgePath] = isPdf && isOnlyOne // Condition for straight path in PDF for single nodes
|
|
37
|
+
? getStraightPath({
|
|
38
|
+
sourceX,
|
|
39
|
+
sourceY,
|
|
40
|
+
sourcePosition,
|
|
41
|
+
targetX,
|
|
42
|
+
targetY,
|
|
43
|
+
targetPosition,
|
|
44
|
+
})
|
|
45
|
+
: getSmoothStepPath({
|
|
46
|
+
sourceX,
|
|
47
|
+
sourceY,
|
|
48
|
+
sourcePosition,
|
|
49
|
+
targetX,
|
|
50
|
+
targetY,
|
|
51
|
+
targetPosition,
|
|
52
|
+
borderRadius: 15,
|
|
53
|
+
});
|
|
42
54
|
|
|
43
55
|
const center = getEdgeCenter({
|
|
44
56
|
sourceX,
|
|
@@ -49,7 +61,7 @@ export default function ToolTipEdge({
|
|
|
49
61
|
|
|
50
62
|
return (
|
|
51
63
|
<>
|
|
52
|
-
<BaseEdge path={
|
|
64
|
+
<BaseEdge path={edgePath} /> {/* Use edgePath here */}
|
|
53
65
|
<EdgeLabelRenderer>
|
|
54
66
|
<div
|
|
55
67
|
className="button-edge__label nodrag nopan"
|
|
@@ -107,4 +119,4 @@ export default function ToolTipEdge({
|
|
|
107
119
|
</EdgeLabelRenderer>
|
|
108
120
|
</>
|
|
109
121
|
);
|
|
110
|
-
}
|
|
122
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// components/Nodes/NameNode.jsx
|
|
1
2
|
import React from "react";
|
|
2
3
|
import styled from "styled-components";
|
|
3
4
|
import { Handle, Position } from "@xyflow/react";
|
|
@@ -135,16 +136,20 @@ export default function NameNode({ data }) {
|
|
|
135
136
|
|
|
136
137
|
const Style = styled.div`
|
|
137
138
|
width: ${NAME_CARD_WIDTH}px;
|
|
139
|
+
height: ${NAME_CARD_HEIGHT}px;
|
|
138
140
|
display: flex;
|
|
139
141
|
background: white;
|
|
140
142
|
border-radius: 8px;
|
|
141
|
-
/* Box-shadows for screen */
|
|
142
|
-
box-shadow: 0px 3.76px 10.03px 0px #00000014;
|
|
143
|
-
box-shadow: 0px 1.88px 3.76px -2.51px #0000001f;
|
|
144
143
|
overflow: hidden;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
${(props) =>
|
|
145
|
+
props.$isPdf
|
|
146
|
+
? `
|
|
147
|
+
border: 1px solid var(--base-gray-30);
|
|
148
|
+
box-shadow: none;
|
|
149
|
+
`
|
|
150
|
+
: `
|
|
151
|
+
box-shadow: 0px 3.76px 10.03px 0px #00000014, 0px 1.88px 3.76px -2.51px #0000001f, 0px 5.64px 17.56px 5.02px #0000000d;
|
|
152
|
+
`}
|
|
148
153
|
-webkit-print-color-adjust: exact;
|
|
149
154
|
print-color-adjust: exact;
|
|
150
155
|
|
|
@@ -156,8 +161,10 @@ const Style = styled.div`
|
|
|
156
161
|
}
|
|
157
162
|
|
|
158
163
|
.right {
|
|
159
|
-
padding:
|
|
164
|
+
padding: 0px 12px;
|
|
160
165
|
width: 100%;
|
|
161
|
-
|
|
166
|
+
display: flex;
|
|
167
|
+
align-items: center;
|
|
168
|
+
border-bottom: none;
|
|
162
169
|
}
|
|
163
|
-
`;
|
|
170
|
+
`;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
// components/Nodes/PrimaryNode.jsx
|
|
1
2
|
import React from "react";
|
|
2
3
|
import styled from "styled-components";
|
|
3
|
-
import { Handle, Position } from "@xyflow/react";
|
|
4
|
+
import { Handle, Position } from "@xyflow/react";
|
|
4
5
|
import CustomIcon from "../../../Icon/CustomIcon.jsx";
|
|
5
6
|
import { Tooltip } from "antd";
|
|
6
7
|
import PropTypes from "prop-types";
|
|
@@ -10,6 +11,7 @@ export const MAIN_NODE_WIDTH = 300;
|
|
|
10
11
|
export const MAIN_NODE_HEIGHT = 150;
|
|
11
12
|
|
|
12
13
|
export default function PrimaryNode({ id, data }) {
|
|
14
|
+
const isPdf = data?.isPdf; // Get isPdf from data prop
|
|
13
15
|
return (
|
|
14
16
|
<>
|
|
15
17
|
<Handle
|
|
@@ -30,7 +32,7 @@ export default function PrimaryNode({ id, data }) {
|
|
|
30
32
|
opacity: 0,
|
|
31
33
|
}}
|
|
32
34
|
/>
|
|
33
|
-
<Style className="flex">
|
|
35
|
+
<Style $isPdf={isPdf} className="flex"> {/* Pass isPdf to styled component */}
|
|
34
36
|
<div
|
|
35
37
|
className="left flex flex-column justify-center"
|
|
36
38
|
style={{
|
|
@@ -133,13 +135,23 @@ export default function PrimaryNode({ id, data }) {
|
|
|
133
135
|
|
|
134
136
|
const Style = styled.div`
|
|
135
137
|
width: ${MAIN_NODE_WIDTH}px;
|
|
138
|
+
height: ${MAIN_NODE_HEIGHT}px; /* Explicitly set height */
|
|
136
139
|
display: flex;
|
|
137
140
|
background: white;
|
|
138
141
|
border-radius: 8px;
|
|
139
|
-
box-shadow: 0px 3.76px 10.03px 0px #00000014;
|
|
140
|
-
box-shadow: 0px 1.88px 3.76px -2.51px #0000001f;
|
|
141
142
|
overflow: hidden;
|
|
142
|
-
|
|
143
|
+
/* Conditional styles for PDF vs screen */
|
|
144
|
+
${(props) =>
|
|
145
|
+
props.$isPdf
|
|
146
|
+
? `
|
|
147
|
+
border: 1px solid var(--base-gray-30); /* Ensure a visible border in PDF */
|
|
148
|
+
box-shadow: none; /* Remove shadow for PDF */
|
|
149
|
+
`
|
|
150
|
+
: `
|
|
151
|
+
box-shadow: 0px 3.76px 10.03px 0px #00000014, 0px 1.88px 3.76px -2.51px #0000001f, 0px 5.64px 17.56px 5.02px #0000000d;
|
|
152
|
+
`}
|
|
153
|
+
-webkit-print-color-adjust: exact;
|
|
154
|
+
print-color-adjust: exact;
|
|
143
155
|
|
|
144
156
|
.left {
|
|
145
157
|
width: 32px;
|
|
@@ -233,5 +245,6 @@ PrimaryNode.propTypes = {
|
|
|
233
245
|
backgroundColor: PropTypes.string,
|
|
234
246
|
totalSources: PropTypes.number,
|
|
235
247
|
onClick: PropTypes.func,
|
|
248
|
+
isPdf: PropTypes.bool,
|
|
236
249
|
}),
|
|
237
|
-
};
|
|
250
|
+
};
|