@undp/carbon-library 1.0.135-CARBON-343.12 → 1.0.135-CARBON-343.13
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.js +33 -22
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +33 -22
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
@@ -23628,7 +23628,7 @@ var css_248z$4 = ".steps-actions {\n display: flex;\n flex-direction: row-reve
|
|
23628
23628
|
styleInject(css_248z$4);
|
23629
23629
|
|
23630
23630
|
var NdcDetailsComponent = function (props) {
|
23631
|
-
var t = props.t; props.useConnection;
|
23631
|
+
var t = props.t; props.useConnection; var useUserContext = props.useUserContext;
|
23632
23632
|
var RangePicker = antd.DatePicker.RangePicker;
|
23633
23633
|
var _a = React.useState([]), ndcDetailsData = _a[0], setNdcDetailsData = _a[1];
|
23634
23634
|
var _b = React.useState(false), loading = _b[0]; _b[1];
|
@@ -23636,6 +23636,16 @@ var NdcDetailsComponent = function (props) {
|
|
23636
23636
|
var _c = React.useState([]), periodItems = _c[0], setPeriodItems = _c[1];
|
23637
23637
|
var _d = React.useState("add_new"), selectedTab = _d[0], setSelectedTab = _d[1];
|
23638
23638
|
var selectedPeriod = React.useRef({});
|
23639
|
+
var userInfoState = useUserContext().userInfoState;
|
23640
|
+
var isAddRangeVisible = function () {
|
23641
|
+
return (((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.MINISTRY ||
|
23642
|
+
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT) &&
|
23643
|
+
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== exports.Role.ViewOnly);
|
23644
|
+
};
|
23645
|
+
var isAddNdcActionVisible = function () {
|
23646
|
+
return ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === exports.CompanyRole.GOVERNMENT &&
|
23647
|
+
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== exports.Role.ViewOnly);
|
23648
|
+
};
|
23639
23649
|
var inRange = function (num, min, max) {
|
23640
23650
|
return num >= min && num <= max;
|
23641
23651
|
};
|
@@ -23785,8 +23795,8 @@ var NdcDetailsComponent = function (props) {
|
|
23785
23795
|
kpi: 25,
|
23786
23796
|
},
|
23787
23797
|
{
|
23788
|
-
startDate: new Date("
|
23789
|
-
endDate: new Date("2019-
|
23798
|
+
startDate: new Date("2019-03-25"),
|
23799
|
+
endDate: new Date("2019-08-25"),
|
23790
23800
|
nationalPlanObj: "Strengthen the private sector to create 10,000 jobs",
|
23791
23801
|
kpi: 10500,
|
23792
23802
|
},
|
@@ -23810,11 +23820,6 @@ var NdcDetailsComponent = function (props) {
|
|
23810
23820
|
},
|
23811
23821
|
];
|
23812
23822
|
var initialPeriods = [
|
23813
|
-
{
|
23814
|
-
key: "add_new",
|
23815
|
-
label: "Add New",
|
23816
|
-
children: addNewPeriodContent(),
|
23817
|
-
},
|
23818
23823
|
{
|
23819
23824
|
key: "2019-2020",
|
23820
23825
|
label: "2019-2020",
|
@@ -23823,18 +23828,22 @@ var NdcDetailsComponent = function (props) {
|
|
23823
23828
|
children: ndcDetailsTableContent(),
|
23824
23829
|
},
|
23825
23830
|
{
|
23826
|
-
key: "
|
23827
|
-
label: "
|
23828
|
-
start:
|
23829
|
-
end:
|
23831
|
+
key: "2021-2023",
|
23832
|
+
label: "2021-2023",
|
23833
|
+
start: 2021,
|
23834
|
+
end: 2021,
|
23830
23835
|
children: ndcDetailsTableContent(),
|
23831
23836
|
},
|
23832
23837
|
];
|
23833
|
-
({
|
23834
|
-
|
23835
|
-
|
23836
|
-
|
23837
|
-
|
23838
|
+
if (isAddRangeVisible()) {
|
23839
|
+
initialPeriods.unshift({
|
23840
|
+
key: "add_new",
|
23841
|
+
label: "Add New",
|
23842
|
+
start: 0,
|
23843
|
+
end: 0,
|
23844
|
+
children: addNewPeriodContent(),
|
23845
|
+
});
|
23846
|
+
}
|
23838
23847
|
setPeriodItems(initialPeriods);
|
23839
23848
|
periodItemsRef.current = initialPeriods;
|
23840
23849
|
setNdcDetailsData(defaultNdcDetails);
|
@@ -23849,11 +23858,13 @@ var NdcDetailsComponent = function (props) {
|
|
23849
23858
|
React.createElement(antd.Tabs, { centered: false, defaultActiveKey: "1", items: periodItems, activeKey: selectedTab, onChange: onTabChange })),
|
23850
23859
|
selectedTab !== "add_new" && (React.createElement("div", null,
|
23851
23860
|
React.createElement("div", null,
|
23852
|
-
React.createElement(antd.Table, { components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: getNdcDetailsForPeriod(), columns: columns, footer: function () {
|
23853
|
-
React.createElement(antd.
|
23854
|
-
|
23855
|
-
|
23856
|
-
|
23861
|
+
React.createElement(antd.Table, { components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: getNdcDetailsForPeriod(), columns: columns, footer: function () {
|
23862
|
+
return isAddNdcActionVisible() && (React.createElement(antd.Row, { justify: "center" },
|
23863
|
+
React.createElement(antd.Button, { onClick: onAddNewNdcDetail, type: "default", style: {
|
23864
|
+
marginBottom: 16,
|
23865
|
+
width: "100%",
|
23866
|
+
} }, t("ndc:addNdcAction"))));
|
23867
|
+
} }))))));
|
23857
23868
|
};
|
23858
23869
|
|
23859
23870
|
var ImgWithFallback = function (_a) {
|