@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/esm/index.js
CHANGED
@@ -23608,7 +23608,7 @@ var css_248z$4 = ".steps-actions {\n display: flex;\n flex-direction: row-reve
|
|
23608
23608
|
styleInject(css_248z$4);
|
23609
23609
|
|
23610
23610
|
var NdcDetailsComponent = function (props) {
|
23611
|
-
var t = props.t; props.useConnection;
|
23611
|
+
var t = props.t; props.useConnection; var useUserContext = props.useUserContext;
|
23612
23612
|
var RangePicker = DatePicker.RangePicker;
|
23613
23613
|
var _a = useState([]), ndcDetailsData = _a[0], setNdcDetailsData = _a[1];
|
23614
23614
|
var _b = useState(false), loading = _b[0]; _b[1];
|
@@ -23616,6 +23616,16 @@ var NdcDetailsComponent = function (props) {
|
|
23616
23616
|
var _c = useState([]), periodItems = _c[0], setPeriodItems = _c[1];
|
23617
23617
|
var _d = useState("add_new"), selectedTab = _d[0], setSelectedTab = _d[1];
|
23618
23618
|
var selectedPeriod = useRef({});
|
23619
|
+
var userInfoState = useUserContext().userInfoState;
|
23620
|
+
var isAddRangeVisible = function () {
|
23621
|
+
return (((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY ||
|
23622
|
+
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT) &&
|
23623
|
+
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly);
|
23624
|
+
};
|
23625
|
+
var isAddNdcActionVisible = function () {
|
23626
|
+
return ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT &&
|
23627
|
+
(userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly);
|
23628
|
+
};
|
23619
23629
|
var inRange = function (num, min, max) {
|
23620
23630
|
return num >= min && num <= max;
|
23621
23631
|
};
|
@@ -23765,8 +23775,8 @@ var NdcDetailsComponent = function (props) {
|
|
23765
23775
|
kpi: 25,
|
23766
23776
|
},
|
23767
23777
|
{
|
23768
|
-
startDate: new Date("
|
23769
|
-
endDate: new Date("2019-
|
23778
|
+
startDate: new Date("2019-03-25"),
|
23779
|
+
endDate: new Date("2019-08-25"),
|
23770
23780
|
nationalPlanObj: "Strengthen the private sector to create 10,000 jobs",
|
23771
23781
|
kpi: 10500,
|
23772
23782
|
},
|
@@ -23790,11 +23800,6 @@ var NdcDetailsComponent = function (props) {
|
|
23790
23800
|
},
|
23791
23801
|
];
|
23792
23802
|
var initialPeriods = [
|
23793
|
-
{
|
23794
|
-
key: "add_new",
|
23795
|
-
label: "Add New",
|
23796
|
-
children: addNewPeriodContent(),
|
23797
|
-
},
|
23798
23803
|
{
|
23799
23804
|
key: "2019-2020",
|
23800
23805
|
label: "2019-2020",
|
@@ -23803,18 +23808,22 @@ var NdcDetailsComponent = function (props) {
|
|
23803
23808
|
children: ndcDetailsTableContent(),
|
23804
23809
|
},
|
23805
23810
|
{
|
23806
|
-
key: "
|
23807
|
-
label: "
|
23808
|
-
start:
|
23809
|
-
end:
|
23811
|
+
key: "2021-2023",
|
23812
|
+
label: "2021-2023",
|
23813
|
+
start: 2021,
|
23814
|
+
end: 2021,
|
23810
23815
|
children: ndcDetailsTableContent(),
|
23811
23816
|
},
|
23812
23817
|
];
|
23813
|
-
({
|
23814
|
-
|
23815
|
-
|
23816
|
-
|
23817
|
-
|
23818
|
+
if (isAddRangeVisible()) {
|
23819
|
+
initialPeriods.unshift({
|
23820
|
+
key: "add_new",
|
23821
|
+
label: "Add New",
|
23822
|
+
start: 0,
|
23823
|
+
end: 0,
|
23824
|
+
children: addNewPeriodContent(),
|
23825
|
+
});
|
23826
|
+
}
|
23818
23827
|
setPeriodItems(initialPeriods);
|
23819
23828
|
periodItemsRef.current = initialPeriods;
|
23820
23829
|
setNdcDetailsData(defaultNdcDetails);
|
@@ -23829,11 +23838,13 @@ var NdcDetailsComponent = function (props) {
|
|
23829
23838
|
React.createElement(Tabs, { centered: false, defaultActiveKey: "1", items: periodItems, activeKey: selectedTab, onChange: onTabChange })),
|
23830
23839
|
selectedTab !== "add_new" && (React.createElement("div", null,
|
23831
23840
|
React.createElement("div", null,
|
23832
|
-
React.createElement(Table, { components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: getNdcDetailsForPeriod(), columns: columns, footer: function () {
|
23833
|
-
React.createElement(
|
23834
|
-
|
23835
|
-
|
23836
|
-
|
23841
|
+
React.createElement(Table, { components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: getNdcDetailsForPeriod(), columns: columns, footer: function () {
|
23842
|
+
return isAddNdcActionVisible() && (React.createElement(Row, { justify: "center" },
|
23843
|
+
React.createElement(Button, { onClick: onAddNewNdcDetail, type: "default", style: {
|
23844
|
+
marginBottom: 16,
|
23845
|
+
width: "100%",
|
23846
|
+
} }, t("ndc:addNdcAction"))));
|
23847
|
+
} }))))));
|
23837
23848
|
};
|
23838
23849
|
|
23839
23850
|
var ImgWithFallback = function (_a) {
|