@undp/carbon-library 1.0.135-CARBON-343.8 → 1.0.135-CARBON-343.11
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.js +59 -17
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +59 -17
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
@@ -23623,6 +23623,9 @@ var NdcDetailsComponent = function (props) {
|
|
23623
23623
|
newData.splice(index, 1, __assign(__assign({}, item), row));
|
23624
23624
|
setNdcDetailsData(newData);
|
23625
23625
|
};
|
23626
|
+
var getNdcDetailsForPeriod = function () {
|
23627
|
+
return ndcDetailsData;
|
23628
|
+
};
|
23626
23629
|
var defaultColumns = [
|
23627
23630
|
{
|
23628
23631
|
title: t("ndc:ndcColumnsNationalPlanObj"),
|
@@ -23690,6 +23693,9 @@ var NdcDetailsComponent = function (props) {
|
|
23690
23693
|
);
|
23691
23694
|
}
|
23692
23695
|
var onCancelPeriod = function () { };
|
23696
|
+
var inRange = function (num, min, max) {
|
23697
|
+
return num >= min && num <= max;
|
23698
|
+
};
|
23693
23699
|
var onAddNewPeriod = function () {
|
23694
23700
|
if (selectedPeriod && selectedPeriod.current) {
|
23695
23701
|
var newPeriodItem_1 = {
|
@@ -23699,7 +23705,10 @@ var NdcDetailsComponent = function (props) {
|
|
23699
23705
|
end: selectedPeriod.current.end,
|
23700
23706
|
children: ndcDetailsTableContent(),
|
23701
23707
|
};
|
23702
|
-
var existingIndex = periodItemsRef.current.findIndex(function (item) {
|
23708
|
+
var existingIndex = periodItemsRef.current.findIndex(function (item) {
|
23709
|
+
return inRange(newPeriodItem_1.start, item.start, item.end) ||
|
23710
|
+
inRange(newPeriodItem_1.end, item.start, item.end);
|
23711
|
+
});
|
23703
23712
|
if (existingIndex === -1) {
|
23704
23713
|
setPeriodItems(function (items) { return __spreadArray(__spreadArray([], items, true), [newPeriodItem_1], false); });
|
23705
23714
|
periodItemsRef.current = __spreadArray(__spreadArray([], periodItemsRef.current, true), [newPeriodItem_1], false);
|
@@ -23740,32 +23749,65 @@ var NdcDetailsComponent = function (props) {
|
|
23740
23749
|
};
|
23741
23750
|
useEffect(function () {
|
23742
23751
|
var defaultNdcDetails = [
|
23752
|
+
{
|
23753
|
+
startDate: new Date("2019-03-25"),
|
23754
|
+
endDate: new Date("2020-03-25"),
|
23755
|
+
nationalPlanObj: "Enhance value addition in key growth opportunities",
|
23756
|
+
kpi: 25,
|
23757
|
+
},
|
23758
|
+
{
|
23759
|
+
startDate: new Date("2018-03-25"),
|
23760
|
+
endDate: new Date("2019-03-25"),
|
23761
|
+
nationalPlanObj: "Strengthen the private sector to create 10,000 jobs",
|
23762
|
+
kpi: 10500,
|
23763
|
+
},
|
23764
|
+
{
|
23765
|
+
startDate: new Date("2021-03-25"),
|
23766
|
+
endDate: new Date("2022-03-25"),
|
23767
|
+
nationalPlanObj: "Consolidate and increase the stock and quality of productive infrastructure by 50%",
|
23768
|
+
kpi: 48,
|
23769
|
+
},
|
23770
|
+
{
|
23771
|
+
startDate: new Date("2022-03-25"),
|
23772
|
+
endDate: new Date("2022-05-25"),
|
23773
|
+
nationalPlanObj: "Enhance the productivity and social wellbeing of the population",
|
23774
|
+
kpi: 20,
|
23775
|
+
},
|
23743
23776
|
{
|
23744
23777
|
startDate: new Date("2022-03-25"),
|
23745
23778
|
endDate: new Date("2023-03-25"),
|
23746
|
-
nationalPlanObj: "
|
23747
|
-
kpi:
|
23779
|
+
nationalPlanObj: "Strengthen the role of the state in guiding and facilitating development",
|
23780
|
+
kpi: 10,
|
23748
23781
|
},
|
23782
|
+
];
|
23783
|
+
var initialPeriods = [
|
23749
23784
|
{
|
23750
|
-
|
23751
|
-
|
23752
|
-
|
23753
|
-
kpi: 34,
|
23785
|
+
key: "add_new",
|
23786
|
+
label: "Add New",
|
23787
|
+
children: addNewPeriodContent(),
|
23754
23788
|
},
|
23755
23789
|
{
|
23756
|
-
|
23757
|
-
|
23758
|
-
|
23759
|
-
|
23790
|
+
key: "2019-2020",
|
23791
|
+
label: "2019-2020",
|
23792
|
+
start: 2019,
|
23793
|
+
end: 2020,
|
23794
|
+
children: ndcDetailsTableContent(),
|
23760
23795
|
},
|
23796
|
+
{
|
23797
|
+
key: "2020-2023",
|
23798
|
+
label: "2020-2023",
|
23799
|
+
start: 2020,
|
23800
|
+
end: 2023,
|
23801
|
+
children: ndcDetailsTableContent(),
|
23802
|
+
}
|
23761
23803
|
];
|
23762
|
-
|
23804
|
+
({
|
23763
23805
|
key: "add_new",
|
23764
23806
|
label: "Add New",
|
23765
23807
|
children: addNewPeriodContent(),
|
23766
|
-
};
|
23767
|
-
setPeriodItems(
|
23768
|
-
periodItemsRef.current =
|
23808
|
+
});
|
23809
|
+
setPeriodItems(initialPeriods);
|
23810
|
+
periodItemsRef.current = initialPeriods;
|
23769
23811
|
setNdcDetailsData(defaultNdcDetails);
|
23770
23812
|
}, []);
|
23771
23813
|
return (React.createElement("div", { className: "ndc-management content-container" },
|
@@ -23778,10 +23820,10 @@ var NdcDetailsComponent = function (props) {
|
|
23778
23820
|
React.createElement(Tabs, { centered: false, defaultActiveKey: "1", items: periodItems, activeKey: selectedTab, onChange: onTabChange })),
|
23779
23821
|
selectedTab !== "add_new" && (React.createElement("div", null,
|
23780
23822
|
React.createElement("div", null,
|
23781
|
-
React.createElement(Table, { components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource:
|
23823
|
+
React.createElement(Table, { components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: getNdcDetailsForPeriod(), columns: columns, footer: function () { return (React.createElement(Row, { justify: "center" },
|
23782
23824
|
React.createElement(Button, { onClick: onAddNewNdcDetail, type: "default", style: {
|
23783
23825
|
marginBottom: 16,
|
23784
|
-
width:
|
23826
|
+
width: "100%",
|
23785
23827
|
} }, t("ndc:addNdcAction")))); } }))))));
|
23786
23828
|
};
|
23787
23829
|
|