datastake-daf 0.6.352 → 0.6.353

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.
@@ -51378,6 +51378,7 @@ function NameNode({
51378
51378
  token
51379
51379
  } = useToken$7();
51380
51380
  const translateFN = typeof data?.t === "function" ? data.t : key => key;
51381
+ const isPdf = data?.isPdf;
51381
51382
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
51382
51383
  children: [/*#__PURE__*/jsxRuntime.jsx(react.Handle, {
51383
51384
  type: "source",
@@ -51396,6 +51397,7 @@ function NameNode({
51396
51397
  opacity: 0
51397
51398
  }
51398
51399
  }), /*#__PURE__*/jsxRuntime.jsxs(Style$d, {
51400
+ $isPdf: isPdf,
51399
51401
  style: {
51400
51402
  opacity: data.isEmpty ? 0.5 : 1
51401
51403
  },
@@ -51446,7 +51448,7 @@ function NameNode({
51446
51448
  }
51447
51449
  })
51448
51450
  }) : null]
51449
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
51451
+ }), !isPdf && /*#__PURE__*/jsxRuntime.jsx("div", {
51450
51452
  style: {
51451
51453
  marginLeft: "auto"
51452
51454
  },
@@ -51483,27 +51485,32 @@ function NameNode({
51483
51485
  });
51484
51486
  }
51485
51487
  const Style$d = dt.div`
51486
- width: ${NAME_CARD_WIDTH}px;
51487
- display: flex;
51488
- background: white;
51489
- border-radius: 8px;
51490
- box-shadow: 0px 3.76px 10.03px 0px #00000014;
51491
- box-shadow: 0px 1.88px 3.76px -2.51px #0000001f;
51492
- overflow: hidden;
51493
- box-shadow: 0px 5.64px 17.56px 5.02px #0000000d;
51488
+ width: ${NAME_CARD_WIDTH}px;
51489
+ display: flex;
51490
+ background: white;
51491
+ 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
+ overflow: hidden;
51496
+ box-shadow: 0px 5.64px 17.56px 5.02px #0000000d;
51497
+ /* Ensure borders/colors survive PDF rendering */
51498
+ border: ${props => props.$isPdf ? '1px solid var(--base-gray-30)' : 'none'};
51499
+ -webkit-print-color-adjust: exact;
51500
+ print-color-adjust: exact;
51494
51501
 
51495
- .left {
51496
- width: 32px;
51497
- background: red;
51498
- border-top-left-radius: 12px;
51499
- border-bottom-left-radius: 12px;
51500
- }
51502
+ .left {
51503
+ width: 32px;
51504
+ background: red;
51505
+ border-top-left-radius: 12px;
51506
+ border-bottom-left-radius: 12px;
51507
+ }
51501
51508
 
51502
- .right {
51503
- padding: 16px 12px;
51504
- width: 100%
51505
- border-bottom: 1px solid var(--base-gray-30);
51506
- }
51509
+ .right {
51510
+ padding: 16px 12px;
51511
+ width: 100%;
51512
+ border-bottom: 1px solid var(--base-gray-30);
51513
+ }
51507
51514
  `;
51508
51515
 
51509
51516
  const Style$c = dt.div`
@@ -51738,15 +51745,28 @@ function ToolTipEdge({
51738
51745
  data,
51739
51746
  targetPosition
51740
51747
  }) {
51741
- const [smoothPath] = react.getSmoothStepPath({
51742
- sourceX,
51743
- sourceY,
51744
- sourcePosition,
51745
- targetX,
51746
- targetY,
51747
- targetPosition,
51748
- borderRadius: 15
51748
+ console.log({
51749
+ data
51749
51750
  });
51751
+ let edgePath;
51752
+ if (data?.isPdf || data?.isOnlyOne) {
51753
+ [edgePath] = react.getStraightPath({
51754
+ sourceX,
51755
+ sourceY,
51756
+ targetX,
51757
+ targetY
51758
+ });
51759
+ } else {
51760
+ [edgePath] = react.getSmoothStepPath({
51761
+ sourceX,
51762
+ sourceY,
51763
+ sourcePosition,
51764
+ targetX,
51765
+ targetY,
51766
+ targetPosition,
51767
+ borderRadius: 15
51768
+ });
51769
+ }
51750
51770
  const center = react.getEdgeCenter({
51751
51771
  sourceX,
51752
51772
  sourceY,
@@ -51755,7 +51775,7 @@ function ToolTipEdge({
51755
51775
  });
51756
51776
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
51757
51777
  children: [/*#__PURE__*/jsxRuntime.jsx(react.BaseEdge, {
51758
- path: smoothPath
51778
+ path: edgePath
51759
51779
  }), /*#__PURE__*/jsxRuntime.jsx(react.EdgeLabelRenderer, {
51760
51780
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
51761
51781
  className: "button-edge__label nodrag nopan",
@@ -52078,6 +52098,7 @@ const BaseGraph = /*#__PURE__*/React.forwardRef(function BaseGraph({
52078
52098
  t,
52079
52099
  withDuration = true,
52080
52100
  onFilterChange,
52101
+ isPdf,
52081
52102
  ...props
52082
52103
  }, ref) {
52083
52104
  const {
@@ -52134,7 +52155,7 @@ const BaseGraph = /*#__PURE__*/React.forwardRef(function BaseGraph({
52134
52155
  duration: withDuration ? 300 : undefined
52135
52156
  },
52136
52157
  ...props,
52137
- children: /*#__PURE__*/jsxRuntime.jsxs(react.Controls, {
52158
+ children: !isPdf && /*#__PURE__*/jsxRuntime.jsxs(react.Controls, {
52138
52159
  position: "bottom-right",
52139
52160
  showFitView: false,
52140
52161
  showInteractive: false,
@@ -52847,7 +52868,8 @@ function StakeholderMappings(_ref3) {
52847
52868
  data: {
52848
52869
  name: node === null || node === void 0 || (_node$data6 = node.data) === null || _node$data6 === void 0 ? void 0 : _node$data6.name,
52849
52870
  content: node === null || node === void 0 || (_node$data7 = node.data) === null || _node$data7 === void 0 ? void 0 : _node$data7.content,
52850
- isOnlyOne: true
52871
+ isOnlyOne: true,
52872
+ isPdf: true
52851
52873
  },
52852
52874
  targetHandle: node.data.order % 2 === 0 ? "left-handle-target" : "right-handle-target"
52853
52875
  });
@@ -52966,7 +52988,8 @@ function StakeholderMappings(_ref3) {
52966
52988
  duration: 300
52967
52989
  });
52968
52990
  },
52969
- ref: reactFlowWrapper
52991
+ ref: reactFlowWrapper,
52992
+ isPdf: isPdf
52970
52993
  });
52971
52994
  }
52972
52995
  var index$1 = withProvider(StakeholderMappings);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.352",
3
+ "version": "0.6.353",
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"}>
@@ -301,6 +301,7 @@ function StakeholderMappings({
301
301
  name: node?.data?.name,
302
302
  content: node?.data?.content,
303
303
  isOnlyOne: true,
304
+ isPdf: true,
304
305
  },
305
306
  targetHandle:
306
307
  node.data.order % 2 === 0 ? "left-handle-target" : "right-handle-target",
@@ -444,6 +445,7 @@ function StakeholderMappings({
444
445
  });
445
446
  }}
446
447
  ref={reactFlowWrapper}
448
+ isPdf={isPdf}
447
449
  />
448
450
  );
449
451
  }
@@ -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,10 +1,10 @@
1
1
  import { Popover, Tag } from "antd";
2
2
  import {
3
- BaseEdge,
4
- EdgeLabelRenderer,
5
- getEdgeCenter,
6
- getSmoothStepPath,
7
- // getStraightPath,
3
+ BaseEdge,
4
+ EdgeLabelRenderer,
5
+ getEdgeCenter,
6
+ getSmoothStepPath,
7
+ getStraightPath,
8
8
  } from "@xyflow/react";
9
9
  import { renderTooltipJsx } from "../../../../../utils/tooltip.js";
10
10
  import CustomIcon from "../../../Icon/CustomIcon.jsx";
@@ -22,25 +22,36 @@ export const edgeStroke = "#9DA4AE";
22
22
  export const edgeStrokeActive = "#9254DE";
23
23
 
24
24
  export default function ToolTipEdge({
25
- sourceX,
26
- sourceY,
27
- targetX,
28
- targetY,
29
- sourcePosition,
30
- data,
31
- targetPosition,
25
+ sourceX,
26
+ sourceY,
27
+ targetX,
28
+ targetY,
29
+ sourcePosition,
30
+ data,
31
+ targetPosition,
32
32
  }) {
33
- const [smoothPath] = getSmoothStepPath({
34
- sourceX,
35
- sourceY,
36
- sourcePosition,
37
- targetX,
38
- targetY,
39
- targetPosition,
40
- borderRadius: 15,
41
- });
33
+ console.log({data})
34
+ let edgePath;
35
+ if (data?.isPdf || data?.isOnlyOne) {
36
+ [edgePath] = getStraightPath({
37
+ sourceX,
38
+ sourceY,
39
+ targetX,
40
+ targetY,
41
+ });
42
+ } else {
43
+ [edgePath] = getSmoothStepPath({
44
+ sourceX,
45
+ sourceY,
46
+ sourcePosition,
47
+ targetX,
48
+ targetY,
49
+ targetPosition,
50
+ borderRadius: 15,
51
+ });
52
+ }
42
53
 
43
- const center = getEdgeCenter({
54
+ const center = getEdgeCenter({
44
55
  sourceX,
45
56
  sourceY,
46
57
  targetX,
@@ -49,7 +60,7 @@ export default function ToolTipEdge({
49
60
 
50
61
  return (
51
62
  <>
52
- <BaseEdge path={smoothPath} />
63
+ <BaseEdge path={edgePath} />
53
64
  <EdgeLabelRenderer>
54
65
  <div
55
66
  className="button-edge__label nodrag nopan"
@@ -13,6 +13,8 @@ const { useToken } = theme;
13
13
  export default function NameNode({ data }) {
14
14
  const { token } = useToken();
15
15
  const translateFN = typeof data?.t === "function" ? data.t : (key) => key;
16
+ const isPdf = data?.isPdf;
17
+
16
18
  return (
17
19
  <>
18
20
  <Handle
@@ -34,6 +36,7 @@ export default function NameNode({ data }) {
34
36
  }}
35
37
  />
36
38
  <Style
39
+ $isPdf={isPdf}
37
40
  style={{
38
41
  opacity: data.isEmpty ? 0.5 : 1,
39
42
  }}
@@ -95,19 +98,21 @@ export default function NameNode({ data }) {
95
98
  ) : null}
96
99
  </div>
97
100
 
98
- <div
99
- style={{
100
- marginLeft: "auto",
101
- }}
102
- className="go-to"
103
- onClick={() => {
104
- if (typeof data.onClick === "function") {
105
- data.onClick();
106
- }
107
- }}
108
- >
109
- <CustomIcon height={14} width={14} name="LinkNewTab" />
110
- </div>
101
+ {!isPdf && (
102
+ <div
103
+ style={{
104
+ marginLeft: "auto",
105
+ }}
106
+ className="go-to"
107
+ onClick={() => {
108
+ if (typeof data.onClick === "function") {
109
+ data.onClick();
110
+ }
111
+ }}
112
+ >
113
+ <CustomIcon height={14} width={14} name="LinkNewTab" />
114
+ </div>
115
+ )}
111
116
  </div>
112
117
  </Style>
113
118
  <Handle
@@ -129,25 +134,30 @@ export default function NameNode({ data }) {
129
134
  }
130
135
 
131
136
  const Style = styled.div`
132
- width: ${NAME_CARD_WIDTH}px;
133
- display: flex;
134
- background: white;
135
- border-radius: 8px;
136
- box-shadow: 0px 3.76px 10.03px 0px #00000014;
137
- box-shadow: 0px 1.88px 3.76px -2.51px #0000001f;
138
- overflow: hidden;
139
- box-shadow: 0px 5.64px 17.56px 5.02px #0000000d;
137
+ width: ${NAME_CARD_WIDTH}px;
138
+ display: flex;
139
+ background: white;
140
+ 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
+ overflow: hidden;
145
+ box-shadow: 0px 5.64px 17.56px 5.02px #0000000d;
146
+ /* Ensure borders/colors survive PDF rendering */
147
+ border: ${(props) => (props.$isPdf ? '1px solid var(--base-gray-30)' : 'none')};
148
+ -webkit-print-color-adjust: exact;
149
+ print-color-adjust: exact;
140
150
 
141
- .left {
142
- width: 32px;
143
- background: red;
144
- border-top-left-radius: 12px;
145
- border-bottom-left-radius: 12px;
146
- }
151
+ .left {
152
+ width: 32px;
153
+ background: red;
154
+ border-top-left-radius: 12px;
155
+ border-bottom-left-radius: 12px;
156
+ }
147
157
 
148
- .right {
149
- padding: 16px 12px;
150
- width: 100%
151
- border-bottom: 1px solid var(--base-gray-30);
152
- }
158
+ .right {
159
+ padding: 16px 12px;
160
+ width: 100%;
161
+ border-bottom: 1px solid var(--base-gray-30);
162
+ }
153
163
  `;