datastake-daf 0.6.368 → 0.6.370

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.
@@ -200,7 +200,6 @@ class StorageManager {
200
200
  }
201
201
  }
202
202
 
203
- const NEW_PAGINATION_TITLES = ["nashiriki"];
204
203
  const useFilters = ({
205
204
  view,
206
205
  module,
@@ -214,57 +213,55 @@ const useFilters = ({
214
213
  doPagination = true,
215
214
  getRedirectLink
216
215
  }) => {
217
- const PAGE = NEW_PAGINATION_TITLES.includes(module) ? "skip" : "page";
218
- const PAGE_SIZE = NEW_PAGINATION_TITLES.includes(module) ? "take" : "pageSize";
219
216
  const params = React.useMemo(() => new URLSearchParams(location.search), [location.search]);
220
217
  const [activeFilters, setActiveFilters] = React.useState(defaultActiveFilters || getDefaultActiveFilters(params, selectFiltersConfig, defaultPageSize, defaultUrlParams, doPagination));
221
218
  const [pagination, setPagination] = React.useState(defaultActiveFilters ? {
222
- current: defaultActiveFilters[PAGE] || 1,
223
- [PAGE_SIZE]: defaultActiveFilters[PAGE_SIZE] || defaultPageSize,
219
+ current: defaultActiveFilters.page || 1,
220
+ pageSize: defaultActiveFilters.pageSize || defaultPageSize,
224
221
  showSizeChanger: true
225
222
  } : {
226
- current: !isNaN(Number(params.get(PAGE))) ? Number(params.get(PAGE)) || 1 : 1,
227
- [PAGE_SIZE]: !isNaN(Number(params.get(PAGE_SIZE))) ? Number(params.get(PAGE_SIZE)) || defaultPageSize : defaultPageSize,
223
+ current: !isNaN(Number(params.get('page'))) ? Number(params.get('page')) || 1 : 1,
224
+ pageSize: !isNaN(Number(params.get('pageSize'))) ? Number(params.get('pageSize')) || defaultPageSize : defaultPageSize,
228
225
  showSizeChanger: true
229
226
  });
230
227
  React.useEffect(() => {
231
228
  if (defaultActiveFilters) {
232
229
  setPagination(prev => ({
233
230
  ...prev,
234
- current: defaultActiveFilters[PAGE] || 1,
235
- [PAGE_SIZE]: defaultActiveFilters[PAGE_SIZE] || defaultPageSize,
231
+ current: defaultActiveFilters.page || 1,
232
+ pageSize: defaultActiveFilters.pageSize || defaultPageSize,
236
233
  showSizeChanger: true
237
234
  }));
238
235
  return;
239
236
  }
240
237
  setPagination(prev => ({
241
238
  ...prev,
242
- current: !isNaN(Number(params.get(PAGE))) ? Number(params.get(PAGE)) || 1 : 1,
243
- [PAGE_SIZE]: !isNaN(Number(params.get(PAGE_SIZE))) ? Number(params.get(PAGE_SIZE)) || defaultPageSize : defaultPageSize,
239
+ current: !isNaN(Number(params.get('page'))) ? Number(params.get('page')) || 1 : 1,
240
+ pageSize: !isNaN(Number(params.get('pageSize'))) ? Number(params.get('pageSize')) || defaultPageSize : defaultPageSize,
244
241
  showSizeChanger: true
245
242
  }));
246
243
  }, []);
247
244
  const updateQuery = React.useCallback((filters, page) => {
248
245
  const qs = Object.keys(filters).filter(key => {
249
246
  if (!doPagination) {
250
- return !!filters[key] && key !== PAGE && key !== PAGE_SIZE;
247
+ return !!filters[key] && key !== 'page' && key !== 'pageSize';
251
248
  }
252
249
  return !!filters[key];
253
250
  }).map(key => {
254
- if (filters[key] && typeof filters[key] === "object") {
251
+ if (filters[key] && typeof filters[key] === 'object') {
255
252
  return `${key}=${JSON.stringify(filters[key])}`;
256
253
  }
257
254
  return `${key}=${filters[key]}`;
258
- }).join("&");
255
+ }).join('&');
259
256
  if (view) {
260
- if (typeof getRedirectLink === "function") {
261
- goTo(getRedirectLink(view === "mine-monitoring" ? qs !== "" ? `${location.pathname}?${qs}` : doPagination ? `${location.pathname}?${PAGE}=${page}` : location.pathname : qs !== "" ? `${`/app/${view}`}?${qs}` : doPagination ? `${`/app/${view}`}?${PAGE}=${page}` : `${`/app/${view}`}`));
257
+ if (typeof getRedirectLink === 'function') {
258
+ goTo(getRedirectLink(view === 'mine-monitoring' ? qs !== '' ? `${location.pathname}?${qs}` : doPagination ? `${location.pathname}?page=${page}` : location.pathname : qs !== '' ? `${`/app/${view}`}?${qs}` : doPagination ? `${`/app/${view}`}?page=${page}` : `${`/app/${view}`}`));
262
259
  return;
263
260
  }
264
- if (view === "mine-monitoring") {
265
- goTo(qs !== "" ? `${location.pathname}?${qs}` : doPagination ? `${location.pathname}?${PAGE}=${page}` : location.pathname);
261
+ if (view === 'mine-monitoring') {
262
+ goTo(qs !== '' ? `${location.pathname}?${qs}` : doPagination ? `${location.pathname}?page=${page}` : location.pathname);
266
263
  } else {
267
- goTo(qs !== "" ? `${`/app/${module}/${view}`}?${qs}` : doPagination ? `${`/app/${module}/${view}`}?${PAGE}=${page}` : `${`/app/${module}/${view}`}`);
264
+ goTo(qs !== '' ? `${`/app/${module}/${view}`}?${qs}` : doPagination ? `${`/app/${module}/${view}`}?page=${page}` : `${`/app/${module}/${view}`}`);
268
265
  }
269
266
  }
270
267
  }, [module, view, location.pathname]); // Updated dependency array
@@ -297,9 +294,9 @@ const useFilters = ({
297
294
  const filters = StorageManager.saveFilters(module, view, {
298
295
  ...filteredFilters
299
296
  });
300
- if (!filters[PAGE_SIZE]) {
301
- filters[PAGE] = 1;
302
- filters[PAGE_SIZE] = pagination[PAGE_SIZE];
297
+ if (!filters.pageSize) {
298
+ filters.page = 1;
299
+ filters.pageSize = pagination.pageSize;
303
300
  }
304
301
  updateQuery(filters, 1);
305
302
  }, [activeFilters]);
@@ -310,7 +307,7 @@ const useFilters = ({
310
307
  const {
311
308
  show
312
309
  } = conf;
313
- if (typeof show === "function") {
310
+ if (typeof show === 'function') {
314
311
  if (show(filters)) {
315
312
  return all;
316
313
  }
@@ -328,7 +325,7 @@ const useFilters = ({
328
325
  ...prev
329
326
  };
330
327
  Object.keys(o).forEach(k => {
331
- if (Object.keys(selectFiltersConfig).includes(k) || k === "authorId") {
328
+ if (Object.keys(selectFiltersConfig).includes(k) || k === 'authorId') {
332
329
  delete o[k];
333
330
  }
334
331
  });
@@ -336,7 +333,7 @@ const useFilters = ({
336
333
  o[k] = v;
337
334
  });
338
335
  if (doPagination) {
339
- o[PAGE] = 1;
336
+ o.page = 1;
340
337
  }
341
338
  return o;
342
339
  });
@@ -356,11 +353,11 @@ const useFilters = ({
356
353
  } = sorter || {};
357
354
  let fs = {
358
355
  ...activeFilters,
359
- [PAGE]: page[PAGE_SIZE] !== activeFilters[PAGE_SIZE] ? 1 : page.current,
360
- [PAGE_SIZE]: page[PAGE_SIZE] || defaultPageSize
356
+ page: page.pageSize !== activeFilters.pageSize ? 1 : page.current,
357
+ pageSize: page.pageSize || defaultPageSize
361
358
  };
362
359
  if (sorter && (columnKey !== sortBy || order !== sortDir)) {
363
- fs[PAGE] = 1;
360
+ fs.page = 1;
364
361
  }
365
362
  if (order) {
366
363
  fs = {
@@ -370,8 +367,8 @@ const useFilters = ({
370
367
  };
371
368
  } else if (sortBy || sortDir) {
372
369
  fs = Object.keys(fs).reduce((all, key) => {
373
- if (key !== "sortDir" && key !== "sortBy") {
374
- if (key === PAGE || key === PAGE_SIZE) {
370
+ if (key !== 'sortDir' && key !== 'sortBy') {
371
+ if (key === 'page' || key === 'pageSize') {
375
372
  all[key] = fs[key];
376
373
  } else {
377
374
  all[key] = activeFilters[key];
@@ -385,19 +382,19 @@ const useFilters = ({
385
382
  page.current = 1;
386
383
  }
387
384
  const filters = StorageManager.saveFilters(module, view, {
388
- [PAGE]: page.current
385
+ page: page.current
389
386
  }, true);
390
387
  updateQuery(filters, page.current);
391
388
  setPagination(prev => ({
392
389
  ...prev,
393
- current: fs[PAGE],
394
- [PAGE_SIZE]: fs[PAGE_SIZE] || defaultPageSize
390
+ current: fs.page,
391
+ pageSize: fs.pageSize || defaultPageSize
395
392
  }));
396
393
  };
397
394
  const onSearch = React.useCallback((activeFilter, value) => {
398
395
  setActiveFilters(prev => ({
399
396
  ...prev,
400
- [PAGE]: 1,
397
+ page: 1,
401
398
  searchParams: activeFilter,
402
399
  search: value
403
400
  }));
@@ -407,7 +404,7 @@ const useFilters = ({
407
404
  }));
408
405
  }, []);
409
406
  const totalPages = React.useMemo(() => {
410
- return Math.ceil(pagination.total / pagination[PAGE_SIZE]);
407
+ return Math.ceil(pagination.total / pagination.pageSize);
411
408
  }, [pagination]);
412
409
  const canGoPrev = React.useMemo(() => pagination.current !== 1, [pagination]);
413
410
  const canGoNext = React.useMemo(() => pagination.current !== totalPages && totalPages, [pagination, totalPages]);
@@ -1162,8 +1159,6 @@ const useIsMobile = () => {
1162
1159
  return isMobile;
1163
1160
  };
1164
1161
 
1165
- const PAGE = "page";
1166
- const PAGE_SIZE = "pageSize";
1167
1162
  function useSource({
1168
1163
  user = {},
1169
1164
  t = () => {},
@@ -1182,8 +1177,8 @@ function useSource({
1182
1177
  const {
1183
1178
  data
1184
1179
  } = await getData({
1185
- [PAGE]: 1,
1186
- [PAGE_SIZE]: 100,
1180
+ page: 1,
1181
+ pageSize: 100,
1187
1182
  type: "partners"
1188
1183
  });
1189
1184
  if (id === undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.368",
3
+ "version": "0.6.370",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -457,6 +457,34 @@ export const Pdf = {
457
457
  showBackground: true,
458
458
  isPercentage: true,
459
459
  shouldSeperateLegendName: true,
460
+ formattedXAxis: (s) => {
461
+ if (!s) return "";
462
+
463
+ const limit = 20;
464
+ let result = "";
465
+ let line = "";
466
+
467
+ for (let word of s.split(" ")) {
468
+ if ((line + word).length <= limit) {
469
+ line += (line ? " " : "") + word;
470
+ } else if (word.length > limit) {
471
+ // break long word with hyphen
472
+ while (word.length > limit) {
473
+ result += word.slice(0, limit - 1) + "-\n";
474
+ word = word.slice(limit - 1);
475
+ }
476
+ line = word;
477
+ } else {
478
+ // move current line into result
479
+ if (line) result += line + "\n";
480
+ line = word;
481
+ }
482
+ }
483
+
484
+ if (line) result += line;
485
+
486
+ return result;
487
+ },
460
488
  },
461
489
  render: (args) => {
462
490
  return <Widget title="Pdf Column Chart" className={"with-border-header"}>
@@ -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 = {
@@ -72,6 +73,7 @@ function positionDataNodes({
72
73
  mainNode,
73
74
  type,
74
75
  hasContent,
76
+ isPdf,
75
77
  }) {
76
78
  const DATA_NODE_WIDTH = DATA_NODE_SIZE[type].width;
77
79
  const DATA_NODE_HEIGHT = DATA_NODE_SIZE[type].height;
@@ -103,13 +105,46 @@ function positionDataNodes({
103
105
  const END_Y = startY + totalHeight;
104
106
 
105
107
  const yOffset = index * MIN_SPACE_REQUIRED;
108
+ let yPosition;
106
109
 
107
- let yPosition = startY + yOffset;
108
110
 
109
- if (isAboveMainNode && END_Y >= mainNode.position.y + DATA_NODE_HEIGHT / 2) {
110
- yPosition = mainNode.position.y + DATA_NODE_HEIGHT / 2 - totalHeight + yOffset;
111
- } else if (!isAboveMainNode && startY < mainNode.position.y + DATA_NODE_HEIGHT / 2) {
112
- yPosition = mainNode.position.y + DATA_NODE_HEIGHT / 2 + yOffset;
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;
135
+
136
+ const startY = iconNodeHandleCenterY - totalHeight / 2;
137
+ const END_Y = startY + totalHeight;
138
+
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
+ }
113
148
  }
114
149
 
115
150
  return {
@@ -160,6 +195,7 @@ function StakeholderMappings({
160
195
  name: emptyString,
161
196
  icon: data?.icon || "DashboardStakeholder",
162
197
  t: t,
198
+ isPdf: isPdf,
163
199
  },
164
200
  position: {
165
201
  x: centerX - MAIN_NODE_WIDTH / 2,
@@ -183,6 +219,7 @@ function StakeholderMappings({
183
219
  totalSources: data?.totalSources,
184
220
  backgroundColor: data?.backgroundColor || "#ade9e1",
185
221
  iconColor: data?.iconColor || "#08949a",
222
+ isPdf: isPdf,
186
223
  },
187
224
  position: {
188
225
  x: centerX - MAIN_NODE_WIDTH / 2,
@@ -247,6 +284,7 @@ function StakeholderMappings({
247
284
  const children = node.data.children || [];
248
285
  const total = children?.length || 0;
249
286
  const iconNodeId = node.id;
287
+ const iconNodeHasContent = node?.data?.content !== undefined && node?.data?.content !== null;
250
288
 
251
289
  if (children.length === 0) {
252
290
  iconEdges.push({
@@ -257,6 +295,7 @@ function StakeholderMappings({
257
295
  data: {
258
296
  isEmpty: true,
259
297
  isOnlyOne: true,
298
+ isPdf: isPdf,
260
299
  },
261
300
  targetHandle:
262
301
  node.data.order % 2 === 0 ? "left-handle-target" : "right-handle-target",
@@ -273,6 +312,7 @@ function StakeholderMappings({
273
312
  name: node.data?.emptyName || `No${node.data?.name} identified`,
274
313
  icon: node.data?.type,
275
314
  t: t,
315
+ isPdf: isPdf,
276
316
  },
277
317
  position: positionDataNodes({
278
318
  isLeftSide: node.data.order % 2 !== 0,
@@ -301,6 +341,7 @@ function StakeholderMappings({
301
341
  name: node?.data?.name,
302
342
  content: node?.data?.content,
303
343
  isOnlyOne: true,
344
+ isPdf: true,
304
345
  },
305
346
  targetHandle:
306
347
  node.data.order % 2 === 0 ? "left-handle-target" : "right-handle-target",
@@ -325,6 +366,7 @@ function StakeholderMappings({
325
366
  isLeftSide: node.data.order % 2 !== 0,
326
367
  isAboveMainNode: node.data.order <= 2,
327
368
  iconNode: node,
369
+ isPdf: true,
328
370
  index: 0,
329
371
  total: 1,
330
372
  mainNode,
@@ -351,6 +393,7 @@ function StakeholderMappings({
351
393
  tooltipHeader: child.tooltipHeader,
352
394
  tooltipLabel: child?.tooltipLabel || "Holding",
353
395
  totalSources: child.totalSources || 0,
396
+ isPdf: isPdf,
354
397
  },
355
398
  targetHandle:
356
399
  node.data.order % 2 === 0 ? "left-handle-target" : "right-handle-target",
@@ -382,6 +425,7 @@ function StakeholderMappings({
382
425
  iconColor: child.iconColor || "#08949a",
383
426
  icon: child.icon || "UserCircle",
384
427
  content: children.length,
428
+ isPdf: isPdf,
385
429
  },
386
430
  position: positionDataNodes({
387
431
  isLeftSide,
@@ -392,6 +436,7 @@ function StakeholderMappings({
392
436
  mainNode,
393
437
  type: child.type || "primaryNode",
394
438
  hasContent: node?.data?.content ? true : false,
439
+ isPdf: isPdf,
395
440
  }),
396
441
  };
397
442
  });
@@ -407,6 +452,7 @@ function StakeholderMappings({
407
452
  data: {
408
453
  group: child.id,
409
454
  type: "mainNode",
455
+ isPdf: isPdf,
410
456
  },
411
457
  };
412
458
  });
@@ -444,6 +490,7 @@ function StakeholderMappings({
444
490
  });
445
491
  }}
446
492
  ref={reactFlowWrapper}
493
+ isPdf={isPdf}
447
494
  />
448
495
  );
449
496
  }
@@ -32,6 +32,7 @@ const BaseGraph = forwardRef(function BaseGraph(
32
32
  t,
33
33
  withDuration = true,
34
34
  onFilterChange,
35
+ isPdf,
35
36
  ...props
36
37
  },
37
38
  ref,
@@ -87,43 +88,45 @@ const BaseGraph = forwardRef(function BaseGraph(
87
88
  }}
88
89
  {...props}
89
90
  >
90
- <Controls position="bottom-right" showFitView={false} showInteractive={false}>
91
- <ControlButton
92
- onClick={() => {
93
- fitView({
94
- padding: 0.1,
95
- nodes: [...nodesToFit],
96
- duration: withDuration ? 300 : undefined,
97
- });
98
- }}
99
- >
100
- <AimOutlined height={20} width={20} />
101
- </ControlButton>
102
- <ControlButton
103
- onClick={() => {
104
- const viewport = getViewport();
105
- setViewport({
106
- x: viewport.x,
107
- y: viewport.y + 20,
108
- zoom: viewport.zoom,
109
- });
110
- }}
111
- >
112
- <UpOutlined height={20} width={20}></UpOutlined>
113
- </ControlButton>
114
- <ControlButton
115
- onClick={() => {
116
- const viewport = getViewport();
117
- setViewport({
118
- x: viewport.x,
119
- y: viewport.y - 20,
120
- zoom: viewport.zoom,
121
- });
122
- }}
123
- >
124
- <DownOutlined height={20} width={20}></DownOutlined>
125
- </ControlButton>
126
- </Controls>
91
+ {!isPdf && (
92
+ <Controls position="bottom-right" showFitView={false} showInteractive={false}>
93
+ <ControlButton
94
+ onClick={() => {
95
+ fitView({
96
+ padding: 0.1,
97
+ nodes: [...nodesToFit],
98
+ duration: withDuration ? 300 : undefined,
99
+ });
100
+ }}
101
+ >
102
+ <AimOutlined height={20} width={20} />
103
+ </ControlButton>
104
+ <ControlButton
105
+ onClick={() => {
106
+ const viewport = getViewport();
107
+ setViewport({
108
+ x: viewport.x,
109
+ y: viewport.y + 20,
110
+ zoom: viewport.zoom,
111
+ });
112
+ }}
113
+ >
114
+ <UpOutlined height={20} width={20}></UpOutlined>
115
+ </ControlButton>
116
+ <ControlButton
117
+ onClick={() => {
118
+ const viewport = getViewport();
119
+ setViewport({
120
+ x: viewport.x,
121
+ y: viewport.y - 20,
122
+ zoom: viewport.zoom,
123
+ });
124
+ }}
125
+ >
126
+ <DownOutlined height={20} width={20}></DownOutlined>
127
+ </ControlButton>
128
+ </Controls>
129
+ )}
127
130
  </ReactFlow>
128
131
  </div>
129
132
  </ComponentWithFocus>
@@ -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] = getSmoothStepPath({
35
- sourceX,
36
- sourceY,
37
- targetX,
38
- targetY,
39
- sourcePosition: data.type === "left" ? Position.Left : Position.Right,
40
- targetPosition: data.type === "left" ? Position.Right : Position.Left,
41
- borderRadius: 20,
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
- const [smoothPath] = getSmoothStepPath({
34
- sourceX,
35
- sourceY,
36
- sourcePosition,
37
- targetX,
38
- targetY,
39
- targetPosition,
40
- borderRadius: 15,
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={smoothPath} />
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
+ }