datastake-daf 0.6.264 β 0.6.266
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 +172 -40
- package/package.json +2 -2
- package/src/@daf/core/components/Dashboard/Globe/README.md +106 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobe.jsx +185 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobe.stories.js +174 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeDebug.jsx +85 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeExample.jsx +75 -0
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeTest.jsx +48 -0
- package/src/@daf/core/components/Dashboard/Map/helper.js +8 -1
- package/src/@daf/core/components/Dashboard/Map/hook.js +2 -0
- package/src/@daf/core/components/Dashboard/Map/index.jsx +159 -165
- package/src/@daf/core/components/Dashboard/Map/storyConfig3.js +6 -0
- package/src/@daf/core/components/EditForm/form.jsx +621 -551
- package/src/@daf/core/components/EditForm/storyConfig2.js +28 -33
- package/src/index.js +1 -0
package/dist/components/index.js
CHANGED
|
@@ -18213,6 +18213,7 @@ function useMapHelper$1({
|
|
|
18213
18213
|
mapCenter,
|
|
18214
18214
|
allData,
|
|
18215
18215
|
renderTooltip,
|
|
18216
|
+
renderTooltipTags,
|
|
18216
18217
|
onClickLink,
|
|
18217
18218
|
link,
|
|
18218
18219
|
tooltipAsText,
|
|
@@ -18245,7 +18246,6 @@ function useMapHelper$1({
|
|
|
18245
18246
|
|
|
18246
18247
|
// Actions to do when active marker is changed
|
|
18247
18248
|
React.useEffect(() => {
|
|
18248
|
-
console.log("RERENDER");
|
|
18249
18249
|
if (mapRef) {
|
|
18250
18250
|
if (activeMarker) {
|
|
18251
18251
|
mapRef.eachLayer(layer => {
|
|
@@ -18332,6 +18332,7 @@ function useMapHelper$1({
|
|
|
18332
18332
|
...data,
|
|
18333
18333
|
totals
|
|
18334
18334
|
}),
|
|
18335
|
+
tags: renderTooltipTags(data),
|
|
18335
18336
|
link,
|
|
18336
18337
|
total: data.sources,
|
|
18337
18338
|
onClickLink: () => onClickLink(data)
|
|
@@ -18355,6 +18356,7 @@ function useMapHelper$1({
|
|
|
18355
18356
|
children: renderTooltipJsx({
|
|
18356
18357
|
title: data.name,
|
|
18357
18358
|
items: renderTooltip(data),
|
|
18359
|
+
tags: renderTooltipTags(data),
|
|
18358
18360
|
link,
|
|
18359
18361
|
total: data.sources,
|
|
18360
18362
|
onClickLink: () => onClickLink(data)
|
|
@@ -18387,6 +18389,7 @@ function useMapHelper$1({
|
|
|
18387
18389
|
data: data,
|
|
18388
18390
|
title: data.name,
|
|
18389
18391
|
renderTooltip: renderTooltip,
|
|
18392
|
+
renderTooltipTags: renderTooltipTags,
|
|
18390
18393
|
link: link,
|
|
18391
18394
|
onClickLink: onClickLink,
|
|
18392
18395
|
activeStakeholder: activeStakeholder,
|
|
@@ -18421,7 +18424,8 @@ function useMapHelper$1({
|
|
|
18421
18424
|
total: data.sources,
|
|
18422
18425
|
link,
|
|
18423
18426
|
onClickLink: () => onClickLink(data),
|
|
18424
|
-
items: renderTooltip(data)
|
|
18427
|
+
items: renderTooltip(data),
|
|
18428
|
+
tags: renderTooltipTags(data)
|
|
18425
18429
|
})
|
|
18426
18430
|
}));
|
|
18427
18431
|
roots.current.push(root);
|
|
@@ -18467,7 +18471,8 @@ function useMapHelper$1({
|
|
|
18467
18471
|
total: data.sources,
|
|
18468
18472
|
link,
|
|
18469
18473
|
onClickLink: () => onClickLink(data),
|
|
18470
|
-
items: renderTooltip(data)
|
|
18474
|
+
items: renderTooltip(data),
|
|
18475
|
+
tags: renderTooltipTags(data)
|
|
18471
18476
|
})
|
|
18472
18477
|
}));
|
|
18473
18478
|
roots.current.push(root);
|
|
@@ -18484,7 +18489,7 @@ function useMapHelper$1({
|
|
|
18484
18489
|
}]);
|
|
18485
18490
|
}
|
|
18486
18491
|
}
|
|
18487
|
-
}, [mapRef, renderTooltip, tooltipAsText, onClickLink, zoom, selectedMarkersId, openPopupIdRef.current, handleSelectMarker, activeStakeholder, setActiveStakeholder]);
|
|
18492
|
+
}, [mapRef, renderTooltip, renderTooltipTags, tooltipAsText, onClickLink, zoom, selectedMarkersId, openPopupIdRef.current, handleSelectMarker, activeStakeholder, setActiveStakeholder]);
|
|
18488
18493
|
|
|
18489
18494
|
// Map control handlers
|
|
18490
18495
|
const zoomHandler = React.useCallback(() => mapRef.setZoom(mapRef.getZoom() + 1), [mapRef]);
|
|
@@ -18575,6 +18580,7 @@ const useMap$1 = ({
|
|
|
18575
18580
|
polygon,
|
|
18576
18581
|
app,
|
|
18577
18582
|
renderTooltip,
|
|
18583
|
+
renderTooltipTags,
|
|
18578
18584
|
mapConfig,
|
|
18579
18585
|
tooltipAsText,
|
|
18580
18586
|
renderMarker,
|
|
@@ -18678,6 +18684,7 @@ const useMap$1 = ({
|
|
|
18678
18684
|
allData,
|
|
18679
18685
|
mapCenter,
|
|
18680
18686
|
renderTooltip,
|
|
18687
|
+
renderTooltipTags,
|
|
18681
18688
|
onClickLink,
|
|
18682
18689
|
link,
|
|
18683
18690
|
tooltipAsText,
|
|
@@ -19069,6 +19076,7 @@ function Map$3(_ref) {
|
|
|
19069
19076
|
link,
|
|
19070
19077
|
siderTitle = "Mine Description",
|
|
19071
19078
|
renderTooltip = () => [],
|
|
19079
|
+
renderTooltipTags = () => {},
|
|
19072
19080
|
mapConfig = {},
|
|
19073
19081
|
emptyDescriptionText = "No description provided",
|
|
19074
19082
|
tooltipAsText = false,
|
|
@@ -19105,6 +19113,7 @@ function Map$3(_ref) {
|
|
|
19105
19113
|
t,
|
|
19106
19114
|
app,
|
|
19107
19115
|
renderTooltip,
|
|
19116
|
+
renderTooltipTags,
|
|
19108
19117
|
onClickLink,
|
|
19109
19118
|
link,
|
|
19110
19119
|
mapConfig,
|
|
@@ -20889,6 +20898,128 @@ Globe.propTypes = {
|
|
|
20889
20898
|
nameAsSiderTitle: PropTypes__default["default"].bool
|
|
20890
20899
|
};
|
|
20891
20900
|
|
|
20901
|
+
const SimpleGlobe = _ref => {
|
|
20902
|
+
let {
|
|
20903
|
+
projects = [],
|
|
20904
|
+
mapConfig = {},
|
|
20905
|
+
showSider = false,
|
|
20906
|
+
onProjectClick = () => {}
|
|
20907
|
+
} = _ref;
|
|
20908
|
+
const mapContainer = React.useRef(null);
|
|
20909
|
+
const map = React.useRef(null);
|
|
20910
|
+
React.useEffect(() => {
|
|
20911
|
+
if (map.current) return; // Initialize map only once
|
|
20912
|
+
|
|
20913
|
+
console.log('πΊοΈ [SIMPLE GLOBE] Creating map...');
|
|
20914
|
+
|
|
20915
|
+
// Set Mapbox access token
|
|
20916
|
+
mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
|
|
20917
|
+
|
|
20918
|
+
// Create map with custom Straatos style
|
|
20919
|
+
map.current = new mapboxgl.Map({
|
|
20920
|
+
container: mapContainer.current,
|
|
20921
|
+
style: 'mapbox://styles/pietragottardo/cm9tt9zfi00d101pg1vdx26si',
|
|
20922
|
+
center: [0, 0],
|
|
20923
|
+
zoom: mapConfig.maxZoom || 3,
|
|
20924
|
+
projection: 'globe',
|
|
20925
|
+
attributionControl: false
|
|
20926
|
+
});
|
|
20927
|
+
|
|
20928
|
+
// Add markers when map loads
|
|
20929
|
+
map.current.on('load', () => {
|
|
20930
|
+
console.log('πΊοΈ [SIMPLE GLOBE] Map loaded, adding markers...');
|
|
20931
|
+
|
|
20932
|
+
// Hide Mapbox logo and attribution completely
|
|
20933
|
+
map.current.getContainer();
|
|
20934
|
+
const style = document.createElement('style');
|
|
20935
|
+
style.textContent = "\n .mapboxgl-ctrl-logo,\n .mapboxgl-ctrl-attrib,\n .mapboxgl-ctrl-bottom-left,\n .mapboxgl-ctrl-bottom-right {\n display: none !important;\n }\n ";
|
|
20936
|
+
document.head.appendChild(style);
|
|
20937
|
+
|
|
20938
|
+
// Set the space background with stars
|
|
20939
|
+
try {
|
|
20940
|
+
map.current.setFog({
|
|
20941
|
+
'color': 'rgb(0, 0, 0)',
|
|
20942
|
+
'high-color': 'rgb(0, 0, 0)',
|
|
20943
|
+
'horizon-blend': 0.1,
|
|
20944
|
+
'space-color': 'rgb(0, 0, 0)',
|
|
20945
|
+
'star-intensity': 0.6
|
|
20946
|
+
});
|
|
20947
|
+
console.log('β¨ [SIMPLE GLOBE] Space background with stars set');
|
|
20948
|
+
} catch (e) {
|
|
20949
|
+
console.log('β οΈ [SIMPLE GLOBE] Could not set fog, trying alternative...');
|
|
20950
|
+
// Fallback: try simpler fog configuration
|
|
20951
|
+
try {
|
|
20952
|
+
map.current.setFog({
|
|
20953
|
+
'color': 'rgb(0, 0, 0)',
|
|
20954
|
+
'high-color': 'rgb(0, 0, 0)',
|
|
20955
|
+
'horizon-blend': 0.1
|
|
20956
|
+
});
|
|
20957
|
+
console.log('β¨ [SIMPLE GLOBE] Alternative space background set');
|
|
20958
|
+
} catch (e2) {
|
|
20959
|
+
console.log('β οΈ [SIMPLE GLOBE] Could not set any fog configuration');
|
|
20960
|
+
}
|
|
20961
|
+
}
|
|
20962
|
+
projects.forEach((project, index) => {
|
|
20963
|
+
var _project$author;
|
|
20964
|
+
console.log("\uD83D\uDCCD [SIMPLE GLOBE] Adding marker ".concat(index, ":"), project);
|
|
20965
|
+
|
|
20966
|
+
// Create marker element
|
|
20967
|
+
const el = document.createElement('div');
|
|
20968
|
+
el.className = 'mapboxgl-marker';
|
|
20969
|
+
el.style.width = '25px';
|
|
20970
|
+
el.style.height = '25px';
|
|
20971
|
+
el.style.backgroundColor = '#00809E';
|
|
20972
|
+
el.style.borderRadius = '50%';
|
|
20973
|
+
el.style.border = '2px solid white';
|
|
20974
|
+
el.style.cursor = 'pointer';
|
|
20975
|
+
el.style.boxShadow = '0px 3.45px 3.45px 0px #00000029';
|
|
20976
|
+
el.style.display = 'flex';
|
|
20977
|
+
el.style.alignItems = 'center';
|
|
20978
|
+
el.style.justifyContent = 'center';
|
|
20979
|
+
el.style.color = 'white';
|
|
20980
|
+
el.style.fontWeight = 'bold';
|
|
20981
|
+
el.style.fontSize = '12px';
|
|
20982
|
+
el.innerHTML = "<span>".concat(project.percentageCompletion || 0, "</span>");
|
|
20983
|
+
|
|
20984
|
+
// Create popup content using the same structure as minesitemap
|
|
20985
|
+
const popupContent = "\n <div class=\"daf-tooltip-cont\">\n <div class=\"daf-tooltip-head\">\n <div class=\"daf-tooltip-title\">\n <div>\n <h4>".concat(project.name, "</h4>\n <h5>").concat(project.sectoralScope || 'Project', "</h5>\n </div>\n </div>\n </div>\n <div class=\"daf-tooltip-list\">\n <div class=\"daf-tooltip-list-item\">\n <span class=\"daf-tooltip-name\">Country</span>\n <span class=\"daf-tooltip-value\">").concat(project.country || 'N/A', "</span>\n </div>\n <div class=\"daf-tooltip-list-item\">\n <span class=\"daf-tooltip-name\">Completion</span>\n <span class=\"daf-tooltip-value\">").concat(project.percentageCompletion || 0, "%</span>\n </div>\n <div class=\"daf-tooltip-list-item\">\n <span class=\"daf-tooltip-name\">Author</span>\n <span class=\"daf-tooltip-value\">").concat(((_project$author = project.author) === null || _project$author === void 0 ? void 0 : _project$author.name) || 'N/A', "</span>\n </div>\n <div class=\"daf-tooltip-list-item\">\n <span class=\"daf-tooltip-name\">ID</span>\n <span class=\"daf-tooltip-value\">").concat(project.datastakeId || 'N/A', "</span>\n </div>\n </div>\n </div>\n ");
|
|
20986
|
+
|
|
20987
|
+
// Create popup
|
|
20988
|
+
const popup = new mapboxgl.Popup({
|
|
20989
|
+
offset: 25,
|
|
20990
|
+
closeButton: true,
|
|
20991
|
+
closeOnClick: false
|
|
20992
|
+
}).setHTML(popupContent);
|
|
20993
|
+
|
|
20994
|
+
// Add marker to map
|
|
20995
|
+
new mapboxgl.Marker(el).setLngLat([project.longitude, project.latitude]).setPopup(popup).addTo(map.current);
|
|
20996
|
+
|
|
20997
|
+
// Add click handler
|
|
20998
|
+
el.addEventListener('click', () => {
|
|
20999
|
+
console.log('π [SIMPLE GLOBE] Marker clicked:', project);
|
|
21000
|
+
onProjectClick(project);
|
|
21001
|
+
});
|
|
21002
|
+
console.log("\u2705 [SIMPLE GLOBE] Marker ".concat(index, " added at:"), [project.longitude, project.latitude]);
|
|
21003
|
+
});
|
|
21004
|
+
});
|
|
21005
|
+
return () => {
|
|
21006
|
+
if (map.current) {
|
|
21007
|
+
map.current.remove();
|
|
21008
|
+
map.current = null;
|
|
21009
|
+
}
|
|
21010
|
+
};
|
|
21011
|
+
}, [projects, onProjectClick, mapConfig]);
|
|
21012
|
+
return /*#__PURE__*/jsxRuntime.jsx(Style$A, {
|
|
21013
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
21014
|
+
ref: mapContainer,
|
|
21015
|
+
style: {
|
|
21016
|
+
width: '100%',
|
|
21017
|
+
height: '100%'
|
|
21018
|
+
}
|
|
21019
|
+
})
|
|
21020
|
+
});
|
|
21021
|
+
};
|
|
21022
|
+
|
|
20892
21023
|
function WidgetPlaceholder(_ref) {
|
|
20893
21024
|
let {
|
|
20894
21025
|
icon = "",
|
|
@@ -33849,7 +33980,7 @@ const EditForm = _ref => {
|
|
|
33849
33980
|
errors = {},
|
|
33850
33981
|
changeErrors = () => {},
|
|
33851
33982
|
evaluationConfig = [],
|
|
33852
|
-
staticWidth =
|
|
33983
|
+
staticWidth = "614px"
|
|
33853
33984
|
} = _ref;
|
|
33854
33985
|
const [isSubmitting] = React.useState(false);
|
|
33855
33986
|
const formData = JSON.parse(JSON.stringify(convertUndefinedToNull(data) || {}));
|
|
@@ -33862,9 +33993,9 @@ const EditForm = _ref => {
|
|
|
33862
33993
|
options = {},
|
|
33863
33994
|
introText,
|
|
33864
33995
|
formTitles,
|
|
33865
|
-
formClass =
|
|
33996
|
+
formClass = ""
|
|
33866
33997
|
} = form || {};
|
|
33867
|
-
const excludedKeys = [...defaultExcludedKeys,
|
|
33998
|
+
const excludedKeys = [...defaultExcludedKeys, "icon", "label", "description", "showFormIf", "sectionLabel", "formDescription", "introText", "formClass", "alertConf", "formTitles", "position", "id"];
|
|
33868
33999
|
const [initialValues, setInitialValues] = React.useState(undefined);
|
|
33869
34000
|
const getData = (name, input, value, commentValue, path, disabledPath) => {
|
|
33870
34001
|
var _input$meta, _input$meta2, _input$meta10, _input$meta11, _input$meta12, _input$meta13, _input$meta14, _input$meta15;
|
|
@@ -33881,28 +34012,28 @@ const EditForm = _ref => {
|
|
|
33881
34012
|
if (disabledInputs.includes(disabledPath) || isDisabled) {
|
|
33882
34013
|
props.disabled = true;
|
|
33883
34014
|
}
|
|
33884
|
-
if (input.type ===
|
|
34015
|
+
if (input.type === "total100" && !value) {
|
|
33885
34016
|
value = [{
|
|
33886
34017
|
type: null,
|
|
33887
34018
|
value: null
|
|
33888
34019
|
}];
|
|
33889
|
-
} else if (input.type ===
|
|
34020
|
+
} else if (input.type === "date") {
|
|
33890
34021
|
// value = value ? typeof value === 'string' ? value : value.format('YYYY-MM-DD') : undefined;
|
|
33891
34022
|
value = convertToDayJs(value);
|
|
33892
|
-
} else if (input.type ===
|
|
34023
|
+
} else if (input.type === "year") {
|
|
33893
34024
|
// value = value ? dayjs(value) : undefined;
|
|
33894
34025
|
value = convertToDayJs(value);
|
|
33895
|
-
} else if (input.type ===
|
|
34026
|
+
} else if (input.type === "switch") {
|
|
33896
34027
|
if (!propHasValue$1(value)) {
|
|
33897
34028
|
value = value || false;
|
|
33898
|
-
if (typeof path ===
|
|
34029
|
+
if (typeof path === "string") {
|
|
33899
34030
|
dot__default["default"].str(path, value, values);
|
|
33900
34031
|
}
|
|
33901
34032
|
}
|
|
33902
|
-
} else if (input.type ===
|
|
33903
|
-
const fileList = (Array.isArray(value) ? value : value && typeof value ===
|
|
33904
|
-
if (!Array.isArray(value) && value && typeof value ===
|
|
33905
|
-
if (typeof path ===
|
|
34033
|
+
} else if (input.type === "upload" || input.type === "imageUpload" || input.type === "videoUpload") {
|
|
34034
|
+
const fileList = (Array.isArray(value) ? value : value && typeof value === "object" && value.fileList && Array.isArray(value.fileList) ? value.fileList.map(f => f.response).filter(f => f) : []) || [];
|
|
34035
|
+
if (!Array.isArray(value) && value && typeof value === "object" && value.fileList && Array.isArray(value.fileList)) {
|
|
34036
|
+
if (typeof path === "string") {
|
|
33906
34037
|
dot__default["default"].set(path, fileList, values);
|
|
33907
34038
|
}
|
|
33908
34039
|
}
|
|
@@ -33929,7 +34060,7 @@ const EditForm = _ref => {
|
|
|
33929
34060
|
});
|
|
33930
34061
|
}
|
|
33931
34062
|
}
|
|
33932
|
-
if (input.type ===
|
|
34063
|
+
if (input.type === "modal") {
|
|
33933
34064
|
props.linkingform = {};
|
|
33934
34065
|
props.datalink = input.dataLink;
|
|
33935
34066
|
if (linkingForms[name]) {
|
|
@@ -33969,21 +34100,21 @@ const EditForm = _ref => {
|
|
|
33969
34100
|
value,
|
|
33970
34101
|
allowDupplicates: input.allowDupplicates,
|
|
33971
34102
|
commentValue,
|
|
33972
|
-
commentHint: input.commentHint ? input.commentHint : t(
|
|
34103
|
+
commentHint: input.commentHint ? input.commentHint : t("Please specify"),
|
|
33973
34104
|
rules: (input.rules || []).map(r => {
|
|
33974
|
-
if (r.message && r.message.indexOf(
|
|
34105
|
+
if (r.message && r.message.indexOf("errors::") >= 0) {
|
|
33975
34106
|
r.message = t(r.message);
|
|
33976
34107
|
}
|
|
33977
34108
|
return r;
|
|
33978
34109
|
}),
|
|
33979
34110
|
template: input.template
|
|
33980
34111
|
};
|
|
33981
|
-
if (input.type ===
|
|
34112
|
+
if (input.type === "switch" && input.autocomplete) {
|
|
33982
34113
|
Object.assign(config, {
|
|
33983
34114
|
autocomplete: input.autocomplete
|
|
33984
34115
|
});
|
|
33985
34116
|
}
|
|
33986
|
-
if (input.type ===
|
|
34117
|
+
if (input.type === "switch") {
|
|
33987
34118
|
if (input.replace) {
|
|
33988
34119
|
Object.assign(config, {
|
|
33989
34120
|
replace: input.replace
|
|
@@ -33995,16 +34126,16 @@ const EditForm = _ref => {
|
|
|
33995
34126
|
});
|
|
33996
34127
|
}
|
|
33997
34128
|
}
|
|
33998
|
-
if (input.type ===
|
|
34129
|
+
if (input.type === "linkingModal") {
|
|
33999
34130
|
Object.assign(config, {
|
|
34000
34131
|
content: input.inputs
|
|
34001
34132
|
});
|
|
34002
34133
|
}
|
|
34003
|
-
if (input.type ===
|
|
34134
|
+
if (input.type === "group") {
|
|
34004
34135
|
Object.assign(config, {
|
|
34005
34136
|
groupInputs: Object.keys(input.groupInputs || {}).map(key => {
|
|
34006
|
-
const isRep = path.split(
|
|
34007
|
-
const newPath = path.split(
|
|
34137
|
+
const isRep = path.split(".")[0].match(/\[/);
|
|
34138
|
+
const newPath = path.split(".").length === 1 ? key : isRep && isRep.length ? path.split(".")[0] + ".".concat(key) : path.split(".")[0] + ".".concat(key);
|
|
34008
34139
|
const groupInp = input.groupInputs[key];
|
|
34009
34140
|
const inputData = getData(groupInp.dataId || key, input.groupInputs[key], dot__default["default"].pick(newPath, values), null, newPath);
|
|
34010
34141
|
return {
|
|
@@ -34023,11 +34154,11 @@ const EditForm = _ref => {
|
|
|
34023
34154
|
})
|
|
34024
34155
|
});
|
|
34025
34156
|
}
|
|
34026
|
-
if (input.type ===
|
|
34157
|
+
if (input.type === "groupInputs") {
|
|
34027
34158
|
Object.assign(config, {
|
|
34028
34159
|
groupInputs: Object.keys(input.inputs || {}).map(key => {
|
|
34029
|
-
const isRep = path.split(
|
|
34030
|
-
const newPath = path.split(
|
|
34160
|
+
const isRep = path.split(".")[0].match(/\[/);
|
|
34161
|
+
const newPath = path.split(".").length === 1 ? key : isRep && isRep.length ? path.split(".")[0] + ".".concat(key) : path.split(".")[0] + ".".concat(key);
|
|
34031
34162
|
const groupInp = input.inputs[key];
|
|
34032
34163
|
const inputData = getData(groupInp.dataId || key, input.inputs[key], dot__default["default"].pick(newPath, values), null, newPath);
|
|
34033
34164
|
return {
|
|
@@ -34069,21 +34200,21 @@ const EditForm = _ref => {
|
|
|
34069
34200
|
style: {
|
|
34070
34201
|
maxWidth: 700
|
|
34071
34202
|
},
|
|
34072
|
-
className: "main-form".concat(formClass ? " ".concat(formClass) :
|
|
34203
|
+
className: "main-form".concat(formClass ? " ".concat(formClass) : ""),
|
|
34073
34204
|
onValuesChange: (_changedValue, _allValues) => {
|
|
34074
34205
|
const changedValue = _objectSpread2({}, _changedValue);
|
|
34075
34206
|
const allValues = _objectSpread2({}, _allValues);
|
|
34076
34207
|
|
|
34077
34208
|
// AjaxSubGroup fix, so meta dont get lost
|
|
34078
34209
|
Object.keys(_allValues || {}).forEach(key => {
|
|
34079
|
-
if (key && values[key] && values[key].meta && typeof values[key] ===
|
|
34210
|
+
if (key && values[key] && values[key].meta && typeof values[key] === "object") {
|
|
34080
34211
|
changedValue[key] = _objectSpread2(_objectSpread2({}, values[key]), _changedValue[key]);
|
|
34081
34212
|
allValues[key] = _objectSpread2(_objectSpread2({}, values[key]), _allValues[key]);
|
|
34082
34213
|
}
|
|
34083
34214
|
});
|
|
34084
34215
|
const cleanedChangeValue = convertUndefinedToNull(changedValue);
|
|
34085
34216
|
const cleanedAllValues = convertUndefinedToNull(_objectSpread2(_objectSpread2({}, values), allValues));
|
|
34086
|
-
if (
|
|
34217
|
+
if ("associatedMine" in cleanedChangeValue && cleanedChangeValue.associatedMine === null && values.associatedMine != null) {
|
|
34087
34218
|
cleanedChangeValue.associatedMine = values.associatedMine;
|
|
34088
34219
|
cleanedAllValues.associatedMine = values.associatedMine;
|
|
34089
34220
|
}
|
|
@@ -34099,7 +34230,7 @@ const EditForm = _ref => {
|
|
|
34099
34230
|
// ...allValues
|
|
34100
34231
|
// });
|
|
34101
34232
|
},
|
|
34102
|
-
children: [definition, introText && introText !==
|
|
34233
|
+
children: [definition, introText && introText !== "" ? /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
34103
34234
|
className: "repeatable",
|
|
34104
34235
|
children: introText
|
|
34105
34236
|
}) : null, options.alertConf && typeof options.alertConf === "object" ? /*#__PURE__*/jsxRuntime.jsx(antd.Alert, {
|
|
@@ -34111,10 +34242,10 @@ const EditForm = _ref => {
|
|
|
34111
34242
|
const input = options[k];
|
|
34112
34243
|
|
|
34113
34244
|
// Apply styling based on individual input type
|
|
34114
|
-
const inputStyles = input.type ===
|
|
34115
|
-
|
|
34245
|
+
const inputStyles = input.type === "groupInputs" || input.type === "phoneNumber" ? {} : {
|
|
34246
|
+
"--static-width": input.type === "group" && (_data$k = data[k]) !== null && _data$k !== void 0 && _data$k.noPlanningRequired ? "586px" : staticWidth
|
|
34116
34247
|
};
|
|
34117
|
-
if (input.type ===
|
|
34248
|
+
if (input.type === "ajaxSubGroup") {
|
|
34118
34249
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
34119
34250
|
style: inputStyles,
|
|
34120
34251
|
children: /*#__PURE__*/jsxRuntime.jsx(AjaxSubGroup, {
|
|
@@ -34141,9 +34272,9 @@ const EditForm = _ref => {
|
|
|
34141
34272
|
user: user
|
|
34142
34273
|
})
|
|
34143
34274
|
}, i);
|
|
34144
|
-
} else if (input.inputs && input.type !==
|
|
34275
|
+
} else if (input.inputs && input.type !== "groupInputs" && input.type !== "groupCheckbox" && input.type !== "dataLinkGroup") {
|
|
34145
34276
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
34146
|
-
className: formatClassname([
|
|
34277
|
+
className: formatClassname(["group", !input.repeatable && "sub-group"]),
|
|
34147
34278
|
style: inputStyles,
|
|
34148
34279
|
children: renderNestedInputs$1(options, k, setValues, values, excludedKeys, i, formTitles, getData, MainForm, plainForms, setAddress, onValuesChange, data, _objectSpread2(_objectSpread2({}, allData), {}, {
|
|
34149
34280
|
subGroupTitle
|
|
@@ -34168,7 +34299,7 @@ const EditForm = _ref => {
|
|
|
34168
34299
|
highlightMandatory: highlightMandatory,
|
|
34169
34300
|
changeInputMeta: changeInputMeta,
|
|
34170
34301
|
changeLinking: changeLinking,
|
|
34171
|
-
inputMeta: inputsMeta[k],
|
|
34302
|
+
inputMeta: inputsMeta[k] || {},
|
|
34172
34303
|
values: values,
|
|
34173
34304
|
MainForm: MainForm,
|
|
34174
34305
|
options: options,
|
|
@@ -34225,12 +34356,12 @@ const EditForm = _ref => {
|
|
|
34225
34356
|
});
|
|
34226
34357
|
}
|
|
34227
34358
|
},
|
|
34228
|
-
children: t(
|
|
34359
|
+
children: t("Save")
|
|
34229
34360
|
}), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
34230
34361
|
loading: isSubmitting,
|
|
34231
34362
|
disabled: isSubmitting,
|
|
34232
34363
|
onClick: () => onCancel(),
|
|
34233
|
-
children: t(
|
|
34364
|
+
children: t("Cancel")
|
|
34234
34365
|
})]
|
|
34235
34366
|
})]
|
|
34236
34367
|
});
|
|
@@ -61662,6 +61793,7 @@ exports.SelectFiltersTimeFrame = Timeframe;
|
|
|
61662
61793
|
exports.SettingsPopover = SettingsPopover;
|
|
61663
61794
|
exports.Sidenav = Sidenav;
|
|
61664
61795
|
exports.SidenavMenu = SidenavMenu;
|
|
61796
|
+
exports.SimpleGlobe = SimpleGlobe;
|
|
61665
61797
|
exports.StackChart = StackChart;
|
|
61666
61798
|
exports.StakeholderMappings = index$1;
|
|
61667
61799
|
exports.Steps = DAFSteps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datastake-daf",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.266",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@ant-design/icons": "^5.2.5",
|
|
6
6
|
"@antv/g2": "^5.1.1",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"buffer": "^6.0.3",
|
|
16
16
|
"countries-list": "^2.6.1",
|
|
17
17
|
"country-city-location": "^1.0.13",
|
|
18
|
-
"datastake-daf": "0.6.
|
|
18
|
+
"datastake-daf": "^0.6.263",
|
|
19
19
|
"dayjs": "^1.11.12",
|
|
20
20
|
"deepmerge": "^4.3.1",
|
|
21
21
|
"dot-object": "^2.1.5",
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# SimpleGlobe Component
|
|
2
|
+
|
|
3
|
+
A simplified wrapper for the Globe component that makes it easy to display project data as pins on a 3D globe.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- πΊοΈ **3D Globe Visualization**: Interactive 3D globe using Mapbox GL JS
|
|
8
|
+
- π **Pin-based Display**: Projects are displayed as clickable pins on the globe
|
|
9
|
+
- π― **Simple Integration**: Just pass your project data and it works
|
|
10
|
+
- π **Rich Tooltips**: Hover over pins to see project details
|
|
11
|
+
- π¨ **Customizable**: Support for custom map configurations
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
import SimpleGlobe from './SimpleGlobe';
|
|
17
|
+
|
|
18
|
+
const MyComponent = () => {
|
|
19
|
+
const projects = [
|
|
20
|
+
{
|
|
21
|
+
name: "Solar Project",
|
|
22
|
+
latitude: 14.7167,
|
|
23
|
+
longitude: -17.4677,
|
|
24
|
+
percentageCompletion: 75,
|
|
25
|
+
projectDescription: "Large-scale solar energy project"
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div style={{ width: '100%', height: '600px' }}>
|
|
31
|
+
<SimpleGlobe
|
|
32
|
+
projects={projects}
|
|
33
|
+
onProjectClick={(project) => console.log('Clicked:', project)}
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Props
|
|
41
|
+
|
|
42
|
+
| Prop | Type | Default | Description |
|
|
43
|
+
|------|------|---------|-------------|
|
|
44
|
+
| `projects` | `Array` | `[]` | Array of project objects |
|
|
45
|
+
| `mapConfig` | `Object` | `{}` | Map configuration options |
|
|
46
|
+
| `showSider` | `boolean` | `false` | Whether to show the sidebar |
|
|
47
|
+
| `onProjectClick` | `Function` | `() => {}` | Callback when a project pin is clicked |
|
|
48
|
+
|
|
49
|
+
## Project Data Format
|
|
50
|
+
|
|
51
|
+
Your project objects should have the following structure:
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
{
|
|
55
|
+
_id: "unique-id", // Optional: Unique identifier
|
|
56
|
+
name: "Project Name", // Required: Project name
|
|
57
|
+
latitude: 14.7167, // Required: Latitude coordinate
|
|
58
|
+
longitude: -17.4677, // Required: Longitude coordinate
|
|
59
|
+
projectDescription: "Description", // Optional: Project description
|
|
60
|
+
country: "SN", // Optional: Country code
|
|
61
|
+
sectoralScope: "energy", // Optional: Project sector
|
|
62
|
+
percentageCompletion: 75, // Optional: Completion percentage
|
|
63
|
+
author: { name: "Author Name" } // Optional: Author information
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Examples
|
|
68
|
+
|
|
69
|
+
### Basic Usage
|
|
70
|
+
```jsx
|
|
71
|
+
<SimpleGlobe projects={myProjects} />
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### With Sidebar
|
|
75
|
+
```jsx
|
|
76
|
+
<SimpleGlobe
|
|
77
|
+
projects={myProjects}
|
|
78
|
+
showSider={true}
|
|
79
|
+
/>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### With Custom Configuration
|
|
83
|
+
```jsx
|
|
84
|
+
<SimpleGlobe
|
|
85
|
+
projects={myProjects}
|
|
86
|
+
mapConfig={{
|
|
87
|
+
maxZoom: 8,
|
|
88
|
+
minZoom: 2
|
|
89
|
+
}}
|
|
90
|
+
onProjectClick={(project) => {
|
|
91
|
+
// Handle project click
|
|
92
|
+
console.log('Project clicked:', project);
|
|
93
|
+
}}
|
|
94
|
+
/>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Storybook
|
|
98
|
+
|
|
99
|
+
You can see all examples in Storybook under "Dashboard/Globe/SimpleGlobe".
|
|
100
|
+
|
|
101
|
+
## Notes
|
|
102
|
+
|
|
103
|
+
- The component automatically transforms your project data to the format expected by the underlying Globe component
|
|
104
|
+
- Pins are displayed as circular markers with project completion percentage
|
|
105
|
+
- Tooltips show project details when hovering over pins
|
|
106
|
+
- The globe is fully interactive - you can zoom, pan, and rotate
|