@undp/carbon-library 1.0.150-CARBON-320.0 → 1.0.150-CARBON-343.3

Sign up to get free protection for your applications and to get access to all the features.
package/dist/esm/index.js CHANGED
@@ -19592,16 +19592,13 @@ var NdcActionViewComponent = function (props) {
19592
19592
  }
19593
19593
  });
19594
19594
  }); };
19595
- var getProjectReportActions = function (reportData, reportVersion) {
19595
+ var getProjectReportActions = function (reportData) {
19596
19596
  return (React.createElement(Row, null,
19597
19597
  React.createElement("div", { className: "icon" },
19598
19598
  (reportData === null || reportData === void 0 ? void 0 : reportData.status) === DocumentStatus.ACCEPTED && (React.createElement(CheckCircleOutlined, { className: "common-progress-icon", style: { color: "#5DC380" } })),
19599
19599
  (reportData === null || reportData === void 0 ? void 0 : reportData.status) === DocumentStatus.REJECTED && (React.createElement(ExclamationCircleOutlined, { className: "common-progress-icon", style: { color: "#FD6F70" } }))),
19600
19600
  React.createElement("div", { className: "link mg-left-1" }, (reportData === null || reportData === void 0 ? void 0 : reportData.url) && linkDocVisible(reportData === null || reportData === void 0 ? void 0 : reportData.status) && (React.createElement("a", { href: reportData === null || reportData === void 0 ? void 0 : reportData.url, target: "_blank", rel: "noopener noreferrer", download: true },
19601
- React.createElement(BookOutlined, { className: "common-progress-icon margin-right-1", style: { color: "#3F3A47" } })))),
19602
- (reportData === null || reportData === void 0 ? void 0 : reportData.txTime) && (React.createElement("div", { className: "time" },
19603
- moment(parseInt(reportData === null || reportData === void 0 ? void 0 : reportData.txTime)).format("DD MMMM YYYY @ HH:mm"),
19604
- " ~ " + reportVersion))));
19601
+ React.createElement(BookOutlined, { className: "common-progress-icon margin-right-1", style: { color: "#3F3A47" } }))))));
19605
19602
  };
19606
19603
  var getProjectReports = function () { return __awaiter(void 0, void 0, void 0, function () {
19607
19604
  var reportDetails, response, exception_1;
@@ -19649,20 +19646,12 @@ var NdcActionViewComponent = function (props) {
19649
19646
  if ((item === null || item === void 0 ? void 0 : item.status) === DocumentStatus.ACCEPTED) {
19650
19647
  setMonitoringReportAccepted(true);
19651
19648
  }
19652
- var versionfull = (item === null || item === void 0 ? void 0 : item.url).split("_")[(item === null || item === void 0 ? void 0 : item.url).split("_").length - 1];
19653
- var version = versionfull ? versionfull.split(".")[0] : "1";
19654
- var moniteringVersion = version.startsWith("V") ? version : "V1";
19655
19649
  reportDetails[t("ndcAction:viewMoniteringReport")] =
19656
- getProjectReportActions(item, moniteringVersion);
19650
+ getProjectReportActions(item);
19657
19651
  }
19658
19652
  else if ((_b = item === null || item === void 0 ? void 0 : item.url) === null || _b === void 0 ? void 0 : _b.includes("VERIFICATION_REPORT")) {
19659
- var versionfull = (item === null || item === void 0 ? void 0 : item.url).split("_")[(item === null || item === void 0 ? void 0 : item.url).split("_").length - 1];
19660
- var version = versionfull ? versionfull.split(".")[0] : "1";
19661
- var verificationVersion = version.startsWith("V")
19662
- ? version
19663
- : "V1";
19664
19653
  reportDetails[t("ndcAction:viewVerificationReport")] =
19665
- getProjectReportActions(item, verificationVersion);
19654
+ getProjectReportActions(item);
19666
19655
  }
19667
19656
  });
19668
19657
  }
