datastake-daf 0.6.757 → 0.6.759
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 +3299 -2881
- package/dist/layouts/index.js +476 -452
- package/dist/pages/index.js +836 -662
- package/dist/style/datastake/mapbox-gl.css +330 -0
- package/dist/utils/index.js +481 -802
- package/package.json +1 -1
- package/rollup.config.js +0 -20
- package/src/@daf/core/components/Dashboard/Map/Map.stories.js +8 -0
- package/src/@daf/core/components/Dashboard/Map/helper.js +134 -3
- package/src/@daf/core/components/Dashboard/Map/hook.js +4 -0
- package/src/@daf/core/components/Dashboard/Map/index.jsx +19 -0
- package/src/@daf/core/components/Dashboard/Map/storyConfig.js +2 -1
- package/src/@daf/core/components/Dashboard/Map/storyConfig6.js +69 -0
- package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/config.js +2 -5
- package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/index.jsx +1 -1
- package/src/@daf/core/components/EditForm/form.jsx +1 -1
- package/src/@daf/core/components/EditForm/storyConfig2.js +25028 -865
- package/src/@daf/core/components/Graphs/components/BaseGraph.jsx +1 -1
- package/src/@daf/core/components/Icon/configs/SpacingHeight.js +8 -0
- package/src/@daf/core/components/Icon/configs/SpacingWidth.js +8 -0
- package/src/@daf/core/components/Icon/configs/index.js +5 -1
- package/src/@daf/hooks/useMapHelper.js +15 -1
- package/src/@daf/pages/Dashboards/SupplyChain/index.jsx +2 -2
- package/src/@daf/pages/Documents/index.jsx +3 -2
- package/src/@daf/pages/Events/Activities/index.jsx +3 -2
- package/src/@daf/pages/Events/Incidents/index.jsx +3 -2
- package/src/@daf/pages/Events/index.jsx +3 -2
- package/src/@daf/pages/Locations/MineSite/columns.js +5 -7
- package/src/@daf/pages/Locations/MineSite/index.jsx +4 -5
- package/src/@daf/pages/Locations/index.jsx +3 -2
- package/src/@daf/pages/Stakeholders/Operators/index.jsx +2 -2
- package/src/@daf/pages/Stakeholders/Workers/index.jsx +3 -2
- package/src/@daf/pages/Stakeholders/index.jsx +3 -2
- package/src/@daf/pages/Summary/Activities/Restoration/helper.js +133 -79
- package/src/@daf/pages/Summary/Activities/Restoration/index.jsx +57 -60
- package/src/@daf/pages/Summary/Minesite/index.jsx +0 -2
- package/src/@daf/pages/Summary/Operator/index.jsx +1 -3
- package/src/@daf/utils/tooltip.js +5 -2
- package/src/utils.js +1 -3
- package/dist/constants/index.js +0 -26
- package/src/constants/breadCrumbs.js +0 -20
- package/src/constants.js +0 -1
- package/src/helpers/breadCrumbs.js +0 -347
package/package.json
CHANGED
package/rollup.config.js
CHANGED
|
@@ -103,26 +103,6 @@ export default [
|
|
|
103
103
|
requireReturnsDefault: "auto",
|
|
104
104
|
}),
|
|
105
105
|
],
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
input: "src/constants.js",
|
|
109
|
-
output: [
|
|
110
|
-
{
|
|
111
|
-
file: "dist/constants/index.js",
|
|
112
|
-
format: "cjs",
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
external,
|
|
116
|
-
plugins: [
|
|
117
|
-
nodePolyfills(),
|
|
118
|
-
resolve({ browser: true }),
|
|
119
|
-
babel({ exclude: "node_modules/**", babelrc: true }),
|
|
120
|
-
peerDep(),
|
|
121
|
-
commonjs({
|
|
122
|
-
include: /node_modules/,
|
|
123
|
-
requireReturnsDefault: "auto",
|
|
124
|
-
}),
|
|
125
|
-
],
|
|
126
106
|
},
|
|
127
107
|
{
|
|
128
108
|
input: "src/services.js",
|
|
@@ -20,6 +20,8 @@ export function useMapHelper({
|
|
|
20
20
|
mapCenter,
|
|
21
21
|
allData,
|
|
22
22
|
renderTooltip,
|
|
23
|
+
renderTooltipForLocation = null,
|
|
24
|
+
renderTooltipForTerritory = null,
|
|
23
25
|
renderTooltipTags,
|
|
24
26
|
onClickLink,
|
|
25
27
|
link,
|
|
@@ -212,10 +214,139 @@ export function useMapHelper({
|
|
|
212
214
|
this.setStyle({ fillOpacity: 0.7 });
|
|
213
215
|
});
|
|
214
216
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
+
marker.on("popupclose", function () {
|
|
218
|
+
this.setStyle({ fillOpacity: 0.4 });
|
|
219
|
+
});
|
|
220
|
+
} else if (type === "location-territory" || type === "territory-location") {
|
|
221
|
+
const territoryTooltip = renderTooltipForTerritory || renderTooltip;
|
|
222
|
+
const locationTooltip = renderTooltipForLocation || renderTooltip;
|
|
223
|
+
|
|
224
|
+
let polygonMarker = null;
|
|
225
|
+
if (data.area && Array.isArray(data.area) && data.area.length >= 3) {
|
|
226
|
+
// Validate area coordinates are valid arrays with numeric values
|
|
227
|
+
const validArea = data.area.filter(coord => {
|
|
228
|
+
if (!Array.isArray(coord) || coord.length < 2) {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
const lat = typeof coord[0] === 'number' ? coord[0] : parseFloat(coord[0]);
|
|
232
|
+
const lng = typeof coord[1] === 'number' ? coord[1] : parseFloat(coord[1]);
|
|
233
|
+
return !isNaN(lat) && !isNaN(lng) && isFinite(lat) && isFinite(lng);
|
|
217
234
|
});
|
|
218
|
-
|
|
235
|
+
|
|
236
|
+
if (validArea && validArea.length >= 3) {
|
|
237
|
+
polygonMarker = L.polygon(validArea, {
|
|
238
|
+
color: data.color,
|
|
239
|
+
opacity: 0.4,
|
|
240
|
+
}).addTo(mapRef);
|
|
241
|
+
|
|
242
|
+
const territoryDiv = document.createElement("div");
|
|
243
|
+
const territoryRoot = createRoot(territoryDiv);
|
|
244
|
+
|
|
245
|
+
const territoryTitle = data.territoryTitle || data.name;
|
|
246
|
+
|
|
247
|
+
territoryRoot.render(
|
|
248
|
+
<>
|
|
249
|
+
{renderTooltipHtml({
|
|
250
|
+
title: territoryTitle,
|
|
251
|
+
subTitle: data?.subTitle || data.type,
|
|
252
|
+
items: territoryTooltip(data),
|
|
253
|
+
tags: renderTooltipTags(data),
|
|
254
|
+
link,
|
|
255
|
+
total: data.sources,
|
|
256
|
+
onClickLink: () => onClickLink(data),
|
|
257
|
+
})}
|
|
258
|
+
</>,
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
roots.current.push(territoryRoot);
|
|
262
|
+
|
|
263
|
+
// Bind popup to polygon
|
|
264
|
+
polygonMarker.bindPopup(territoryDiv);
|
|
265
|
+
|
|
266
|
+
// Polygon hover effects
|
|
267
|
+
polygonMarker.on("popupopen", function () {
|
|
268
|
+
this.setStyle({ fillOpacity: 0.7 });
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
polygonMarker.on("popupclose", function () {
|
|
272
|
+
this.setStyle({ fillOpacity: 0.4 });
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
let locationMarker = null;
|
|
278
|
+
if (coordinates && coordinates[0] && coordinates[1]) {
|
|
279
|
+
let markerLat = typeof coordinates[0] === 'number' ? coordinates[0] : parseFloat(coordinates[0]);
|
|
280
|
+
let markerLng = typeof coordinates[1] === 'number' ? coordinates[1] : parseFloat(coordinates[1]);
|
|
281
|
+
|
|
282
|
+
if ((markerLat < -90 || markerLat > 90) && (markerLng >= -90 && markerLng <= 90)) {
|
|
283
|
+
const temp = markerLat;
|
|
284
|
+
markerLat = markerLng;
|
|
285
|
+
markerLng = temp;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (!isNaN(markerLat) && !isNaN(markerLng) && isFinite(markerLat) && isFinite(markerLng) &&
|
|
289
|
+
markerLat >= -90 && markerLat <= 90 && markerLng >= -180 && markerLng <= 180) {
|
|
290
|
+
const markerCoordinates = [markerLat, markerLng];
|
|
291
|
+
|
|
292
|
+
iconClassName = "";
|
|
293
|
+
const markerFillColor = data.markerColor || "var(--color-primary-60)";
|
|
294
|
+
innerHtml = `
|
|
295
|
+
|
|
296
|
+
<svg
|
|
297
|
+
width="28"
|
|
298
|
+
height="33"
|
|
299
|
+
viewBox="0 0 28 33"
|
|
300
|
+
fill="none"
|
|
301
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
302
|
+
>
|
|
303
|
+
<path
|
|
304
|
+
d="M5.14346 4.87419C10.0688 -0.15896 18.0528 -0.162058 22.9757 4.86861C27.6563 9.65161 27.8841 17.2616 23.6622 22.3255H23.6608C23.427 22.6141 23.1808 22.894 22.9211 23.1623L14.0671 32.2101L5.44057 23.3948L5.13868 23.096C0.215857 18.0655 0.218422 9.90737 5.14346 4.87419Z"
|
|
305
|
+
fill="${markerFillColor}"
|
|
306
|
+
stroke="white"
|
|
307
|
+
/>
|
|
308
|
+
</svg>
|
|
309
|
+
|
|
310
|
+
`;
|
|
311
|
+
|
|
312
|
+
const locationDiv = document.createElement("div");
|
|
313
|
+
const locationRoot = createRoot(locationDiv);
|
|
314
|
+
|
|
315
|
+
locationRoot.render(
|
|
316
|
+
<>
|
|
317
|
+
{renderTooltipHtml({
|
|
318
|
+
title: data.name,
|
|
319
|
+
subTitle: data?.subTitle || data.type,
|
|
320
|
+
items: locationTooltip(data),
|
|
321
|
+
tags: renderTooltipTags(data),
|
|
322
|
+
link: false,
|
|
323
|
+
total: data.sources,
|
|
324
|
+
onClickLink: () => onClickLink(data),
|
|
325
|
+
})}
|
|
326
|
+
</>,
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
roots.current.push(locationRoot);
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
locationMarker = addIconToMap(
|
|
333
|
+
markerCoordinates,
|
|
334
|
+
iconClassName,
|
|
335
|
+
data,
|
|
336
|
+
tooltipAsText ? data.name : locationDiv,
|
|
337
|
+
iconSize,
|
|
338
|
+
innerHtml,
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
if (locationMarker) {
|
|
342
|
+
locationMarker.setZIndexOffset(1000);
|
|
343
|
+
locationMarker.bindPopup(locationDiv);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
marker = polygonMarker || locationMarker;
|
|
349
|
+
} else if (type === "stakeholder") {
|
|
219
350
|
marker = L.marker(coordinates, {
|
|
220
351
|
icon: L.divIcon({
|
|
221
352
|
html: `<div id="${i}"></div>`,
|
|
@@ -18,6 +18,8 @@ export const useMap = ({
|
|
|
18
18
|
polygon,
|
|
19
19
|
app,
|
|
20
20
|
renderTooltip,
|
|
21
|
+
renderTooltipForLocation = null,
|
|
22
|
+
renderTooltipForTerritory = null,
|
|
21
23
|
renderTooltipTags,
|
|
22
24
|
mapConfig,
|
|
23
25
|
tooltipAsText,
|
|
@@ -137,6 +139,8 @@ export const useMap = ({
|
|
|
137
139
|
allData,
|
|
138
140
|
mapCenter,
|
|
139
141
|
renderTooltip,
|
|
142
|
+
renderTooltipForLocation,
|
|
143
|
+
renderTooltipForTerritory,
|
|
140
144
|
renderTooltipTags,
|
|
141
145
|
onClickLink,
|
|
142
146
|
link,
|
|
@@ -48,6 +48,16 @@ import Filters from "../../Filters/FloatingFilters/index.js";
|
|
|
48
48
|
* Custom renderer for tooltip content.
|
|
49
49
|
* Signature: `(dataItem) => ReactNode | string`
|
|
50
50
|
*
|
|
51
|
+
* - `renderTooltipForLocation` (function, optional):
|
|
52
|
+
* Custom renderer for location marker tooltips (used in location-territory type).
|
|
53
|
+
* Signature: `(dataItem) => Array`
|
|
54
|
+
* Falls back to `renderTooltip` if not provided.
|
|
55
|
+
*
|
|
56
|
+
* - `renderTooltipForTerritory` (function, optional):
|
|
57
|
+
* Custom renderer for territory polygon tooltips (used in location-territory type).
|
|
58
|
+
* Signature: `(dataItem) => Array`
|
|
59
|
+
* Falls back to `renderTooltip` if not provided.
|
|
60
|
+
*
|
|
51
61
|
* - `mapConfig` (object):
|
|
52
62
|
* Configuration object for the map's behavior, such as zoom levels, center, and controls.
|
|
53
63
|
*
|
|
@@ -102,6 +112,8 @@ function Map({
|
|
|
102
112
|
link,
|
|
103
113
|
siderTitle = "Mine Description",
|
|
104
114
|
renderTooltip = () => [],
|
|
115
|
+
renderTooltipForLocation = null,
|
|
116
|
+
renderTooltipForTerritory = null,
|
|
105
117
|
renderTooltipTags = () => {},
|
|
106
118
|
mapConfig = { maxZoom: 18, center: [13, -15], zoom: 5 },
|
|
107
119
|
emptyDescriptionText = "No description provided",
|
|
@@ -134,6 +146,8 @@ function Map({
|
|
|
134
146
|
t,
|
|
135
147
|
app,
|
|
136
148
|
renderTooltip,
|
|
149
|
+
renderTooltipForLocation,
|
|
150
|
+
renderTooltipForTerritory,
|
|
137
151
|
renderTooltipTags,
|
|
138
152
|
onClickLink,
|
|
139
153
|
link,
|
|
@@ -260,6 +274,11 @@ Map.propTypes = {
|
|
|
260
274
|
filtersConfig: PropTypes.any,
|
|
261
275
|
onFilterChange: PropTypes.any,
|
|
262
276
|
nameAsSiderTitle: PropTypes.bool,
|
|
277
|
+
renderTooltip: PropTypes.func,
|
|
278
|
+
renderTooltipForLocation: PropTypes.func,
|
|
279
|
+
renderTooltipForTerritory: PropTypes.func,
|
|
280
|
+
renderTooltipTags: PropTypes.func,
|
|
281
|
+
link: PropTypes.any,
|
|
263
282
|
};
|
|
264
283
|
|
|
265
284
|
export default Map;
|
|
@@ -3,5 +3,6 @@ import { storyConfig as DefaultMapConfig } from "./storyConfig2.js";
|
|
|
3
3
|
import { storyConfig as TerritoryMapConfig } from "./storyConfig3.js";
|
|
4
4
|
import { storyConfig as StakeholderMapConfig } from "./storyConfig4.js";
|
|
5
5
|
import { storyConfig as ChainMapConfig } from "./storyConfig5.js";
|
|
6
|
+
import { storyConfig as LocationTerritoryMapConfig } from "./storyConfig6.js";
|
|
6
7
|
|
|
7
|
-
export { DefaultMapConfig, TerritoryMapConfig, StakeholderMapConfig, EventConfig, ChainMapConfig };
|
|
8
|
+
export { DefaultMapConfig, TerritoryMapConfig, StakeholderMapConfig, EventConfig, ChainMapConfig, LocationTerritoryMapConfig };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export const storyConfig = {
|
|
2
|
+
data: [
|
|
3
|
+
{
|
|
4
|
+
_id: {},
|
|
5
|
+
id: "7f2aaed4-4b2e-406c-8e0a-6659c5c8367b",
|
|
6
|
+
color: "#6698E4",
|
|
7
|
+
gps: {
|
|
8
|
+
latitude: 7,
|
|
9
|
+
longitude: 1,
|
|
10
|
+
},
|
|
11
|
+
area: [
|
|
12
|
+
[6, 5],
|
|
13
|
+
[7, 1],
|
|
14
|
+
[9, 2],
|
|
15
|
+
[8, 4],
|
|
16
|
+
],
|
|
17
|
+
name: "Territory with Location - Area 1",
|
|
18
|
+
subTitle: "Mine Site",
|
|
19
|
+
type: "Territory Type",
|
|
20
|
+
datastakeId: "LOC-00000000141",
|
|
21
|
+
sources: 2,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
_id: {},
|
|
25
|
+
id: "7f2aaed4-4b2e-406c-8e0a-6659c5c8368c",
|
|
26
|
+
color: "#D3ADF7",
|
|
27
|
+
gps: {
|
|
28
|
+
latitude: 8,
|
|
29
|
+
longitude: 2,
|
|
30
|
+
},
|
|
31
|
+
area: [
|
|
32
|
+
[7, 6],
|
|
33
|
+
[8, 2],
|
|
34
|
+
[10, 13],
|
|
35
|
+
[9, 8],
|
|
36
|
+
],
|
|
37
|
+
name: "Territory with Location - Area 2",
|
|
38
|
+
subTitle: "Processing Site",
|
|
39
|
+
type: "Territory Type",
|
|
40
|
+
datastakeId: "LOC-00000000142",
|
|
41
|
+
sources: 1,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
// tooltipAsText: true,
|
|
45
|
+
primaryLink: true,
|
|
46
|
+
renderTooltip: (data) => {
|
|
47
|
+
return [
|
|
48
|
+
{
|
|
49
|
+
label: "Location",
|
|
50
|
+
value: data.name || "--",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: "Type",
|
|
54
|
+
value: data.subTitle || data.type || "--",
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
},
|
|
58
|
+
renderTooltipTags: () => {
|
|
59
|
+
return {
|
|
60
|
+
label: "Category",
|
|
61
|
+
items: [{ label: "Active", color: "blue" }, { label: "Monitored" }],
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
link: true,
|
|
65
|
+
onClickLink: (data) => {
|
|
66
|
+
console.log(data);
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
@@ -53,11 +53,8 @@ export const getActivityIndicatorsConfig = ({ t, data = {}, onRemove }) => {
|
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
icon: "User",
|
|
56
|
-
label: t("
|
|
57
|
-
|
|
58
|
-
type: data?.childrenPresence === true ? "notCompliant" :
|
|
59
|
-
data?.childrenPresence === false ? "compliant" :
|
|
60
|
-
"empty",
|
|
56
|
+
label: t("No children"),
|
|
57
|
+
type: getType(data?.childrenPresence),
|
|
61
58
|
onClick: getOnClick("childrenPresence"),
|
|
62
59
|
},
|
|
63
60
|
{
|
|
@@ -18,7 +18,7 @@ export default function KeyIndicatorsWidget({
|
|
|
18
18
|
const component = (
|
|
19
19
|
<Widget
|
|
20
20
|
loading={loading}
|
|
21
|
-
className={formatClassname(["flex-1 with-border-header", widgetClassName])}
|
|
21
|
+
className={formatClassname(["flex-1 h-w-btn-header with-border-header", widgetClassName])}
|
|
22
22
|
title={noTitle ? undefined : t(title)}
|
|
23
23
|
noTitle={noTitle}
|
|
24
24
|
>
|
|
@@ -534,7 +534,7 @@ export const EditForm = ({
|
|
|
534
534
|
<GetFormItem
|
|
535
535
|
inputKey={k}
|
|
536
536
|
inputData={inputData}
|
|
537
|
-
inputId={
|
|
537
|
+
inputId={inputId}
|
|
538
538
|
input={input}
|
|
539
539
|
highlightMandatory={highlightMandatory}
|
|
540
540
|
changeInputMeta={changeInputMeta}
|