datastake-daf 0.6.313 → 0.6.314

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.
@@ -51359,7 +51359,7 @@ function NameNode({
51359
51359
  },
51360
51360
  children: data.isEmpty ? translateFN("noValueIdentified", {
51361
51361
  value: data?.name
51362
- }) : data?.name
51362
+ }) : data?.isPdf ? `${data?.content} ${data?.name}` : data?.name
51363
51363
  })
51364
51364
  }), data?.country ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
51365
51365
  title: data?.country?.label,
@@ -52623,7 +52623,8 @@ function StakeholderMappings(_ref3) {
52623
52623
  isSelectable = true,
52624
52624
  iconOffsetY = 250,
52625
52625
  t = s => s,
52626
- emptyString = undefined
52626
+ emptyString = undefined,
52627
+ isPdf = false
52627
52628
  } = _ref3;
52628
52629
  const reactFlowWrapper = React.useRef(null);
52629
52630
  const [nodes, setNodes] = react.useNodesState([]);
@@ -52762,8 +52763,47 @@ function StakeholderMappings(_ref3) {
52762
52763
  })
52763
52764
  }];
52764
52765
  }
52766
+ if (isPdf) {
52767
+ var _node$data6, _node$data7, _node$data8, _node$data9, _node$data10, _node$data11, _node$data12, _node$data13, _node$data14;
52768
+ iconEdges.push({
52769
+ id: "".concat(node.id, "-empty"),
52770
+ source: node.id,
52771
+ target: node.data.name + "-name-node",
52772
+ type: "tooltipEdge",
52773
+ data: {
52774
+ name: node === null || node === void 0 || (_node$data6 = node.data) === null || _node$data6 === void 0 ? void 0 : _node$data6.name,
52775
+ content: node === null || node === void 0 || (_node$data7 = node.data) === null || _node$data7 === void 0 ? void 0 : _node$data7.content,
52776
+ isOnlyOne: true
52777
+ },
52778
+ targetHandle: node.data.order % 2 === 0 ? "left-handle-target" : "right-handle-target"
52779
+ });
52780
+ mandatoryNodes.push("".concat(node.data.name, "-name-node"));
52781
+ return [{
52782
+ id: node.data.name + "-name-node",
52783
+ type: "nameNode",
52784
+ data: {
52785
+ name: node === null || node === void 0 || (_node$data8 = node.data) === null || _node$data8 === void 0 ? void 0 : _node$data8.name,
52786
+ content: node === null || node === void 0 || (_node$data9 = node.data) === null || _node$data9 === void 0 ? void 0 : _node$data9.content,
52787
+ icon: (_node$data10 = node.data) === null || _node$data10 === void 0 ? void 0 : _node$data10.type,
52788
+ backgroundColor: node === null || node === void 0 || (_node$data11 = node.data) === null || _node$data11 === void 0 ? void 0 : _node$data11.activeColour,
52789
+ iconColor: node === null || node === void 0 || (_node$data12 = node.data) === null || _node$data12 === void 0 ? void 0 : _node$data12.hoverColor,
52790
+ isPdf: true,
52791
+ t: t
52792
+ },
52793
+ position: positionDataNodes({
52794
+ isLeftSide: node.data.order % 2 !== 0,
52795
+ isAboveMainNode: node.data.order <= 2,
52796
+ iconNode: node,
52797
+ index: 0,
52798
+ total: 1,
52799
+ mainNode,
52800
+ type: "nameNode",
52801
+ hasContent: (node === null || node === void 0 || (_node$data13 = node.data) === null || _node$data13 === void 0 ? void 0 : _node$data13.content) !== undefined && (node === null || node === void 0 || (_node$data14 = node.data) === null || _node$data14 === void 0 ? void 0 : _node$data14.content) !== null ? true : false
52802
+ })
52803
+ }];
52804
+ }
52765
52805
  return children.map((child, index) => {
52766
- var _node$data6;
52806
+ var _node$data15;
52767
52807
  iconEdges.push({
52768
52808
  id: "".concat(node.id, "-").concat(child.id),
52769
52809
  source: node.id,
@@ -52801,7 +52841,8 @@ function StakeholderMappings(_ref3) {
52801
52841
  onClick: child.onClick,
52802
52842
  backgroundColor: child.backgroundColor || "#ade9e1",
52803
52843
  iconColor: child.iconColor || "#08949a",
52804
- icon: child.icon || "UserCircle"
52844
+ icon: child.icon || "UserCircle",
52845
+ content: children.length
52805
52846
  },
52806
52847
  position: positionDataNodes({
52807
52848
  isLeftSide,
@@ -52811,7 +52852,7 @@ function StakeholderMappings(_ref3) {
52811
52852
  total,
52812
52853
  mainNode,
52813
52854
  type: child.type || "primaryNode",
52814
- hasContent: node !== null && node !== void 0 && (_node$data6 = node.data) !== null && _node$data6 !== void 0 && _node$data6.content ? true : false
52855
+ hasContent: node !== null && node !== void 0 && (_node$data15 = node.data) !== null && _node$data15 !== void 0 && _node$data15.content ? true : false
52815
52856
  })
52816
52857
  };
52817
52858
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.313",
3
+ "version": "0.6.314",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -1,7 +1,7 @@
1
1
  import StakeholderMappings from "./index";
2
2
  import ThemeLayout from "../../ThemeLayout";
3
3
  import Widget from "../../Dashboard/Widget/index.jsx";
4
- import { storyConfig, storyConfig2, storyConfig3, storyConfig4 } from "./storyConfig";
4
+ import { storyConfig, storyConfig2, storyConfig3, storyConfig4, storyConfig5 } from "./storyConfig";
5
5
 
6
6
  export default {
7
7
  title: "Graphs/StakeholderMappings",
@@ -115,3 +115,21 @@ export const WithEmptyState = {
115
115
  );
116
116
  },
117
117
  };
118
+
119
+ export const Test = {
120
+ args: {},
121
+ render: () => {
122
+ return (
123
+ <Widget title="Stakeholder Mappings" className="with-border-header no-px no-p-body">
124
+ <div
125
+ style={{
126
+ height: "70vh",
127
+ width: "100%",
128
+ }}
129
+ >
130
+ <StakeholderMappings data={storyConfig5} isPdf={true} />
131
+ </div>
132
+ </Widget>
133
+ );
134
+ },
135
+ };
@@ -129,6 +129,7 @@ function StakeholderMappings({
129
129
  iconOffsetY = 250,
130
130
  t = (s) => s,
131
131
  emptyString = undefined,
132
+ isPdf = false,
132
133
  }) {
133
134
  const reactFlowWrapper = useRef(null);
134
135
  const [nodes, setNodes] = useNodesState([]);
@@ -290,6 +291,53 @@ function StakeholderMappings({
290
291
  ];
291
292
  }
292
293
 
294
+ if (isPdf) {
295
+ iconEdges.push({
296
+ id: `${node.id}-empty`,
297
+ source: node.id,
298
+ target: node.data.name + "-name-node",
299
+ type: "tooltipEdge",
300
+ data: {
301
+ name: node?.data?.name,
302
+ content: node?.data?.content,
303
+ isOnlyOne: true,
304
+ },
305
+ targetHandle:
306
+ node.data.order % 2 === 0 ? "left-handle-target" : "right-handle-target",
307
+ });
308
+
309
+ mandatoryNodes.push(`${node.data.name}-name-node`);
310
+
311
+ return [
312
+ {
313
+ id: node.data.name + "-name-node",
314
+ type: "nameNode",
315
+ data: {
316
+ name: node?.data?.name,
317
+ content: node?.data?.content,
318
+ icon: node.data?.type,
319
+ backgroundColor: node?.data?.activeColour,
320
+ iconColor: node?.data?.hoverColor,
321
+ isPdf: true,
322
+ t: t,
323
+ },
324
+ position: positionDataNodes({
325
+ isLeftSide: node.data.order % 2 !== 0,
326
+ isAboveMainNode: node.data.order <= 2,
327
+ iconNode: node,
328
+ index: 0,
329
+ total: 1,
330
+ mainNode,
331
+ type: "nameNode",
332
+ hasContent:
333
+ node?.data?.content !== undefined && node?.data?.content !== null
334
+ ? true
335
+ : false,
336
+ }),
337
+ },
338
+ ];
339
+ }
340
+
293
341
  return children.map((child, index) => {
294
342
  iconEdges.push({
295
343
  id: `${node.id}-${child.id}`,
@@ -333,6 +381,7 @@ function StakeholderMappings({
333
381
  backgroundColor: child.backgroundColor || "#ade9e1",
334
382
  iconColor: child.iconColor || "#08949a",
335
383
  icon: child.icon || "UserCircle",
384
+ content: children.length,
336
385
  },
337
386
  position: positionDataNodes({
338
387
  isLeftSide,
@@ -403,3 +403,97 @@ export const storyConfig4 = {
403
403
  },
404
404
  ],
405
405
  };
406
+
407
+ export const storyConfig5 = {
408
+ "id": "LOC-00000000278",
409
+ "name": "New Mine Test",
410
+ "totalSources": 1,
411
+ "country": {
412
+ "label": "Colombia",
413
+ "value": "co"
414
+ },
415
+ "backgroundColor": "#ffd6e8",
416
+ "icon": "DashboardLocations",
417
+ "iconColor": "#f75aab",
418
+ "children": [
419
+ {
420
+ "id": "Producers",
421
+ "name": "Producers",
422
+ "icon": "TifAmp",
423
+ "order": 1,
424
+ "hoverColor": "#36cfca",
425
+ "activeColour": "#b6f5ec",
426
+ "iconHoverColor": "#fff",
427
+ "content": 1,
428
+ "children": [
429
+ {
430
+ "type": "nameNode",
431
+ "id": "STK-00000000442",
432
+ "name": "New Producer Test",
433
+ "icon": "DashboardStakeholder",
434
+ "backgroundColor": "#b6f5ec",
435
+ "iconColor": "#36cfca",
436
+ "country": {
437
+ "label": "Colombia",
438
+ "value": "co"
439
+ }
440
+ }
441
+ ],
442
+ "emptyName": "No Producers Identified"
443
+ },
444
+ {
445
+ "id": "Documents",
446
+ "name": "Documents",
447
+ "icon": "DashboardDocuments",
448
+ "order": 2,
449
+ "hoverColor": "#3f96ff",
450
+ "activeColour": "#b9e0ff",
451
+ "iconHoverColor": "#fff",
452
+ "content": 1,
453
+ "children": [
454
+ {
455
+ "type": "nameNode",
456
+ "id": "DOC-00000006729",
457
+ "name": "fewsdz",
458
+ "icon": "DashboardDocuments",
459
+ "backgroundColor": "#b9e0ff",
460
+ "iconColor": "#3f96ff"
461
+ }
462
+ ],
463
+ "emptyName": "No Documents Identified"
464
+ },
465
+ {
466
+ "id": "Stakeholders",
467
+ "name": "Stakeholders",
468
+ "icon": "DashboardStakeholder",
469
+ "order": 3,
470
+ "hoverColor": "#36cfca",
471
+ "activeColour": "#b6f5ec",
472
+ "iconHoverColor": "#fff",
473
+ "content": 0,
474
+ "children": [],
475
+ "emptyName": "No Stakeholders Identified"
476
+ },
477
+ {
478
+ "id": "Mine Image",
479
+ "name": "Mine Image",
480
+ "icon": "Image",
481
+ "order": 4,
482
+ "hoverColor": "#3f96ff",
483
+ "activeColour": "#b9e0ff",
484
+ "iconHoverColor": "#fff",
485
+ "content": 1,
486
+ "children": [
487
+ {
488
+ "type": "nameNode",
489
+ "id": "DOC-00000006727",
490
+ "name": "te3wst",
491
+ "icon": "DashboardDocuments",
492
+ "backgroundColor": "#b9e0ff",
493
+ "iconColor": "#3f96ff"
494
+ }
495
+ ],
496
+ "emptyName": "No Mine Image Identified"
497
+ }
498
+ ]
499
+ }
@@ -78,7 +78,7 @@ export default function NameNode({ data }) {
78
78
  >
79
79
  {data.isEmpty
80
80
  ? translateFN("noValueIdentified", { value: data?.name })
81
- : data?.name}
81
+ : data?.isPdf ? `${data?.content} ${data?.name}` : data?.name}
82
82
  </span>
83
83
  </Tooltip>
84
84
  {data?.country ? (