datastake-daf 0.6.161 → 0.6.162
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 +129 -75
- package/package.json +1 -1
- package/src/@daf/core/components/AvatarGroup/index.jsx +0 -1
- package/src/@daf/core/components/Dashboard/Map/helper.js +418 -492
- package/src/@daf/core/components/Dashboard/Map/hook.js +11 -3
- package/src/@daf/core/components/Dashboard/Widget/ProjectWidget/ProjectWidget.stories.jsx +3 -3
- package/src/@daf/core/components/Dashboard/Widget/ProjectWidget/components/SdgList.jsx +78 -0
- package/src/@daf/core/components/Dashboard/Widget/ProjectWidget/index.jsx +85 -86
- package/src/@daf/core/components/Dashboard/Widget/ProjectWidget/style.js +11 -1
- package/src/@daf/core/components/PdfForm/index.js +13 -1
- package/src/@daf/core/components/PdfForm/storyConfig.js +1 -1
package/dist/components/index.js
CHANGED
|
@@ -15028,7 +15028,18 @@ const PdfForm = _ref3 => {
|
|
|
15028
15028
|
// Group objects under headers based on position
|
|
15029
15029
|
const organizeFormByHeaders = formData => {
|
|
15030
15030
|
const organizedSections = {};
|
|
15031
|
-
|
|
15031
|
+
|
|
15032
|
+
// Sort sections by position before processing
|
|
15033
|
+
const sortedSectionKeys = Object.keys(formData).filter(sectionKey => {
|
|
15034
|
+
const section = formData[sectionKey];
|
|
15035
|
+
return typeof section === 'object' && section.label;
|
|
15036
|
+
}).sort((a, b) => {
|
|
15037
|
+
var _formData$a, _formData$b;
|
|
15038
|
+
const positionA = ((_formData$a = formData[a]) === null || _formData$a === void 0 ? void 0 : _formData$a.position) || 0;
|
|
15039
|
+
const positionB = ((_formData$b = formData[b]) === null || _formData$b === void 0 ? void 0 : _formData$b.position) || 0;
|
|
15040
|
+
return positionA - positionB;
|
|
15041
|
+
});
|
|
15042
|
+
sortedSectionKeys.forEach(sectionKey => {
|
|
15032
15043
|
const section = formData[sectionKey];
|
|
15033
15044
|
if (typeof section !== 'object' || !section.label) {
|
|
15034
15045
|
return;
|
|
@@ -17547,57 +17558,6 @@ function useMapHelper$1({
|
|
|
17547
17558
|
let iconSize = [25, 25];
|
|
17548
17559
|
if (type === "event") {
|
|
17549
17560
|
iconClassName = "incident rounded";
|
|
17550
|
-
|
|
17551
|
-
/* const incidents = data?.data || [];
|
|
17552
|
-
const totals = {
|
|
17553
|
-
major: incidents.filter((d) => d.type === "major_incident").length,
|
|
17554
|
-
minor: incidents.filter((d) => d.type === "minor_incident").length,
|
|
17555
|
-
moderate: incidents.filter((d) => d.type === "moderate_incident").length,
|
|
17556
|
-
correctiveActions: incidents.filter((d) => d.type === "correctiveActions")
|
|
17557
|
-
.length,
|
|
17558
|
-
};
|
|
17559
|
-
const total = incidents.length;
|
|
17560
|
-
let background = "#f1f1f1";
|
|
17561
|
-
if (total > 0) {
|
|
17562
|
-
const categories = [
|
|
17563
|
-
{ key: "major", value: totals.major, color: EVENT_COLORS.MAJOR },
|
|
17564
|
-
{
|
|
17565
|
-
key: "moderate",
|
|
17566
|
-
value: totals.moderate,
|
|
17567
|
-
color: EVENT_COLORS.MODERATE,
|
|
17568
|
-
},
|
|
17569
|
-
{ key: "minor", value: totals.minor, color: EVENT_COLORS.MINOR },
|
|
17570
|
-
{
|
|
17571
|
-
key: "corrective",
|
|
17572
|
-
value: totals.correctiveActions,
|
|
17573
|
-
color: EVENT_COLORS.CORRECTIVE,
|
|
17574
|
-
},
|
|
17575
|
-
]
|
|
17576
|
-
.filter((c) => c.value > 0)
|
|
17577
|
-
.map((c) => ({ ...c, perc: (c.value / total) * 100 }));
|
|
17578
|
-
if (categories.length === 1) {
|
|
17579
|
-
background = categories[0].color;
|
|
17580
|
-
} else {
|
|
17581
|
-
let currentStop = 0;
|
|
17582
|
-
const gradientStops = categories.map((cat, index) => {
|
|
17583
|
-
const stop = categories
|
|
17584
|
-
.slice(0, index)
|
|
17585
|
-
.reduce((acc, c) => acc + c.perc, 0);
|
|
17586
|
-
return `${cat.color} ${Math.round(stop)}%`;
|
|
17587
|
-
});
|
|
17588
|
-
background = `radial-gradient(circle, ${gradientStops.join(", ")})`;
|
|
17589
|
-
}
|
|
17590
|
-
}
|
|
17591
|
-
let radius = 35;
|
|
17592
|
-
if (data.total > 20) {
|
|
17593
|
-
radius = 65;
|
|
17594
|
-
} else if (data.total > 10) {
|
|
17595
|
-
radius = 50;
|
|
17596
|
-
} else {
|
|
17597
|
-
radius = 40;
|
|
17598
|
-
}
|
|
17599
|
-
*/
|
|
17600
|
-
|
|
17601
17561
|
const {
|
|
17602
17562
|
background,
|
|
17603
17563
|
radius,
|
|
@@ -18133,7 +18093,17 @@ const useMap$1 = ({
|
|
|
18133
18093
|
}
|
|
18134
18094
|
addAllDataToMap();
|
|
18135
18095
|
}
|
|
18136
|
-
}, [data, mapRef,
|
|
18096
|
+
}, [data, mapRef, activeStakeholder]);
|
|
18097
|
+
React.useEffect(() => {
|
|
18098
|
+
if (mapRef && data && type === "chain") {
|
|
18099
|
+
if (!initialMarkerSetIsDone) {
|
|
18100
|
+
setInitialMarkerSetIsDone(true);
|
|
18101
|
+
} else {
|
|
18102
|
+
clearMapMarkers();
|
|
18103
|
+
}
|
|
18104
|
+
addAllDataToMap();
|
|
18105
|
+
}
|
|
18106
|
+
}, [zoom, selectedMarkersId, markerWithPopup, openPopupIdRef.current, polylinesRef.current.length]);
|
|
18137
18107
|
React.useEffect(() => {
|
|
18138
18108
|
const marker = mapMarkers.find(m => m.id === activeMarker);
|
|
18139
18109
|
if (getZoom && marker && mapRef) {
|
|
@@ -20480,8 +20450,10 @@ const ProjectWidgetItems = dt.ul`
|
|
|
20480
20450
|
const SDGList = dt.ul`
|
|
20481
20451
|
list-style: none;
|
|
20482
20452
|
padding: 0;
|
|
20453
|
+
width: 100%;
|
|
20454
|
+
overflow-x: hidden;
|
|
20483
20455
|
display: flex;
|
|
20484
|
-
flex-wrap:
|
|
20456
|
+
flex-wrap: nowrap;
|
|
20485
20457
|
gap: 4px;
|
|
20486
20458
|
margin: 0;
|
|
20487
20459
|
|
|
@@ -20492,6 +20464,14 @@ const SDGList = dt.ul`
|
|
|
20492
20464
|
background-position: center;
|
|
20493
20465
|
background-repeat: no-repeat;
|
|
20494
20466
|
}
|
|
20467
|
+
|
|
20468
|
+
.sdg-item-more {
|
|
20469
|
+
display: flex;
|
|
20470
|
+
align-items: center;
|
|
20471
|
+
justify-content: center;
|
|
20472
|
+
background: var(--base-gray-30);
|
|
20473
|
+
color: var(--base-gray-90);
|
|
20474
|
+
}
|
|
20495
20475
|
`;
|
|
20496
20476
|
const Label = dt.span`
|
|
20497
20477
|
font-family: SF UI Display;
|
|
@@ -20504,6 +20484,82 @@ const Label = dt.span`
|
|
|
20504
20484
|
color: #6c737f;
|
|
20505
20485
|
`;
|
|
20506
20486
|
|
|
20487
|
+
const SDG_IMAGE_WIDTH = 24;
|
|
20488
|
+
const GAP_BETWEEN_SDGS = 4;
|
|
20489
|
+
const TOTAL_SPACE_FOR_SDG = SDG_IMAGE_WIDTH + GAP_BETWEEN_SDGS;
|
|
20490
|
+
function SdgList({
|
|
20491
|
+
sdgList = [],
|
|
20492
|
+
t,
|
|
20493
|
+
cardWidth
|
|
20494
|
+
}) {
|
|
20495
|
+
const maxSdgToShow = React.useMemo(() => {
|
|
20496
|
+
return Math.floor(cardWidth / TOTAL_SPACE_FOR_SDG);
|
|
20497
|
+
}, [cardWidth]);
|
|
20498
|
+
const {
|
|
20499
|
+
visibleSdgs,
|
|
20500
|
+
hiddenCount
|
|
20501
|
+
} = React.useMemo(() => {
|
|
20502
|
+
if (sdgList.length <= maxSdgToShow) {
|
|
20503
|
+
return {
|
|
20504
|
+
visibleSdgs: sdgList,
|
|
20505
|
+
hiddenCount: 0
|
|
20506
|
+
};
|
|
20507
|
+
}
|
|
20508
|
+
return {
|
|
20509
|
+
visibleSdgs: sdgList.slice(0, maxSdgToShow - 1),
|
|
20510
|
+
hiddenCount: sdgList.length - (maxSdgToShow - 1)
|
|
20511
|
+
};
|
|
20512
|
+
}, [sdgList, maxSdgToShow]);
|
|
20513
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
20514
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Label, {
|
|
20515
|
+
children: "SDGs:"
|
|
20516
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(SDGList, {
|
|
20517
|
+
children: [visibleSdgs.map((sdg, index) => /*#__PURE__*/jsxRuntime.jsx("li", {
|
|
20518
|
+
className: "project-widget-item",
|
|
20519
|
+
children: /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
20520
|
+
title: t(`SDGS::${sdg}`),
|
|
20521
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
20522
|
+
style: {
|
|
20523
|
+
backgroundImage: `url(${SDG_IMAGES[sdg].img})`
|
|
20524
|
+
},
|
|
20525
|
+
className: "sdg-item-image"
|
|
20526
|
+
})
|
|
20527
|
+
})
|
|
20528
|
+
}, index)), hiddenCount > 0 && /*#__PURE__*/jsxRuntime.jsx("li", {
|
|
20529
|
+
className: "project-widget-item",
|
|
20530
|
+
children: /*#__PURE__*/jsxRuntime.jsx(antd.Popover, {
|
|
20531
|
+
placement: "top",
|
|
20532
|
+
content: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
20533
|
+
style: {
|
|
20534
|
+
display: "flex",
|
|
20535
|
+
gap: "4px",
|
|
20536
|
+
flexWrap: "wrap",
|
|
20537
|
+
maxWidth: 200
|
|
20538
|
+
},
|
|
20539
|
+
children: sdgList.slice(visibleSdgs.length).map((sdg, idx) => /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
20540
|
+
title: t(`SDGS::${sdg}`),
|
|
20541
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
20542
|
+
style: {
|
|
20543
|
+
width: SDG_IMAGE_WIDTH,
|
|
20544
|
+
height: SDG_IMAGE_WIDTH,
|
|
20545
|
+
backgroundImage: `url(${SDG_IMAGES[sdg].img})`,
|
|
20546
|
+
backgroundSize: "cover",
|
|
20547
|
+
borderRadius: 4
|
|
20548
|
+
},
|
|
20549
|
+
title: t(`SDGS::${sdg}`)
|
|
20550
|
+
})
|
|
20551
|
+
}, idx))
|
|
20552
|
+
}),
|
|
20553
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
20554
|
+
className: "sdg-item-image sdg-item-more",
|
|
20555
|
+
children: ["+", hiddenCount]
|
|
20556
|
+
})
|
|
20557
|
+
})
|
|
20558
|
+
})]
|
|
20559
|
+
})]
|
|
20560
|
+
});
|
|
20561
|
+
}
|
|
20562
|
+
|
|
20507
20563
|
const _excluded$c = ["title", "description", "onLinkClick", "image", "linkIcon", "sdgList", "items", "onCardClick", "hideSDGList", "t"];
|
|
20508
20564
|
const {
|
|
20509
20565
|
Meta
|
|
@@ -20529,9 +20585,20 @@ function ProjectWidget(_ref) {
|
|
|
20529
20585
|
const {
|
|
20530
20586
|
token
|
|
20531
20587
|
} = useToken$i();
|
|
20588
|
+
const cardRef = React__default["default"].useRef(null);
|
|
20589
|
+
const [cardWidth, setCardWidth] = React__default["default"].useState(0);
|
|
20590
|
+
React__default["default"].useEffect(() => {
|
|
20591
|
+
const resizeObserver = new ResizeObserver(entries => {
|
|
20592
|
+
setCardWidth(entries[0].contentRect.width);
|
|
20593
|
+
});
|
|
20594
|
+
resizeObserver.observe(cardRef.current);
|
|
20595
|
+
return () => resizeObserver.disconnect();
|
|
20596
|
+
}, [cardRef]);
|
|
20532
20597
|
return /*#__PURE__*/jsxRuntime.jsxs(antd.Card, _objectSpread2(_objectSpread2({
|
|
20533
20598
|
style: {
|
|
20534
|
-
flex: 1
|
|
20599
|
+
flex: 1,
|
|
20600
|
+
width: "100%",
|
|
20601
|
+
minWidth: "200px"
|
|
20535
20602
|
},
|
|
20536
20603
|
hoverable: true,
|
|
20537
20604
|
onMouseEnter: () => setIsHovered(true),
|
|
@@ -20565,29 +20632,17 @@ function ProjectWidget(_ref) {
|
|
|
20565
20632
|
children: item.label
|
|
20566
20633
|
}), item.render()]
|
|
20567
20634
|
}, index))
|
|
20568
|
-
}), !hideSDGList && /*#__PURE__*/jsxRuntime.
|
|
20635
|
+
}), !hideSDGList && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
20569
20636
|
style: {
|
|
20570
20637
|
borderTop: "1px solid var(--base-gray-30)",
|
|
20571
20638
|
paddingTop: "10px"
|
|
20572
20639
|
},
|
|
20573
|
-
|
|
20574
|
-
|
|
20575
|
-
|
|
20576
|
-
|
|
20577
|
-
|
|
20578
|
-
|
|
20579
|
-
children: /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
20580
|
-
title: t("SDGS::".concat(sdg)),
|
|
20581
|
-
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
20582
|
-
style: {
|
|
20583
|
-
backgroundImage: "url(".concat(SDG_IMAGES[sdg].img, ")")
|
|
20584
|
-
},
|
|
20585
|
-
className: "sdg-item-image"
|
|
20586
|
-
})
|
|
20587
|
-
})
|
|
20588
|
-
}, index);
|
|
20589
|
-
})
|
|
20590
|
-
})]
|
|
20640
|
+
ref: cardRef,
|
|
20641
|
+
children: /*#__PURE__*/jsxRuntime.jsx(SdgList, {
|
|
20642
|
+
sdgList: sdgList,
|
|
20643
|
+
t: t,
|
|
20644
|
+
cardWidth: cardWidth
|
|
20645
|
+
})
|
|
20591
20646
|
})]
|
|
20592
20647
|
}));
|
|
20593
20648
|
}
|
|
@@ -47171,7 +47226,6 @@ function AvatarGroup(_ref) {
|
|
|
47171
47226
|
const {
|
|
47172
47227
|
token
|
|
47173
47228
|
} = useToken$f();
|
|
47174
|
-
console.log("token", token);
|
|
47175
47229
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Avatar.Group, {
|
|
47176
47230
|
max: {
|
|
47177
47231
|
count: count,
|
package/package.json
CHANGED