datastake-daf 0.6.278 → 0.6.280

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.
Files changed (25) hide show
  1. package/.env +8 -0
  2. package/.vscode/settings.json +13 -0
  3. package/dist/components/index.js +471 -810
  4. package/dist/utils/index.js +431 -420
  5. package/package.json +1 -1
  6. package/src/@daf/core/components/Dashboard/Globe/Globe.stories.js +5 -30
  7. package/src/@daf/core/components/Dashboard/Globe/hook.js +7 -63
  8. package/src/@daf/core/components/Dashboard/Globe/index.jsx +6 -24
  9. package/src/@daf/core/components/Dashboard/Globe/style.js +0 -29
  10. package/src/@daf/core/components/EditForm/EditForm.stories.js +1 -0
  11. package/src/@daf/core/components/EditForm/form.jsx +3 -0
  12. package/src/@daf/core/components/EditForm/helper.js +66 -39
  13. package/src/@daf/core/components/EditForm/storyConfig.js +1 -1
  14. package/src/@daf/core/components/EditForm/storyConfig3.js +40 -21563
  15. package/src/@daf/core/components/Icon/configs/MagicWant.js +13 -0
  16. package/src/@daf/core/components/Icon/configs/index.js +3 -0
  17. package/src/index.js +0 -1
  18. package/src/@daf/core/components/Dashboard/Globe/README.md +0 -106
  19. package/src/@daf/core/components/Dashboard/Globe/SimpleGlobe.jsx +0 -331
  20. package/src/@daf/core/components/Dashboard/Globe/SimpleGlobe.stories.js +0 -284
  21. package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeDebug.jsx +0 -85
  22. package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeExample.jsx +0 -75
  23. package/src/@daf/core/components/Dashboard/Globe/SimpleGlobeTest.jsx +0 -48
  24. package/src/@daf/core/components/Dashboard/Globe/storyConfig.js +0 -243
  25. package/src/@daf/core/components/Dashboard/Globe/storyConfig1.js +0 -354
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.278",
3
+ "version": "0.6.280",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -2,7 +2,7 @@ import Globe from "./index";
2
2
  import ThemeLayout from "../../ThemeLayout";
3
3
  import Widget from "../Widget";
4
4
 
5
- import * as configs from "./storyConfig";
5
+ import * as configs from "../Map/storyConfig";
6
6
 
