@undp/carbon-library 1.0.150-CARBON-343.5 → 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 +75 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/Components/Common/AntComponents/antTableComponents.d.ts +1 -1
- package/dist/esm/index.js +75 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/Components/Common/AntComponents/antTableComponents.d.ts +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
@@ -24475,7 +24475,7 @@ var EditableCell = function (_a) {
|
|
24475
24475
|
return [3 /*break*/, 3];
|
24476
24476
|
case 2:
|
24477
24477
|
errInfo_1 = _a.sent();
|
24478
|
-
console.log(
|
24478
|
+
console.log("Save failed:", errInfo_1);
|
24479
24479
|
return [3 /*break*/, 3];
|
24480
24480
|
case 3: return [2 /*return*/];
|
24481
24481
|
}
|
@@ -24489,7 +24489,7 @@ var EditableCell = function (_a) {
|
|
24489
24489
|
message: "".concat(title, " is required."),
|
24490
24490
|
},
|
24491
24491
|
] },
|
24492
|
-
React.createElement(Input, { ref: inputRef, onPressEnter: save, onBlur: save }))) : (React.createElement("div", { className: "editable-cell-value-wrap", style: { paddingRight: 24 }, onClick: toggleEdit }, children));
|
24492
|
+
React.createElement(Input, { ref: inputRef, onPressEnter: save, onBlur: save }))) : (React.createElement("div", { className: "editable-cell-value-wrap", style: { paddingRight: 24, minWidth: "100px", minHeight: "20px" }, onClick: toggleEdit }, children));
|
24493
24493
|
}
|
24494
24494
|
return React.createElement("td", __assign({}, restProps), childNode);
|
24495
24495
|
};
|
@@ -24497,6 +24497,11 @@ var EditableCell = function (_a) {
|
|
24497
24497
|
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";
|
24498
24498
|
styleInject(css_248z$4);
|
24499
24499
|
|
24500
|
+
var NdcActionType;
|
24501
|
+
(function (NdcActionType) {
|
24502
|
+
NdcActionType[NdcActionType["main"] = 0] = "main";
|
24503
|
+
NdcActionType[NdcActionType["sub"] = 1] = "sub";
|
24504
|
+
})(NdcActionType || (NdcActionType = {}));
|
24500
24505
|
var NdcDetailsComponent = function (props) {
|
24501
24506
|
var t = props.t; props.useConnection; var useUserContext = props.useUserContext;
|
24502
24507
|
var RangePicker = DatePicker.RangePicker;
|
@@ -24508,7 +24513,7 @@ var NdcDetailsComponent = function (props) {
|
|
24508
24513
|
var selectedPeriod = useRef({});
|
24509
24514
|
var addedNdcDetailId = useRef(0);
|
24510
24515
|
var selectedNdcDetail = useRef({});
|
24511
|
-
var _e = useState(0), tableKey = _e[0]
|
24516
|
+
var _e = useState(0), tableKey = _e[0], setTableKey = _e[1];
|
24512
24517
|
var userInfoState = useUserContext().userInfoState;
|
24513
24518
|
var isAddRangeVisible = function () {
|
24514
24519
|
return (((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY ||
|
@@ -24523,11 +24528,35 @@ var NdcDetailsComponent = function (props) {
|
|
24523
24528
|
return num >= min && num <= max;
|
24524
24529
|
};
|
24525
24530
|
var handleSave = function (row) {
|
24526
|
-
|
24527
|
-
|
24528
|
-
|
24529
|
-
|
24530
|
-
|
24531
|
+
if (row.type === NdcActionType.main) {
|
24532
|
+
var newData = __spreadArray([], ndcDetailsData, true);
|
24533
|
+
var index = newData.findIndex(function (item) { return row.key === item.key; });
|
24534
|
+
var item = newData[index];
|
24535
|
+
newData.splice(index, 1, __assign(__assign({}, item), row));
|
24536
|
+
setNdcDetailsData(newData);
|
24537
|
+
}
|
24538
|
+
else {
|
24539
|
+
var newData = __spreadArray([], ndcDetailsData, true);
|
24540
|
+
var parentIndex = newData.findIndex(function (item) { return row.ndcActionId === item.key; });
|
24541
|
+
var parentItem = newData[parentIndex];
|
24542
|
+
if (parentItem) {
|
24543
|
+
if (parentItem.subNdcDetails) {
|
24544
|
+
var itemIndex = parentItem.subNdcDetails.findIndex(function (item) { return row.key === item.key; });
|
24545
|
+
if (itemIndex === -1) {
|
24546
|
+
parentItem.subNdcDetails.push(row);
|
24547
|
+
}
|
24548
|
+
else {
|
24549
|
+
parentItem.subNdcDetails.splice(itemIndex, 1, __assign({}, row));
|
24550
|
+
}
|
24551
|
+
}
|
24552
|
+
else {
|
24553
|
+
parentItem.subNdcDetails = [row];
|
24554
|
+
}
|
24555
|
+
}
|
24556
|
+
newData.splice(parentIndex, 1, __assign({}, parentItem));
|
24557
|
+
setNdcDetailsData(newData);
|
24558
|
+
setTableKey(function (key) { return key + 1; });
|
24559
|
+
}
|
24531
24560
|
};
|
24532
24561
|
var getNdcDetailsForPeriod = function () {
|
24533
24562
|
var range = selectedTab.split("-");
|
@@ -24589,14 +24618,27 @@ var NdcDetailsComponent = function (props) {
|
|
24589
24618
|
});
|
24590
24619
|
function onAddNewNdcDetail() {
|
24591
24620
|
var range = selectedTab.split("-");
|
24592
|
-
|
24621
|
+
var ndcActionId = ++addedNdcDetailId.current;
|
24593
24622
|
var newData = {
|
24594
|
-
key:
|
24623
|
+
key: ndcActionId,
|
24624
|
+
type: NdcActionType.main,
|
24595
24625
|
startDate: new Date("".concat(Number(range[0]), "-01-24 23:12:00")),
|
24596
24626
|
endDate: new Date("".concat(Number(range[0]), "-12-24 23:12:00")),
|
24597
24627
|
nationalPlanObj: t("ndc:enterNewPlanTxt"),
|
24598
24628
|
kpi: 0,
|
24599
24629
|
ministry: "Please add the Ministry name",
|
24630
|
+
subNdcDetails: [
|
24631
|
+
{
|
24632
|
+
key: ++addedNdcDetailId.current,
|
24633
|
+
ndcActionId: ndcActionId,
|
24634
|
+
type: NdcActionType.sub,
|
24635
|
+
startDate: new Date("2019-03-25"),
|
24636
|
+
endDate: new Date("2020-03-25"),
|
24637
|
+
nationalPlanObj: "",
|
24638
|
+
kpi: "",
|
24639
|
+
ministry: "",
|
24640
|
+
},
|
24641
|
+
],
|
24600
24642
|
};
|
24601
24643
|
setNdcDetailsData(__spreadArray(__spreadArray([], ndcDetailsData, true), [newData], false));
|
24602
24644
|
}
|
@@ -24689,6 +24731,7 @@ var NdcDetailsComponent = function (props) {
|
|
24689
24731
|
var defaultNdcDetails = [
|
24690
24732
|
{
|
24691
24733
|
key: 1,
|
24734
|
+
type: NdcActionType.main,
|
24692
24735
|
startDate: new Date("2019-03-25"),
|
24693
24736
|
endDate: new Date("2020-03-25"),
|
24694
24737
|
nationalPlanObj: "Enhance value addition in key growth opportunities",
|
@@ -24697,6 +24740,8 @@ var NdcDetailsComponent = function (props) {
|
|
24697
24740
|
subNdcDetails: [
|
24698
24741
|
{
|
24699
24742
|
key: 6,
|
24743
|
+
ndcActionId: 1,
|
24744
|
+
type: NdcActionType.sub,
|
24700
24745
|
startDate: new Date("2019-03-25"),
|
24701
24746
|
endDate: new Date("2020-03-25"),
|
24702
24747
|
nationalPlanObj: "Enhance value addition in key growth opportunities sub details",
|
@@ -24705,6 +24750,8 @@ var NdcDetailsComponent = function (props) {
|
|
24705
24750
|
},
|
24706
24751
|
{
|
24707
24752
|
key: 7,
|
24753
|
+
ndcActionId: 1,
|
24754
|
+
type: NdcActionType.sub,
|
24708
24755
|
startDate: new Date("2019-03-25"),
|
24709
24756
|
endDate: new Date("2020-03-25"),
|
24710
24757
|
nationalPlanObj: "",
|
@@ -24715,6 +24762,7 @@ var NdcDetailsComponent = function (props) {
|
|
24715
24762
|
},
|
24716
24763
|
{
|
24717
24764
|
key: 2,
|
24765
|
+
type: NdcActionType.main,
|
24718
24766
|
startDate: new Date("2019-03-25"),
|
24719
24767
|
endDate: new Date("2019-08-25"),
|
24720
24768
|
nationalPlanObj: "Strengthen the private sector to create 10,000 jobs",
|
@@ -24723,6 +24771,8 @@ var NdcDetailsComponent = function (props) {
|
|
24723
24771
|
subNdcDetails: [
|
24724
24772
|
{
|
24725
24773
|
key: 8,
|
24774
|
+
ndcActionId: 2,
|
24775
|
+
type: NdcActionType.sub,
|
24726
24776
|
startDate: new Date("2019-03-25"),
|
24727
24777
|
endDate: new Date("2020-03-25"),
|
24728
24778
|
nationalPlanObj: "",
|
@@ -24733,6 +24783,7 @@ var NdcDetailsComponent = function (props) {
|
|
24733
24783
|
},
|
24734
24784
|
{
|
24735
24785
|
key: 12,
|
24786
|
+
type: NdcActionType.main,
|
24736
24787
|
startDate: new Date("2019-03-25"),
|
24737
24788
|
endDate: new Date("2019-08-25"),
|
24738
24789
|
nationalPlanObj: "Other",
|
@@ -24741,6 +24792,8 @@ var NdcDetailsComponent = function (props) {
|
|
24741
24792
|
subNdcDetails: [
|
24742
24793
|
{
|
24743
24794
|
key: 8,
|
24795
|
+
ndcActionId: 12,
|
24796
|
+
type: NdcActionType.sub,
|
24744
24797
|
startDate: new Date("2019-03-25"),
|
24745
24798
|
endDate: new Date("2020-03-25"),
|
24746
24799
|
nationalPlanObj: "",
|
@@ -24751,6 +24804,7 @@ var NdcDetailsComponent = function (props) {
|
|
24751
24804
|
},
|
24752
24805
|
{
|
24753
24806
|
key: 3,
|
24807
|
+
type: NdcActionType.main,
|
24754
24808
|
startDate: new Date("2021-03-25"),
|
24755
24809
|
endDate: new Date("2022-03-25"),
|
24756
24810
|
nationalPlanObj: "Consolidate and increase the stock and quality of productive infrastructure by 50%",
|
@@ -24759,6 +24813,8 @@ var NdcDetailsComponent = function (props) {
|
|
24759
24813
|
subNdcDetails: [
|
24760
24814
|
{
|
24761
24815
|
key: 9,
|
24816
|
+
ndcActionId: 3,
|
24817
|
+
type: NdcActionType.sub,
|
24762
24818
|
startDate: new Date("2019-03-25"),
|
24763
24819
|
endDate: new Date("2020-03-25"),
|
24764
24820
|
nationalPlanObj: "",
|
@@ -24769,6 +24825,7 @@ var NdcDetailsComponent = function (props) {
|
|
24769
24825
|
},
|
24770
24826
|
{
|
24771
24827
|
key: 4,
|
24828
|
+
type: NdcActionType.main,
|
24772
24829
|
startDate: new Date("2022-03-25"),
|
24773
24830
|
endDate: new Date("2022-05-25"),
|
24774
24831
|
nationalPlanObj: "Enhance the productivity and social wellbeing of the population",
|
@@ -24777,6 +24834,8 @@ var NdcDetailsComponent = function (props) {
|
|
24777
24834
|
subNdcDetails: [
|
24778
24835
|
{
|
24779
24836
|
key: 10,
|
24837
|
+
ndcActionId: 4,
|
24838
|
+
type: NdcActionType.sub,
|
24780
24839
|
startDate: new Date("2019-03-25"),
|
24781
24840
|
endDate: new Date("2020-03-25"),
|
24782
24841
|
nationalPlanObj: "",
|
@@ -24787,6 +24846,7 @@ var NdcDetailsComponent = function (props) {
|
|
24787
24846
|
},
|
24788
24847
|
{
|
24789
24848
|
key: 5,
|
24849
|
+
type: NdcActionType.main,
|
24790
24850
|
startDate: new Date("2022-03-25"),
|
24791
24851
|
endDate: new Date("2023-03-25"),
|
24792
24852
|
nationalPlanObj: "Strengthen the role of the state in guiding and facilitating development",
|
@@ -24795,6 +24855,8 @@ var NdcDetailsComponent = function (props) {
|
|
24795
24855
|
subNdcDetails: [
|
24796
24856
|
{
|
24797
24857
|
key: 11,
|
24858
|
+
ndcActionId: 5,
|
24859
|
+
type: NdcActionType.sub,
|
24798
24860
|
startDate: new Date("2019-03-25"),
|
24799
24861
|
endDate: new Date("2020-03-25"),
|
24800
24862
|
nationalPlanObj: "",
|
@@ -24805,6 +24867,7 @@ var NdcDetailsComponent = function (props) {
|
|
24805
24867
|
},
|
24806
24868
|
{
|
24807
24869
|
key: 13,
|
24870
|
+
type: NdcActionType.main,
|
24808
24871
|
startDate: new Date("2022-03-25"),
|
24809
24872
|
endDate: new Date("2023-03-25"),
|
24810
24873
|
nationalPlanObj: "Other",
|
@@ -24813,6 +24876,8 @@ var NdcDetailsComponent = function (props) {
|
|
24813
24876
|
subNdcDetails: [
|
24814
24877
|
{
|
24815
24878
|
key: 11,
|
24879
|
+
ndcActionId: 13,
|
24880
|
+
type: NdcActionType.sub,
|
24816
24881
|
startDate: new Date("2019-03-25"),
|
24817
24882
|
endDate: new Date("2020-03-25"),
|
24818
24883
|
nationalPlanObj: "",
|