@@ -24518,6 +24507,8 @@ var NdcDetailsComponent = function (props) {
24518
24507
  var _d = useState("add_new"), selectedTab = _d[0], setSelectedTab = _d[1];
24519
24508
  var selectedPeriod = useRef({});
24520
24509
  var addedNdcDetailId = useRef(0);
24510
+ var selectedNdcDetail = useRef({});
24511
+ var _e = useState(0), tableKey = _e[0], setTableKey = _e[1];
24521
24512
  var userInfoState = useUserContext().userInfoState;
24522
24513
  var isAddRangeVisible = function () {
24523
24514
  return (((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY ||
@@ -24550,6 +24541,15 @@ var NdcDetailsComponent = function (props) {
24550
24541
  return [];
24551
24542
  }
24552
24543
  };
24544
+ var getSubNdcDetails = function (key) {
24545
+ var ndcDetail = ndcDetailsData.find(function (item) { return item.key === key; });
24546
+ if (ndcDetail) {
24547
+ return ndcDetail.subNdcDetails;
24548
+ }
24549
+ else {
24550
+ return [];
24551
+ }
24552
+ };
24553
24553
  var defaultColumns = [
24554
24554
  {
24555
24555
  title: t("ndc:ndcColumnsNationalPlanObj"),
@@ -24566,7 +24566,7 @@ var NdcDetailsComponent = function (props) {
24566
24566
  editable: true,
24567
24567
  },
24568
24568
  {
24569
- title: 'Ministry',
24569
+ title: "Ministry",
24570
24570
  dataIndex: "ministry",
24571
24571
  key: "ministry",
24572
24572
  align: "left",
@@ -24594,10 +24594,33 @@ var NdcDetailsComponent = function (props) {
24594
24594
  endDate: new Date("".concat(Number(range[0]), "-12-24 23:12:00")),
24595
24595
  nationalPlanObj: t("ndc:enterNewPlanTxt"),
24596
24596
  kpi: 0,
24597
- ministry: "Please add the Ministry name"
24597
+ ministry: "Please add the Ministry name",
24598
24598
  };
24599
24599
  setNdcDetailsData(__spreadArray(__spreadArray([], ndcDetailsData, true), [newData], false));
24600
24600
  }
24601
+ function onAddNewSubNdcDetail() {
24602
+ var range = selectedTab.split("-");
24603
+ var ndcDetail = ndcDetailsData.find(function (item) { return item.key === selectedNdcDetail.current.key; });
24604
+ var ndcDetailItemIndex = ndcDetailsData.findIndex(function (item) { return item.key === selectedNdcDetail.current.key; });
24605
+ if (ndcDetail) {
24606
+ addedNdcDetailId.current = addedNdcDetailId.current + 1;
24607
+ var newData = {
24608
+ key: addedNdcDetailId.current,
24609
+ startDate: new Date("".concat(Number(range[0]), "-01-24 23:12:00")),
24610
+ endDate: new Date("".concat(Number(range[0]), "-12-24 23:12:00")),
24611
+ nationalPlanObj: t("ndc:enterNewPlanTxt"),
24612
+ kpi: 0,
24613
+ ministry: "Please add the Ministry name",
24614
+ };
24615
+ if (!ndcDetail.subNdcDetails) {
24616
+ ndcDetail.subNdcDetails = [];
24617
+ }
24618
+ ndcDetail.subNdcDetails.push(newData);
24619
+ }
24620
+ ndcDetailsData[ndcDetailItemIndex] = ndcDetail;
24621
+ setNdcDetailsData(ndcDetailsData);
24622
+ setTableKey(function (key) { return key + 1; });
24623
+ }
24601
24624
  var components = {
24602
24625
  body: {
24603
24626
  row: EditableRow,
@@ -24676,6 +24699,16 @@ var NdcDetailsComponent = function (props) {
24676
24699
  React.createElement(Button, { type: "primary", onClick: onAddNewPeriod, htmlType: "submit", loading: loading }, t("ndc:submit")),
24677
24700
  React.createElement(Button, { className: "back-btn", onClick: onCancelPeriod, loading: loading }, t("ndc:back"))))));
24678
24701
  }
24702
+ function getSubNdcActionContent(record) {
24703
+ selectedNdcDetail.current = record;
24704
+ return (React.createElement(Table, { components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: getSubNdcDetails(record.key), columns: columns, showHeader: false, pagination: false, footer: function () {
24705
+ return (React.createElement(Row, { justify: "center" },
24706
+ React.createElement(Button, { onClick: onAddNewSubNdcDetail, type: "default", style: {
24707
+ marginBottom: 16,
24708
+ width: "100%",
24709
+ } }, t("ndc:addSubNdcAction"))));
24710
+ } }));
24711
+ }
24679
24712
  var onTabChange = function (key) {
24680
24713
  setSelectedTab(key);
24681
24714
  };
@@ -24687,7 +24720,17 @@ var NdcDetailsComponent = function (props) {
24687
24720
  endDate: new Date("2020-03-25"),
24688
24721
  nationalPlanObj: "Enhance value addition in key growth opportunities",
24689
24722
  kpi: 25,
24690
- ministry: "Ministry of Agriculture, Water and Forestry (MAWF)"
24723
+ ministry: "Ministry of Agriculture, Water and Forestry (MAWF)",
24724
+ subNdcDetails: [
24725
+ {
24726
+ key: 6,
24727
+ startDate: new Date("2019-03-25"),
24728
+ endDate: new Date("2020-03-25"),
24729
+ nationalPlanObj: "Enhance value addition in key growth opportunities sub details",
24730
+ kpi: 25,
24731
+ ministry: "Ministry of Agriculture, Water and Forestry (MAWF)",
24732
+ },
24733
+ ],
24691
24734
  },
24692
24735
  {
24693
24736
  key: 2,
@@ -24695,7 +24738,7 @@ var NdcDetailsComponent = function (props) {
24695
24738
  endDate: new Date("2019-08-25"),
24696
24739
  nationalPlanObj: "Strengthen the private sector to create 10,000 jobs",
24697
24740
  kpi: 10500,
24698
- ministry: "Ministry of Tourism (MoT)"
24741
+ ministry: "Ministry of Tourism (MoT)",
24699
24742
  },
24700
24743
  {
24701
24744
  key: 3,
@@ -24703,7 +24746,7 @@ var NdcDetailsComponent = function (props) {
24703
24746
  endDate: new Date("2022-03-25"),
24704
24747
  nationalPlanObj: "Consolidate and increase the stock and quality of productive infrastructure by 50%",
24705
24748
  kpi: 48,
24706
- ministry: "Ministry of Education, Arts and Culture (MoE)"
24749
+ ministry: "Ministry of Education, Arts and Culture (MoE)",
24707
24750
  },
24708
24751
  {
24709
24752
  key: 4,
@@ -24711,7 +24754,7 @@ var NdcDetailsComponent = function (props) {
24711
24754
  endDate: new Date("2022-05-25"),
24712
24755
  nationalPlanObj: "Enhance the productivity and social wellbeing of the population",
24713
24756
  kpi: 20,
24714
- ministry: "Ministry of Environment, Forestry and Tourism (MEFT)"
24757
+ ministry: "Ministry of Environment, Forestry and Tourism (MEFT)",
24715
24758
  },
24716
24759
  {
24717
24760
  key: 5,
@@ -24719,7 +24762,7 @@ var NdcDetailsComponent = function (props) {
24719
24762
  endDate: new Date("2023-03-25"),
24720
24763
  nationalPlanObj: "Strengthen the role of the state in guiding and facilitating development",
24721
24764
  kpi: 10,
24722
- ministry: "Ministry of Tourism (MoT)"
24765
+ ministry: "Ministry of Tourism (MoT)",
24723
24766
  },
24724
24767
  ];
24725
24768
  var initialPeriods = [
@@ -24762,7 +24805,11 @@ var NdcDetailsComponent = function (props) {
24762
24805
  React.createElement(Tabs, { centered: false, defaultActiveKey: "1", items: periodItems, activeKey: selectedTab, onChange: onTabChange })),
24763
24806
  selectedTab !== "add_new" && (React.createElement("div", null,
24764
24807
  React.createElement("div", null,
24765
- React.createElement(Table, { components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: getNdcDetailsForPeriod(), columns: columns, footer: function () {
24808
+ React.createElement(Table, { key: tableKey, components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: getNdcDetailsForPeriod(), columns: columns, expandable: {
24809
+ expandedRowRender: function (record) { return getSubNdcActionContent(record); },
24810
+ indentSize: 0,
24811
+ defaultExpandedRowKeys: [selectedNdcDetail.current.key]
24812
+ }, footer: function () {
24766
24813
  return isAddNdcActionVisible() && (React.createElement(Row, { justify: "center" },
24767
24814
  React.createElement(Button, { onClick: onAddNewNdcDetail, type: "default", style: {
24768
24815
  marginBottom: 16,