@undp/carbon-library 1.0.150-CARBON-343.6 → 1.0.150-CARBON-343.7

Sign up to get free protection for your applications and to get access to all the features.
package/dist/cjs/index.js CHANGED
@@ -24517,6 +24517,11 @@ var EditableCell = function (_a) {
24517
24517
  var css_248z$4 = ".ndc-steps-actions {\n display: flex;\n flex-direction: row-reverse;\n margin-right: 1rem;\n justify-content: center; }\n .ndc-steps-actions .action-btn {\n border: 1px solid #16b1ff;\n color: #16b1ff;\n margin-right: 1rem; }\n .ndc-steps-actions .back-btn {\n border: 1px solid rgba(140, 140, 140, 0.7);\n color: rgba(140, 140, 140, 0.7);\n margin-right: 1rem; }\n .ndc-steps-actions .mg-left-1 {\n margin-left: 1rem; }\n";
24518
24518
  styleInject(css_248z$4);
24519
24519
 
24520
+ var NdcActionType;
24521
+ (function (NdcActionType) {
24522
+ NdcActionType[NdcActionType["main"] = 0] = "main";
24523
+ NdcActionType[NdcActionType["sub"] = 1] = "sub";
24524
+ })(NdcActionType || (NdcActionType = {}));
24520
24525
  var NdcDetailsComponent = function (props) {
24521
24526
  var t = props.t; props.useConnection; var useUserContext = props.useUserContext;
24522
24527
  var RangePicker = antd.DatePicker.RangePicker;
@@ -24528,7 +24533,7 @@ var NdcDetailsComponent = function (props) {
24528
24533
  var selectedPeriod = React.useRef({});
24529
24534
  var addedNdcDetailId = React.useRef(0);
24530
24535
  var selectedNdcDetail = React.useRef({});
24531
- var _e = React.useState(0), tableKey = _e[0]; _e[1];
24536
+ var _e = React.useState(0), tableKey = _e[0], setTableKey = _e[1];
24532
24537
  var userInfoState = useUserContext().userInfoState;
24533
24538
  var isAddRangeVisible = function () {
24534
24539
  return (((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.MINISTRY ||
@@ -24543,11 +24548,35 @@ var NdcDetailsComponent = function (props) {
24543
24548
  return num >= min && num <= max;
24544
24549
  };
24545
24550
  var handleSave = function (row) {
24546
- var newData = __spreadArray([], ndcDetailsData, true);
24547
- var index = newData.findIndex(function (item) { return row.key === item.key; });
24548
- var item = newData[index];
24549
- newData.splice(index, 1, __assign(__assign({}, item), row));
24550
- setNdcDetailsData(newData);
24551
+ if (row.type === NdcActionType.main) {
24552
+ var newData = __spreadArray([], ndcDetailsData, true);
24553
+ var index = newData.findIndex(function (item) { return row.key === item.key; });
24554
+ var item = newData[index];
24555
+ newData.splice(index, 1, __assign(__assign({}, item), row));
24556
+ setNdcDetailsData(newData);
24557
+ }
24558
+ else {
24559
+ var newData = __spreadArray([], ndcDetailsData, true);
24560
+ var parentIndex = newData.findIndex(function (item) { return row.ndcActionId === item.key; });
24561
+ var parentItem = newData[parentIndex];
24562
+ if (parentItem) {
24563
+ if (parentItem.subNdcDetails) {
24564
+ var itemIndex = parentItem.subNdcDetails.findIndex(function (item) { return row.key === item.key; });
24565
+ if (itemIndex === -1) {
24566
+ parentItem.subNdcDetails.push(row);
24567
+ }
24568
+ else {
24569
+ parentItem.subNdcDetails.splice(itemIndex, 1, __assign({}, row));
24570
+ }
24571
+ }
24572
+ else {
24573
+ parentItem.subNdcDetails = [row];
24574
+ }
24575
+ }
24576
+ newData.splice(parentIndex, 1, __assign({}, parentItem));
24577
+ setNdcDetailsData(newData);
24578
+ setTableKey(function (key) { return key + 1; });
24579
+ }
24551
24580
  };
24552
24581
  var getNdcDetailsForPeriod = function () {
24553
24582
  var range = selectedTab.split("-");
@@ -24609,14 +24638,27 @@ var NdcDetailsComponent = function (props) {
24609
24638
  });
24610
24639
  function onAddNewNdcDetail() {
24611
24640
  var range = selectedTab.split("-");
24612
- addedNdcDetailId.current = addedNdcDetailId.current + 1;
24641
+ var ndcActionId = ++addedNdcDetailId.current;
24613
24642
  var newData = {
24614
- key: addedNdcDetailId.current,
24643
+ key: ndcActionId,
24644
+ type: NdcActionType.main,
24615
24645
  startDate: new Date("".concat(Number(range[0]), "-01-24 23:12:00")),
24616
24646
  endDate: new Date("".concat(Number(range[0]), "-12-24 23:12:00")),
24617
24647
  nationalPlanObj: t("ndc:enterNewPlanTxt"),
24618
24648
  kpi: 0,
24619
24649
  ministry: "Please add the Ministry name",
24650
+ subNdcDetails: [
24651
+ {
24652
+ key: ++addedNdcDetailId.current,
24653
+ ndcActionId: ndcActionId,
24654
+ type: NdcActionType.sub,
24655
+ startDate: new Date("2019-03-25"),
24656
+ endDate: new Date("2020-03-25"),
24657
+ nationalPlanObj: "",
24658
+ kpi: "",
24659
+ ministry: "",
24660
+ },
24661
+ ],
24620
24662
  };
24621
24663
  setNdcDetailsData(__spreadArray(__spreadArray([], ndcDetailsData, true), [newData], false));
24622
24664
  }
@@ -24709,6 +24751,7 @@ var NdcDetailsComponent = function (props) {
24709
24751
  var defaultNdcDetails = [
24710
24752
  {
24711
24753
  key: 1,
24754
+ type: NdcActionType.main,
24712
24755
  startDate: new Date("2019-03-25"),
24713
24756
  endDate: new Date("2020-03-25"),
24714
24757
  nationalPlanObj: "Enhance value addition in key growth opportunities",
@@ -24717,6 +24760,8 @@ var NdcDetailsComponent = function (props) {
24717
24760
  subNdcDetails: [
24718
24761
  {
24719
24762
  key: 6,
24763
+ ndcActionId: 1,
24764
+ type: NdcActionType.sub,
24720
24765
  startDate: new Date("2019-03-25"),
24721
24766
  endDate: new Date("2020-03-25"),
24722
24767
  nationalPlanObj: "Enhance value addition in key growth opportunities sub details",
@@ -24725,6 +24770,8 @@ var NdcDetailsComponent = function (props) {
24725
24770
  },
24726
24771
  {
24727
24772
  key: 7,
24773
+ ndcActionId: 1,
24774
+ type: NdcActionType.sub,
24728
24775
  startDate: new Date("2019-03-25"),
24729
24776
  endDate: new Date("2020-03-25"),
24730
24777
  nationalPlanObj: "",
@@ -24735,6 +24782,7 @@ var NdcDetailsComponent = function (props) {
24735
24782
  },
24736
24783
  {
24737
24784
  key: 2,
24785
+ type: NdcActionType.main,
24738
24786
  startDate: new Date("2019-03-25"),
24739
24787
  endDate: new Date("2019-08-25"),
24740
24788
  nationalPlanObj: "Strengthen the private sector to create 10,000 jobs",
@@ -24743,6 +24791,8 @@ var NdcDetailsComponent = function (props) {
24743
24791
  subNdcDetails: [
24744
24792
  {
24745
24793
  key: 8,
24794
+ ndcActionId: 2,
24795
+ type: NdcActionType.sub,
24746
24796
  startDate: new Date("2019-03-25"),
24747
24797
  endDate: new Date("2020-03-25"),
24748
24798
  nationalPlanObj: "",
@@ -24753,6 +24803,7 @@ var NdcDetailsComponent = function (props) {
24753
24803
  },
24754
24804
  {
24755
24805
  key: 12,
24806
+ type: NdcActionType.main,
24756
24807
  startDate: new Date("2019-03-25"),
24757
24808
  endDate: new Date("2019-08-25"),
24758
24809
  nationalPlanObj: "Other",
@@ -24761,6 +24812,8 @@ var NdcDetailsComponent = function (props) {
24761
24812
  subNdcDetails: [
24762
24813
  {
24763
24814
  key: 8,
24815
+ ndcActionId: 12,
24816
+ type: NdcActionType.sub,
24764
24817
  startDate: new Date("2019-03-25"),
24765
24818
  endDate: new Date("2020-03-25"),
24766
24819
  nationalPlanObj: "",
@@ -24771,6 +24824,7 @@ var NdcDetailsComponent = function (props) {
24771
24824
  },
24772
24825
  {
24773
24826
  key: 3,
24827
+ type: NdcActionType.main,
24774
24828
  startDate: new Date("2021-03-25"),
24775
24829
  endDate: new Date("2022-03-25"),
24776
24830
  nationalPlanObj: "Consolidate and increase the stock and quality of productive infrastructure by 50%",
@@ -24779,6 +24833,8 @@ var NdcDetailsComponent = function (props) {
24779
24833
  subNdcDetails: [
24780
24834
  {
24781
24835
  key: 9,
24836
+ ndcActionId: 3,
24837
+ type: NdcActionType.sub,
24782
24838
  startDate: new Date("2019-03-25"),
24783
24839
  endDate: new Date("2020-03-25"),
24784
24840
  nationalPlanObj: "",
@@ -24789,6 +24845,7 @@ var NdcDetailsComponent = function (props) {
24789
24845
  },
24790
24846
  {
24791
24847
  key: 4,
24848
+ type: NdcActionType.main,
24792
24849
  startDate: new Date("2022-03-25"),
24793
24850
  endDate: new Date("2022-05-25"),
24794
24851
  nationalPlanObj: "Enhance the productivity and social wellbeing of the population",
@@ -24797,6 +24854,8 @@ var NdcDetailsComponent = function (props) {
24797
24854
  subNdcDetails: [
24798
24855
  {
24799
24856
  key: 10,
24857
+ ndcActionId: 4,
24858
+ type: NdcActionType.sub,
24800
24859
  startDate: new Date("2019-03-25"),
24801
24860
  endDate: new Date("2020-03-25"),
24802
24861
  nationalPlanObj: "",
@@ -24807,6 +24866,7 @@ var NdcDetailsComponent = function (props) {
24807
24866
  },
24808
24867
  {
24809
24868
  key: 5,
24869
+ type: NdcActionType.main,
24810
24870
  startDate: new Date("2022-03-25"),
24811
24871
  endDate: new Date("2023-03-25"),
24812
24872
  nationalPlanObj: "Strengthen the role of the state in guiding and facilitating development",
@@ -24815,6 +24875,8 @@ var NdcDetailsComponent = function (props) {
24815
24875
  subNdcDetails: [
24816
24876
  {
24817
24877
  key: 11,
24878
+ ndcActionId: 5,
24879
+ type: NdcActionType.sub,
24818
24880
  startDate: new Date("2019-03-25"),
24819
24881
  endDate: new Date("2020-03-25"),
24820
24882
  nationalPlanObj: "",
@@ -24825,6 +24887,7 @@ var NdcDetailsComponent = function (props) {
24825
24887
  },
24826
24888
  {
24827
24889
  key: 13,
24890
+ type: NdcActionType.main,
24828
24891
  startDate: new Date("2022-03-25"),
24829
24892
  endDate: new Date("2023-03-25"),
24830
24893
  nationalPlanObj: "Other",
@@ -24833,6 +24896,8 @@ var NdcDetailsComponent = function (props) {
24833
24896
  subNdcDetails: [
24834
24897
  {
24835
24898
  key: 11,
24899
+ ndcActionId: 13,
24900
+ type: NdcActionType.sub,
24836
24901
  startDate: new Date("2019-03-25"),
24837
24902
  endDate: new Date("2020-03-25"),
24838
24903
  nationalPlanObj: "",