datastake-daf 0.6.351 → 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.
- package/dist/components/index.js +85 -61
- package/package.json +1 -1
- package/src/@daf/core/components/Charts/ColumnChart/ColumnChart.stories.jsx +28 -0
- package/src/@daf/core/components/Graphs/StakeholderMappings/index.jsx +2 -0
- package/src/@daf/core/components/Graphs/components/BaseGraph.jsx +40 -37
- package/src/@daf/core/components/Graphs/components/Edges/TooltipEdge.jsx +34 -23
- package/src/@daf/core/components/Graphs/components/Nodes/NameNode.jsx +42 -32
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/columns.js +79 -0
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/helper.js +20 -78
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/index.jsx +11 -55
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/columns.js +224 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/helper.js +0 -224
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +6 -6
package/dist/components/index.js
CHANGED
|
@@ -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
|
-
|
|
51487
|
-
|
|
51488
|
-
|
|
51489
|
-
|
|
51490
|
-
|
|
51491
|
-
|
|
51492
|
-
|
|
51493
|
-
|
|
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
|
-
|
|
51496
|
-
|
|
51497
|
-
|
|
51498
|
-
|
|
51499
|
-
|
|
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
|
-
|
|
51503
|
-
|
|
51504
|
-
|
|
51505
|
-
|
|
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
|
-
|
|
51742
|
-
|
|
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:
|
|
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);
|
|
@@ -55628,6 +55651,7 @@ const getNameByLevel = (data, level) => {
|
|
|
55628
55651
|
const entry = Object.values(data || {}).find(item => item.level === level);
|
|
55629
55652
|
return entry;
|
|
55630
55653
|
};
|
|
55654
|
+
|
|
55631
55655
|
const getColumns$3 = ({
|
|
55632
55656
|
t,
|
|
55633
55657
|
goTo = () => {},
|
|
@@ -56261,6 +56285,21 @@ function LocationTable(_ref) {
|
|
|
56261
56285
|
});
|
|
56262
56286
|
}
|
|
56263
56287
|
|
|
56288
|
+
const mapToSelectOptions = (items, valueKey, selectOptions, optionKey, customMapper = null) => {
|
|
56289
|
+
return items.map(item => {
|
|
56290
|
+
if (customMapper) {
|
|
56291
|
+
return customMapper(item);
|
|
56292
|
+
}
|
|
56293
|
+
const value = item?.[valueKey] || "-";
|
|
56294
|
+
const optionsList = selectOptions?.[optionKey] || [];
|
|
56295
|
+
const foundOption = optionsList.find(option => option.value === value);
|
|
56296
|
+
return {
|
|
56297
|
+
label: foundOption?.label || value,
|
|
56298
|
+
value: value
|
|
56299
|
+
};
|
|
56300
|
+
}).filter((option, index, self) => index === self.findIndex(o => o.value === option.value));
|
|
56301
|
+
};
|
|
56302
|
+
|
|
56264
56303
|
const getColumns$1 = ({
|
|
56265
56304
|
t,
|
|
56266
56305
|
selectOptions,
|
|
@@ -56443,12 +56482,7 @@ function CombineSubjectsModal({
|
|
|
56443
56482
|
className: "flex-1",
|
|
56444
56483
|
name: "id",
|
|
56445
56484
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
56446
|
-
options: selectedSubjects
|
|
56447
|
-
return {
|
|
56448
|
-
label: location?.datastakeId || "-",
|
|
56449
|
-
value: location?.datastakeId || "-"
|
|
56450
|
-
};
|
|
56451
|
-
}),
|
|
56485
|
+
options: mapToSelectOptions(selectedSubjects, "datastakeId", selectOptions, null),
|
|
56452
56486
|
placeholder: t("ID")
|
|
56453
56487
|
})
|
|
56454
56488
|
}), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
@@ -56461,24 +56495,14 @@ function CombineSubjectsModal({
|
|
|
56461
56495
|
className: "flex-1",
|
|
56462
56496
|
name: "category",
|
|
56463
56497
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
56464
|
-
options: selectedSubjects
|
|
56465
|
-
return {
|
|
56466
|
-
label: (selectOptions?.category || []).find(option => option.value === location?.category)?.label || location?.category || "-",
|
|
56467
|
-
value: location?.category || "-"
|
|
56468
|
-
};
|
|
56469
|
-
}).filter((option, index, self) => index === self.findIndex(o => o.value === option.value)),
|
|
56498
|
+
options: mapToSelectOptions(selectedSubjects, "category", selectOptions, "category"),
|
|
56470
56499
|
placeholder: t("Category")
|
|
56471
56500
|
})
|
|
56472
56501
|
}), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
56473
56502
|
className: "flex-1",
|
|
56474
56503
|
name: "country",
|
|
56475
56504
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
56476
|
-
options: selectedSubjects
|
|
56477
|
-
return {
|
|
56478
|
-
label: (selectOptions?.country || []).find(option => option.value === location?.country)?.label || location?.country || "-",
|
|
56479
|
-
value: location?.country || "-"
|
|
56480
|
-
};
|
|
56481
|
-
}).filter((option, index, self) => index === self.findIndex(o => o.value === option.value)),
|
|
56505
|
+
options: mapToSelectOptions(selectedSubjects, "country", selectOptions, "country"),
|
|
56482
56506
|
placeholder: t("admin::country")
|
|
56483
56507
|
})
|
|
56484
56508
|
}), entity.includes("locations") && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
@@ -56487,26 +56511,26 @@ function CombineSubjectsModal({
|
|
|
56487
56511
|
name: "administrativeLevel1",
|
|
56488
56512
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
56489
56513
|
placeholder: t("Province"),
|
|
56490
|
-
options: selectedSubjects
|
|
56491
|
-
const _data = getNameByLevel(
|
|
56514
|
+
options: mapToSelectOptions(selectedSubjects, null, selectOptions, null, subject => {
|
|
56515
|
+
const _data = getNameByLevel(subject?.linking?.SCL, "level_1");
|
|
56492
56516
|
return {
|
|
56493
56517
|
label: _data?.name || "-",
|
|
56494
56518
|
value: _data?.id || "-"
|
|
56495
56519
|
};
|
|
56496
|
-
})
|
|
56520
|
+
})
|
|
56497
56521
|
})
|
|
56498
56522
|
}), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
56499
56523
|
className: "flex-1",
|
|
56500
56524
|
name: "administrativeLevel2",
|
|
56501
56525
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
56502
56526
|
placeholder: t("Territory"),
|
|
56503
|
-
options: selectedSubjects
|
|
56504
|
-
const _data = getNameByLevel(
|
|
56527
|
+
options: mapToSelectOptions(selectedSubjects, null, selectOptions, null, subject => {
|
|
56528
|
+
const _data = getNameByLevel(subject?.linking?.SCL, "level_2");
|
|
56505
56529
|
return {
|
|
56506
56530
|
label: _data?.name || "-",
|
|
56507
56531
|
value: _data?.id || "-"
|
|
56508
56532
|
};
|
|
56509
|
-
})
|
|
56533
|
+
})
|
|
56510
56534
|
})
|
|
56511
56535
|
})]
|
|
56512
56536
|
})]
|
|
@@ -56545,7 +56569,7 @@ function SubjectsTable(_ref) {
|
|
|
56545
56569
|
const {
|
|
56546
56570
|
token
|
|
56547
56571
|
} = useToken();
|
|
56548
|
-
const [
|
|
56572
|
+
const [isCombineModalOpen, setIsModalOpen] = React.useState(false);
|
|
56549
56573
|
const {
|
|
56550
56574
|
filter,
|
|
56551
56575
|
activeTab,
|
|
@@ -56598,7 +56622,7 @@ function SubjectsTable(_ref) {
|
|
|
56598
56622
|
headerTitle: headerTitle,
|
|
56599
56623
|
actionButton: [{
|
|
56600
56624
|
icon: "Merge",
|
|
56601
|
-
onClick: () =>
|
|
56625
|
+
onClick: () => setIsModalOpen(true),
|
|
56602
56626
|
tooltip: t("admin::merge-subjects"),
|
|
56603
56627
|
disabled: selectedSubjects.length < 2
|
|
56604
56628
|
}],
|
|
@@ -56652,13 +56676,13 @@ function SubjectsTable(_ref) {
|
|
|
56652
56676
|
onChange: filter.onTableChange
|
|
56653
56677
|
})]
|
|
56654
56678
|
}), /*#__PURE__*/jsxRuntime.jsx(CombineSubjectsModal, {
|
|
56655
|
-
isOpen:
|
|
56679
|
+
isOpen: isCombineModalOpen,
|
|
56656
56680
|
t: t,
|
|
56657
56681
|
onClose: () => {
|
|
56658
|
-
|
|
56682
|
+
setIsModalOpen(false);
|
|
56659
56683
|
},
|
|
56660
56684
|
onSuccess: data => {
|
|
56661
|
-
|
|
56685
|
+
setIsModalOpen(false);
|
|
56662
56686
|
setLoading(true);
|
|
56663
56687
|
if (typeof mergeSubjectsFunction === 'function') {
|
|
56664
56688
|
mergeSubjectsFunction(data);
|
package/package.json
CHANGED
|
@@ -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
|
-
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
sourceX,
|
|
26
|
+
sourceY,
|
|
27
|
+
targetX,
|
|
28
|
+
targetY,
|
|
29
|
+
sourcePosition,
|
|
30
|
+
data,
|
|
31
|
+
targetPosition,
|
|
32
32
|
}) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
158
|
+
.right {
|
|
159
|
+
padding: 16px 12px;
|
|
160
|
+
width: 100%;
|
|
161
|
+
border-bottom: 1px solid var(--base-gray-30);
|
|
162
|
+
}
|
|
153
163
|
`;
|