datastake-daf 0.6.841 → 0.6.842
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 +1254 -1163
- package/dist/pages/index.js +21 -20
- package/package.json +1 -1
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/Locations/index.js +20 -19
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/index.js +5 -2
- package/src/@daf/pages/Events/Activities/columns.js +7 -3
- package/src/@daf/pages/Events/Incidents/columns.js +7 -3
package/dist/pages/index.js
CHANGED
|
@@ -13677,7 +13677,7 @@ const getColors$1 = theme => {
|
|
|
13677
13677
|
|
|
13678
13678
|
function Locations({
|
|
13679
13679
|
selectedSources = {},
|
|
13680
|
-
data =
|
|
13680
|
+
data = {},
|
|
13681
13681
|
loading = false,
|
|
13682
13682
|
t = () => {},
|
|
13683
13683
|
options = {},
|
|
@@ -13688,23 +13688,23 @@ function Locations({
|
|
|
13688
13688
|
} = options;
|
|
13689
13689
|
const colors = getColors$1(theme);
|
|
13690
13690
|
const pieData = React.useMemo(() => {
|
|
13691
|
-
|
|
13692
|
-
const
|
|
13693
|
-
undefined: undefined$1,
|
|
13694
|
-
...rest
|
|
13695
|
-
} = data;
|
|
13696
|
-
const total = Object.values(rest).reduce((all, val) => all + (val || 0), 0);
|
|
13691
|
+
const rest = data || {};
|
|
13692
|
+
const total = Object.values(rest).reduce((sum, val) => sum + (val || 0), 0);
|
|
13697
13693
|
return Object.keys(rest).map((key, index) => {
|
|
13698
13694
|
const color = colors[index % colors.length];
|
|
13695
|
+
const value = rest[key] || 0;
|
|
13699
13696
|
return {
|
|
13700
|
-
value
|
|
13701
|
-
percent:
|
|
13702
|
-
color
|
|
13703
|
-
label: findOptions(key, countries),
|
|
13704
|
-
key
|
|
13697
|
+
value,
|
|
13698
|
+
percent: total ? value / total : 0,
|
|
13699
|
+
color,
|
|
13700
|
+
label: findOptions(key, countries) || key,
|
|
13701
|
+
key
|
|
13705
13702
|
};
|
|
13706
13703
|
});
|
|
13707
|
-
}, [data, countries]);
|
|
13704
|
+
}, [data, countries, colors]);
|
|
13705
|
+
console.log({
|
|
13706
|
+
data
|
|
13707
|
+
});
|
|
13708
13708
|
const isEmpty = React.useMemo(() => Object.keys(data).filter(k => !!data[k]).length === 0, [data]);
|
|
13709
13709
|
const getTooltipChildren = React.useCallback(item => {
|
|
13710
13710
|
if (isEmpty) {
|
|
@@ -13904,7 +13904,7 @@ function ChartsContainer({
|
|
|
13904
13904
|
range: selectedRange
|
|
13905
13905
|
},
|
|
13906
13906
|
stop: selectedSources?.loading,
|
|
13907
|
-
defaultData:
|
|
13907
|
+
defaultData: {}
|
|
13908
13908
|
}), [isTradeActions, selectedSources, selectedRange]);
|
|
13909
13909
|
const {
|
|
13910
13910
|
loading,
|
|
@@ -13913,6 +13913,7 @@ function ChartsContainer({
|
|
|
13913
13913
|
config: defaultConfig,
|
|
13914
13914
|
onFetch: () => setPreviousRange(selectedRange)
|
|
13915
13915
|
});
|
|
13916
|
+
console.log('ChartsContainer data:', data);
|
|
13916
13917
|
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
13917
13918
|
title: isTradeActions ? t("Trade Actors") : t("Mining Sites"),
|
|
13918
13919
|
className: "with-border-header",
|
|
@@ -13929,7 +13930,7 @@ function ChartsContainer({
|
|
|
13929
13930
|
selectedRange: selectedRange,
|
|
13930
13931
|
options: options
|
|
13931
13932
|
}), /*#__PURE__*/jsxRuntime.jsx(Locations, {
|
|
13932
|
-
data: data?.
|
|
13933
|
+
data: data?.location,
|
|
13933
13934
|
t: t,
|
|
13934
13935
|
theme: theme,
|
|
13935
13936
|
selectedSources: selectedSources,
|
|
@@ -43309,7 +43310,7 @@ const getColumns$a = ({
|
|
|
43309
43310
|
className: "daf-default-cell"
|
|
43310
43311
|
});
|
|
43311
43312
|
}
|
|
43312
|
-
const region = getLinkValue(all?.location?.administrativeLevel1, all?.location?.linking?.SCL);
|
|
43313
|
+
const region = all?.location ? getLinkValue(all?.location?.administrativeLevel1, all?.location?.linking?.SCL) : getLinkValue(all?.administrativeLevel1Name, all?.linking?.SCL) || all?.administrativeLevel1Name;
|
|
43313
43314
|
return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
43314
43315
|
title: region,
|
|
43315
43316
|
children: region
|
|
@@ -43317,7 +43318,7 @@ const getColumns$a = ({
|
|
|
43317
43318
|
}
|
|
43318
43319
|
}, {
|
|
43319
43320
|
dataIndex: 'territory',
|
|
43320
|
-
title: findOptions(user?.company?.country, options?.administrativeLevel2)?.length > 2 ? findOptions(user?.company?.country, options?.
|
|
43321
|
+
title: findOptions(user?.company?.country, options?.administrativeLevel2)?.length > 2 ? findOptions(user?.company?.country, options?.administrativeLevel2Name) : t("Territory"),
|
|
43321
43322
|
ellipsis: true,
|
|
43322
43323
|
show: true,
|
|
43323
43324
|
render: (v, all) => {
|
|
@@ -43326,7 +43327,7 @@ const getColumns$a = ({
|
|
|
43326
43327
|
className: "daf-default-cell"
|
|
43327
43328
|
});
|
|
43328
43329
|
}
|
|
43329
|
-
const district = getLinkValue(all?.location?.administrativeLevel2, all?.location?.linking?.SCL);
|
|
43330
|
+
const district = all?.location ? getLinkValue(all?.location?.administrativeLevel2, all?.location?.linking?.SCL) : getLinkValue(all?.administrativeLevel2, all?.linking?.SCL) || all?.administrativeLevel2;
|
|
43330
43331
|
return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
43331
43332
|
title: district,
|
|
43332
43333
|
children: district
|
|
@@ -43739,7 +43740,7 @@ const getColumns$9 = ({
|
|
|
43739
43740
|
className: "daf-default-cell"
|
|
43740
43741
|
});
|
|
43741
43742
|
}
|
|
43742
|
-
const region = getLinkValue(all?.location?.administrativeLevel1, all?.location?.linking?.SCL);
|
|
43743
|
+
const region = all?.location ? getLinkValue(all?.location?.administrativeLevel1, all?.location?.linking?.SCL) : getLinkValue(all?.administrativeLevel1Name, all?.linking?.SCL) || all?.administrativeLevel1Name;
|
|
43743
43744
|
return region ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
43744
43745
|
title: region,
|
|
43745
43746
|
children: region
|
|
@@ -43756,7 +43757,7 @@ const getColumns$9 = ({
|
|
|
43756
43757
|
className: "daf-default-cell"
|
|
43757
43758
|
});
|
|
43758
43759
|
}
|
|
43759
|
-
const district = getLinkValue(all?.location?.administrativeLevel2, all?.location?.linking?.SCL);
|
|
43760
|
+
const district = all?.location ? getLinkValue(all?.location?.administrativeLevel2, all?.location?.linking?.SCL) : getLinkValue(all?.administrativeLevel2, all?.linking?.SCL) || all?.administrativeLevel2;
|
|
43760
43761
|
return district ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
43761
43762
|
title: district,
|
|
43762
43763
|
children: district
|
package/package.json
CHANGED
|
@@ -6,28 +6,29 @@ import Widget from '../../../../../../../core/components/Dashboard/Widget/index.
|
|
|
6
6
|
import Chart from '../../../../../../../core/components/Charts/PieChart/chart.jsx';
|
|
7
7
|
import { getColors } from './config';
|
|
8
8
|
|
|
9
|
-
function Locations({selectedSources = {}, data =
|
|
9
|
+
function Locations({selectedSources = {}, data = {}, loading = false, t = () => {}, options = {}, theme = {}}) {
|
|
10
10
|
const { countries = [] } = options;
|
|
11
11
|
const colors = getColors(theme);
|
|
12
|
-
|
|
13
12
|
const pieData = useMemo(() => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
13
|
+
const rest = data || {};
|
|
14
|
+
|
|
15
|
+
const total = Object.values(rest).reduce((sum, val) => sum + (val || 0), 0);
|
|
16
|
+
|
|
17
|
+
return Object.keys(rest).map((key, index) => {
|
|
18
|
+
const color = colors[index % colors.length];
|
|
19
|
+
const value = rest[key] || 0;
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
value,
|
|
23
|
+
percent: total ? value / total : 0,
|
|
24
|
+
color,
|
|
25
|
+
label: findOptions(key, countries) || key,
|
|
26
|
+
key,
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
}, [data, countries, colors]);
|
|
30
|
+
|
|
31
|
+
console.log({data});
|
|
31
32
|
const isEmpty = useMemo(
|
|
32
33
|
() => Object.keys(data).filter((k) => !!data[k]).length === 0,
|
|
33
34
|
[data],
|
|
@@ -24,13 +24,15 @@ function ChartsContainer({selectedSources = {}, isTradeActions = false, t = () =
|
|
|
24
24
|
range: selectedRange,
|
|
25
25
|
},
|
|
26
26
|
stop: selectedSources?.loading,
|
|
27
|
-
defaultData:
|
|
27
|
+
defaultData: {},
|
|
28
28
|
}),
|
|
29
29
|
[isTradeActions, selectedSources, selectedRange],
|
|
30
30
|
);
|
|
31
31
|
|
|
32
32
|
const { loading, data } = useWidgetFetch({config: defaultConfig, onFetch: () => setPreviousRange(selectedRange)});
|
|
33
33
|
|
|
34
|
+
console.log('ChartsContainer data:', data);
|
|
35
|
+
|
|
34
36
|
return (
|
|
35
37
|
<Widget
|
|
36
38
|
title={isTradeActions ? t("Trade Actors") : t("Mining Sites")}
|
|
@@ -50,12 +52,13 @@ function ChartsContainer({selectedSources = {}, isTradeActions = false, t = () =
|
|
|
50
52
|
options={options}
|
|
51
53
|
/>
|
|
52
54
|
<Locations
|
|
53
|
-
data={data?.
|
|
55
|
+
data={data?.location}
|
|
54
56
|
t={t}
|
|
55
57
|
theme={theme}
|
|
56
58
|
selectedSources={selectedSources}
|
|
57
59
|
loading={loading}
|
|
58
60
|
options={options}
|
|
61
|
+
|
|
59
62
|
/>
|
|
60
63
|
<GenderDistribution
|
|
61
64
|
selectedSources={selectedSources}
|
|
@@ -79,14 +79,16 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
79
79
|
return <div className="daf-default-cell" />
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
const region =
|
|
82
|
+
const region = all?.location
|
|
83
|
+
? getLinkValue(all?.location?.administrativeLevel1, all?.location?.linking?.SCL)
|
|
84
|
+
: (getLinkValue(all?.administrativeLevel1Name, all?.linking?.SCL) || all?.administrativeLevel1Name);
|
|
83
85
|
|
|
84
86
|
return region ? <Tooltip title={region}>{region}</Tooltip> : '-';
|
|
85
87
|
},
|
|
86
88
|
},
|
|
87
89
|
{
|
|
88
90
|
dataIndex: 'territory',
|
|
89
|
-
title: findOptions(user?.company?.country, options?.administrativeLevel2)?.length > 2 ? findOptions(user?.company?.country, options?.
|
|
91
|
+
title: findOptions(user?.company?.country, options?.administrativeLevel2)?.length > 2 ? findOptions(user?.company?.country, options?.administrativeLevel2Name) : t("Territory"),
|
|
90
92
|
ellipsis: true,
|
|
91
93
|
show: true,
|
|
92
94
|
render: (v, all) => {
|
|
@@ -94,7 +96,9 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
94
96
|
return <div className="daf-default-cell" />
|
|
95
97
|
}
|
|
96
98
|
|
|
97
|
-
const district =
|
|
99
|
+
const district = all?.location
|
|
100
|
+
? getLinkValue(all?.location?.administrativeLevel2, all?.location?.linking?.SCL)
|
|
101
|
+
: (getLinkValue(all?.administrativeLevel2, all?.linking?.SCL) || all?.administrativeLevel2);
|
|
98
102
|
|
|
99
103
|
return district ? <Tooltip title={district}>{district}</Tooltip> : '-';
|
|
100
104
|
},
|
|
@@ -79,7 +79,9 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
79
79
|
return <div className="daf-default-cell" />
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
const region =
|
|
82
|
+
const region = all?.location
|
|
83
|
+
? getLinkValue(all?.location?.administrativeLevel1, all?.location?.linking?.SCL)
|
|
84
|
+
: (getLinkValue(all?.administrativeLevel1Name, all?.linking?.SCL) || all?.administrativeLevel1Name);
|
|
83
85
|
|
|
84
86
|
return region ? <Tooltip title={region}>{region}</Tooltip> : '-';
|
|
85
87
|
},
|
|
@@ -94,11 +96,13 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
94
96
|
return <div className="daf-default-cell" />
|
|
95
97
|
}
|
|
96
98
|
|
|
97
|
-
const district =
|
|
99
|
+
const district = all?.location
|
|
100
|
+
? getLinkValue(all?.location?.administrativeLevel2, all?.location?.linking?.SCL)
|
|
101
|
+
: (getLinkValue(all?.administrativeLevel2, all?.linking?.SCL) || all?.administrativeLevel2);
|
|
98
102
|
|
|
99
103
|
return district ? <Tooltip title={district}>{district}</Tooltip> : '-';
|
|
100
104
|
},
|
|
101
|
-
},
|
|
105
|
+
},
|
|
102
106
|
{
|
|
103
107
|
dataIndex: 'eventCategory',
|
|
104
108
|
title: t('Category'),
|