7
7
  export default {
8
8
  title: "Dashboard/Globe",
@@ -29,14 +29,14 @@ export default {
29
29
  export const DefaultGlobe = {
30
30
  name: "Default Globe",
31
31
  args: {
32
- ...configs.DefaultGlobeConfig,
32
+ ...configs.DefaultMapConfig,
33
33
  },
34
34
  };
35
35
 
36
36
  export const SatelliteGlobe = {
37
37
  name: "Satellite Globe",
38
38
  args: {
39
- ...configs.DefaultGlobeConfig,
39
+ ...configs.DefaultMapConfig,
40
40
  isSatellite: true,
41
41
  },
42
42
  };
@@ -44,19 +44,11 @@ export const SatelliteGlobe = {
44
44
  export const TerritoryGlobe = {
45
45
  name: "Territory Globe",
46
46
  args: {
47
- ...configs.TerritoryGlobeConfig,
47
+ ...configs.TerritoryMapConfig,
48
48
  type: "territory",
49
49
  },
50
50
  };
51
51
 
52
- export const StakeholderGlobe = {
53
- name: "Stakeholder Globe",
54
- args: {
55
- ...configs.StakeholderGlobeConfig,
56
- type: "stakeholder",
57
- },
58
- };
59
-
60
52
  export const EventGlobe = {
61
53
  name: "Event Globe",
62
54
  args: {
@@ -65,27 +57,10 @@ export const EventGlobe = {
65
57
  },
66
58
  };
67
59
 
68
- export const ChainGlobe = {
69
- name: "Supply Chain Globe",
70
- args: {
71
- ...configs.ChainGlobeConfig,
72
- type: "chain",
73
- },
74
- };
75
-
76
60
  export const LocationGlobe = {
77
61
  name: "Location Globe",
78
62
  args: {
79
- ...configs.DefaultGlobeConfig,
63
+ ...configs.DefaultMapConfig,
80
64
  type: "location",
81
65
  },
82
66
  };
83
-
84
- export const ProjectGlobe = {
85
- name: "Project Globe",
86
- args: {
87
- ...configs.ProjectGlobeConfig,
88
- type: "project",
89
- },
90
- };
91
-
@@ -48,30 +48,15 @@ export const useGlobe = ({
48
48
  const isMounted = useRef(true);
49
49
 
50
50
  const addAllDataToMap = useCallback(() => {
51
- console.log('🚀 [GLOBE HOOK] addAllDataToMap called');
52
- console.log('🚀 [GLOBE HOOK] data:', data);
53
- console.log('🚀 [GLOBE HOOK] mapRef exists:', !!mapRef);
54
- console.log('🚀 [GLOBE HOOK] style loaded:', mapRef?.isStyleLoaded());
55
-
56
- if (!data || !mapRef) {
57
- console.log('❌ [GLOBE HOOK] addAllDataToMap early return - missing data or mapRef');
58
- return;
59
- }
60
-
61
- if (!mapRef.isStyleLoaded()) {
62
- console.log('⏳ [GLOBE HOOK] Style not loaded yet, retrying in 100ms...');
63
- setTimeout(() => {
64
- addAllDataToMap();
65
- }, 100);
51
+
52
+ if (!data || !mapRef || !mapRef.isStyleLoaded()) {
66
53
  return;
67
54
  }
68
55
 
56
+ // Prevent multiple calls with empty data
69
57
  if (data.length === 0) {
70
- console.log('❌ [GLOBE HOOK] addAllDataToMap early return - no data');
71
58
  return;
72
59
  }
73
-
74
- console.log('✅ [GLOBE HOOK] Starting to add markers to map...');
75
60
 
76
61
  // Clear existing markers using functional update to avoid dependency issues
77
62
  setMapMarkers(currentMarkers => {
@@ -123,14 +108,8 @@ export const useGlobe = ({
123
108
  const newMarkers = [];
124
109
  const maxTotal = Math.max(...(data || []).map((d) => d.total || 0));
125
110
 
126
- console.log('🎯 [GLOBE HOOK] Processing data items:', data.length);
127
111
  data.forEach((d, i) => {
128
- console.log(`🎯 [GLOBE HOOK] Processing item ${i}:`, d);
129
- console.log(`🎯 [GLOBE HOOK] Item ${i} marker:`, d?.marker);
130
- console.log(`🎯 [GLOBE HOOK] Item ${i} lat/lng:`, d?.marker?.lat, d?.marker?.lng);
131
-
132
112
  if (d?.marker?.lat && d?.marker?.lng) {
133
- console.log(`✅ [GLOBE HOOK] Item ${i} has valid coordinates, creating marker...`);
134
113
  let marker;
135
114
  let iconClassName = "";
136
115
  let innerHtml = "";
@@ -233,8 +212,6 @@ export const useGlobe = ({
233
212
  .setLngLat([d.marker.lng, d.marker.lat])
234
213
  .setPopup(new mapboxgl.Popup().setDOMContent(div))
235
214
  .addTo(mapRef);
236
-
237
- console.log(`🎉 [GLOBE HOOK] Marker ${i} added to map at:`, [d.marker.lng, d.marker.lat]);
238
215
 
239
216
  } else if (type === "territory") {
240
217
  // Handle territory polygons
@@ -320,8 +297,6 @@ export const useGlobe = ({
320
297
  .setLngLat([d.marker.lng, d.marker.lat])
321
298
  .setPopup(new mapboxgl.Popup().setDOMContent(div))
322
299
  .addTo(mapRef);
323
-
324
- console.log(`🎉 [GLOBE HOOK] Default marker ${i} added to map at:`, [d.marker.lng, d.marker.lat]);
325
300
  }
326
301
 
327
302
  // Add click handler
@@ -355,7 +330,6 @@ export const useGlobe = ({
355
330
  mapboxgl.accessToken = MAP_TOKEN;
356
331
 
357
332
  // Create the map with Mapbox GL JS - 3D globe
358
- console.log('🗺️ [GLOBE HOOK] Creating map with style:', STYLE_URL);
359
333
  const map = new mapboxgl.Map({
360
334
  container: container.current,
361
335
  style: STYLE_URL,
@@ -374,13 +348,9 @@ export const useGlobe = ({
374
348
 
375
349
  // Configure the map when style loads
376
350
  map.on('style.load', () => {
377
- console.log('🎨 [GLOBE HOOK] Style loaded event triggered');
378
- console.log('🎨 [GLOBE HOOK] Map style loaded:', map.isStyleLoaded());
379
351
 
380
352
  // Wait a bit for the style to fully load
381
353
  setTimeout(() => {
382
- console.log('🎨 [GLOBE HOOK] After timeout - Map style loaded:', map.isStyleLoaded());
383
-
384
354
  // Set fog for the space background effect with stars - simplified to avoid errors
385
355
  try {
386
356
  map.setFog({
@@ -475,10 +445,9 @@ export const useGlobe = ({
475
445
  // Add navigation controls
476
446
  map.addControl(new mapboxgl.NavigationControl(), 'top-right');
477
447
 
478
- console.log('🗺️ [GLOBE HOOK] Map created successfully');
479
448
  return map;
480
449
  } catch (error) {
481
- console.error('❌ [GLOBE HOOK] Error creating Mapbox GL JS globe:', error);
450
+ console.error('Error creating Mapbox GL JS globe:', error);
482
451
  return null;
483
452
  }
484
453
  }, []);
@@ -491,13 +460,10 @@ export const useGlobe = ({
491
460
  // }, [initialMarkerSetIsDone]);
492
461
 
493
462
  useEffect(() => {
494
- console.log('🔄 [GLOBE HOOK] useEffect for map creation - mapRef:', !!mapRef);
495
463
 
496
464
  if (!mapRef) {
497
- console.log('🔄 [GLOBE HOOK] Creating map instance...');
498
465
  const instance = createInstance();
499
466
  if (instance) {
500
- console.log('🔄 [GLOBE HOOK] Map instance created, setting mapRef');
501
467
  setMapRef(instance);
502
468
 
503
469
  // Add comprehensive resize detection for Mapbox GL JS responsiveness
@@ -586,24 +552,15 @@ export const useGlobe = ({
586
552
  }, [polygon, mapRef]);
587
553
 
588
554
  useEffect(() => {
589
- console.log('📥 [GLOBE HOOK] allData received:', allData);
590
- console.log('📥 [GLOBE HOOK] allData length:', allData?.length);
591
-
555
+
592
556
  if (allData) {
593
557
  if (allData.length === 0) {
594
- console.log('⚠️ [GLOBE HOOK] Empty data array');
595
558
  setEmptyStateIsVisible(true);
596
559
  } else if (emptyStateIsVisible) {
597
560
  setEmptyStateIsVisible(false);
598
561
  }
599
-
600
- console.log('🔍 [GLOBE HOOK] Filtering data with filterValidGPS...');
601
- const filteredData = filterValidGPS(allData);
602
- console.log('🔍 [GLOBE HOOK] filtered data result:', filteredData);
603
- console.log('🔍 [GLOBE HOOK] filtered data length:', filteredData.length);
604
- setData(filteredData);
562
+ setData(filterValidGPS(allData));
605
563
  } else {
606
- console.log('❌ [GLOBE HOOK] No allData provided');
607
564
  setData(null);
608
565
  }
609
566
  }, [allData, emptyStateIsVisible]);
@@ -634,20 +591,7 @@ export const useGlobe = ({
634
591
  }, [user, mapRef, allData]);
635
592
 
636
593
  useEffect(() => {
637
- console.log('🔄 [GLOBE HOOK] useEffect triggered:', {
638
- mapRef: !!mapRef,
639
- data: !!data,
640
- dataLength: data?.length,
641
- initialMarkerSetIsDone,
642
- styleLoaded: mapRef?.isStyleLoaded()
643
- });
644
-
645
- if (mapRef && data && !initialMarkerSetIsDone) {
646
- console.log('🚀 [GLOBE HOOK] Attempting to add markers...');
647
- console.log('🚀 [GLOBE HOOK] Style loaded check:', mapRef.isStyleLoaded());
648
-
649
- // Try to add markers immediately, and if style isn't loaded,
650
- // the addAllDataToMap function will handle it
594
+ if (mapRef && data && !initialMarkerSetIsDone && mapRef.isStyleLoaded()) {
651
595
  setInitialMarkerSetIsDone(true);
652
596
  addAllDataToMap();
653
597
  }
@@ -111,7 +111,7 @@ function Globe({
111
111
  renderSider = null,
112
112
  renderMarker = null,
113
113
  type = "default",
114
- showSider = false,
114
+ showSider = true,
115
115
  filtersConfig,
116
116
  onFilterChange = () => { },
117
117
  isSatellite = false,
@@ -122,29 +122,11 @@ function Globe({
122
122
  }) {
123
123
  // Map data to include marker coordinates
124
124
  const mappedData = useMemo(
125
- () => {
126
- console.log('📊 [GLOBE COMPONENT] Original data received:', data);
127
- console.log('📊 [GLOBE COMPONENT] Data length:', data?.length);
128
-
129
- if (!data || data.length === 0) {
130
- console.log('❌ [GLOBE COMPONENT] No data to map');
131
- return [];
132
- }
133
-
134
- const mapped = data.map((d, i) => {
135
- console.log(`📊 [GLOBE COMPONENT] Mapping item ${i}:`, d);
136
- console.log(`📊 [GLOBE COMPONENT] Item ${i} GPS:`, d?.gps);
137
- const result = {
138
- ...d,
139
- marker: { lat: d?.gps?.latitude, lng: d?.gps?.longitude },
140
- };
141
- console.log(`📊 [GLOBE COMPONENT] Item ${i} mapped result:`, result);
142
- return result;
143
- });
144
-
145
- console.log('📊 [GLOBE COMPONENT] Final mapped data:', mapped);
146
- return mapped;
147
- },
125
+ () =>
126
+ data.map((d) => ({
127
+ ...d,
128
+ marker: { lat: d?.gps?.latitude, lng: d?.gps?.longitude },
129
+ })),
148
130
  [data],
149
131
  );
150
132
 
@@ -6,34 +6,6 @@ const Style = styled.div`
6
6
  position: relative;
7
7
  width: 100%;
8
8
  height: 472px;
9
-
10
- /* CRITICAL: Protect against Leaflet CSS interference */
11
- .daf-simple-globe-container {
12
- position: relative;
13
- width: 100%;
14
- height: 100%;
15
-
16
- /* Override Leaflet CSS that interferes with Mapbox */
17
- .mapboxgl-canvas-container {
18
- position: relative !important;
19
- left: auto !important;
20
- top: auto !important;
21
- }
22
-
23
- .mapboxgl-canvas-container canvas {
24
- position: relative !important;
25
- left: auto !important;
26
- top: auto !important;
27
- transform: none !important;
28
- }
29
-
30
- /* Protect markers from Leaflet positioning */
31
- .daf-globe-marker {
32
- position: relative !important;
33
- left: auto !important;
34
- top: auto !important;
35
- }
36
- }
37
9
 
38
10
  .filter-cont {
39
11
  position: absolute;
@@ -87,7 +59,6 @@ const Style = styled.div`
87
59
  height: 100%;
88
60
  }
89
61
 
90
- /* Narrow marker styling used by legacy components; avoid width/height overrides for SimpleGlobe */
91
62
  .map-marker {
92
63
  text-align: center;
93
64
  width 100%;
@@ -94,6 +94,7 @@ const EForm = () => {
94
94
  getAppHeader={storyData.getAppHeader}
95
95
  getApiBaseUrl={storyData.getApiBaseUrl}
96
96
  fullWidth={true}
97
+ namespace="project-readiness"
97
98
  evaluationConfig={
98
99
  [
99
100
  // {
@@ -13,6 +13,7 @@ import { convertToDayJs } from "../../../utils/date";
13
13
  import { convertUndefinedToNull } from "../../../utils/object";
14
14
 
15
15
  export const EditForm = ({
16
+ namespace,
16
17
  isReview,
17
18
  highlightMandatory,
18
19
  onValuesChange = () => {},
@@ -333,6 +334,7 @@ export const EditForm = ({
333
334
  }
334
335
  }, [data]);
335
336
 
337
+ console.log("namespace", namespace);
336
338
  const renderForm = () => {
337
339
  switch (template) {
338
340
  default:
@@ -544,6 +546,7 @@ export const EditForm = ({
544
546
  onValuesChange={onValuesChange}
545
547
  i={i}
546
548
  setLoading={setLoading}
549
+ namespace={namespace}
547
550
  />
548
551
  </div>
549
552
  ) : null;
@@ -2646,6 +2646,7 @@ export const GetFormItem = ({
2646
2646
  inputMeta = {},
2647
2647
  changeInputMeta = () => {},
2648
2648
  changeLinking = () => {},
2649
+ namespace,
2649
2650
  }) => {
2650
2651
  const {
2651
2652
  t,
@@ -2849,6 +2850,11 @@ export const GetFormItem = ({
2849
2850
 
2850
2851
  if (input && typeof input === "object") {
2851
2852
  // check if input is valid
2853
+ const hideComment = namespace === "project-readiness";
2854
+ console.log("hideComment", {
2855
+ hideComment,
2856
+ namespace,
2857
+ });
2852
2858
  return (
2853
2859
  <>
2854
2860
  <div className="flex-row input-cont">
@@ -3012,46 +3018,67 @@ export const GetFormItem = ({
3012
3018
  </div>
3013
3019
  </Tooltip>
3014
3020
 
3015
- <Tooltip title={t("Add comment")}>
3016
- <div>
3017
- <Button
3018
- type="link"
3019
- disabled={!input.meta?.comment}
3020
- {...(!isShown
3021
- ? {
3022
- className:
3023
- "default p-0",
3024
- }
3025
- : {
3026
- className:
3027
- "p-0 primary",
3028
- })}
3029
- onClick={() => {
3030
- if (
3031
- inputMeta.comment !==
3032
- undefined &&
3033
- inputMeta.comment !==
3034
- null
3035
- ) {
3036
- return;
3021
+ {!hideComment ? (
3022
+ <Tooltip title={t("Add comment")}>
3023
+ <div>
3024
+ <Button
3025
+ type="link"
3026
+ disabled={
3027
+ !input.meta?.comment
3037
3028
  }
3038
-
3039
- setIsShown(true);
3040
- changeInputMeta({
3041
- key: inputKey,
3042
- type: input.type,
3043
- value: { comment: "" },
3044
- });
3045
- }}
3046
- >
3047
- <CustomIcon
3048
- name="AddComment"
3049
- width={16}
3050
- height={16}
3051
- />
3052
- </Button>
3053
- </div>
3054
- </Tooltip>
3029
+ {...(!isShown
3030
+ ? {
3031
+ className:
3032
+ "default p-0",
3033
+ }
3034
+ : {
3035
+ className:
3036
+ "p-0 primary",
3037
+ })}
3038
+ onClick={() => {
3039
+ if (
3040
+ inputMeta.comment !==
3041
+ undefined &&
3042
+ inputMeta.comment !==
3043
+ null
3044
+ ) {
3045
+ return;
3046
+ }
3047
+
3048
+ setIsShown(true);
3049
+ changeInputMeta({
3050
+ key: inputKey,
3051
+ type: input.type,
3052
+ value: {
3053
+ comment: "",
3054
+ },
3055
+ });
3056
+ }}
3057
+ >
3058
+ <CustomIcon
3059
+ name="AddComment"
3060
+ width={16}
3061
+ height={16}
3062
+ />
3063
+ </Button>
3064
+ </div>
3065
+ </Tooltip>
3066
+ ) : (
3067
+ <Tooltip title={t("Project Readiness")}>
3068
+ <div>
3069
+ <Button
3070
+ type="link"
3071
+ className="default p-0"
3072
+ >
3073
+ <CustomIcon
3074
+ name="MagicWand"
3075
+ width={16}
3076
+ height={16}
3077
+ />
3078
+ </Button>
3079
+ </div>
3080
+ </Tooltip>
3081
+ )}
3055
3082
  </>
3056
3083
  ) : null}
3057
3084
  </div>
@@ -1,3 +1,3 @@
1
- import { getApiBaseUrl, getAppHeader, storyData } from "./storyConfig2";
1
+ import { getApiBaseUrl, getAppHeader, storyData } from "./storyConfig3";
2
2
 
3
3
  export { getApiBaseUrl, getAppHeader, storyData };