@undp/carbon-library 2.1.13-PAN-1.8 → 2.1.13-PAN-1.10

Sign up to get free protection for your applications and to get access to all the features.
package/dist/cjs/index.js CHANGED
@@ -20413,22 +20413,21 @@ var enablementTypesAndValues = [
20413
20413
  ];
20414
20414
 
20415
20415
  var NdcActionDetails = function (props) {
20416
- var _a, _b, _c, _d;
20417
20416
  var isBackBtnVisible = props.isBackBtnVisible, onFormSubmit = props.onFormSubmit, ndcActionDetails = props.ndcActionDetails, translator = props.translator, programmeDetails = props.programmeDetails, onClickedBackBtn = props.onClickedBackBtn;
20418
20417
  translator.setDefaultNamespace("ndcAction");
20419
20418
  var t = translator.t;
20420
- var _e = React.useState(), ndcActionType = _e[0], setNdcActionType = _e[1];
20421
- var _f = React.useState(), methodology = _f[0], setMethodology = _f[1];
20422
- var _g = React.useState(), mitigationType = _g[0], setmitigationType = _g[1];
20423
- var _h = React.useState(""), mitigationSubType = _h[0], setMitigationSubType = _h[1];
20424
- var _j = React.useState(""), sector = _j[0], setSector = _j[1];
20425
- var _k = React.useState(""), subSector = _k[0], setSubSector = _k[1];
20426
- var _l = React.useState(ndcActionTypeList), ndcActionTypeListFiltered = _l[0]; _l[1];
20427
- var _m = React.useState([]), checkedOptionsGhgReduced = _m[0], setCheckedOptionsGhgReduced = _m[1];
20428
- var _o = React.useState([]), checkedOptionsGhgAvoided = _o[0], setCheckedOptionsGhgAvoided = _o[1];
20429
- var _p = React.useState(), inputNumberValueGhgAvoidedGas = _p[0], setInputNumberValueGhgAvoidedGas = _p[1];
20430
- var _q = React.useState(), inputNumberValueGhgReducedGas = _q[0], setInputNumberValueGhgReducedGas = _q[1];
20431
- var _r = React.useState(), includedInNAP = _r[0], setIncludedInNAP = _r[1];
20419
+ var _a = React.useState(), ndcActionType = _a[0], setNdcActionType = _a[1];
20420
+ var _b = React.useState(), methodology = _b[0], setMethodology = _b[1];
20421
+ var _c = React.useState(), mitigationType = _c[0], setmitigationType = _c[1];
20422
+ var _d = React.useState(""), mitigationSubType = _d[0], setMitigationSubType = _d[1];
20423
+ var _e = React.useState(""), sector = _e[0], setSector = _e[1];
20424
+ var _f = React.useState(""), subSector = _f[0], setSubSector = _f[1];
20425
+ var _g = React.useState(ndcActionTypeList), ndcActionTypeListFiltered = _g[0]; _g[1];
20426
+ var _h = React.useState([]), checkedOptionsGhgReduced = _h[0], setCheckedOptionsGhgReduced = _h[1];
20427
+ var _j = React.useState([]), checkedOptionsGhgAvoided = _j[0], setCheckedOptionsGhgAvoided = _j[1];
20428
+ var _k = React.useState(), inputNumberValueGhgAvoidedGas = _k[0], setInputNumberValueGhgAvoidedGas = _k[1];
20429
+ var _l = React.useState(), inputNumberValueGhgReducedGas = _l[0], setInputNumberValueGhgReducedGas = _l[1];
20430
+ var _m = React.useState(), includedInNAP = _m[0], setIncludedInNAP = _m[1];
20432
20431
  var form = antd.Form.useForm()[0];
20433
20432
  var maximumImageSize = process.env.REACT_APP_MAXIMUM_FILE_SIZE
20434
20433
  ? parseInt(process.env.REACT_APP_MAXIMUM_FILE_SIZE)
@@ -20436,9 +20435,26 @@ var NdcActionDetails = function (props) {
20436
20435
  //changing value to N2O. Previously it was N20(N-Two-Zero)
20437
20436
  var ghgEmissionsGas = ["CO2", "CH4", "N2O", "HFCs", "PFCs", "SF6"];
20438
20437
  React.useEffect(function () {
20438
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
20439
20439
  if (programmeDetails) {
20440
20440
  setSector(programmeDetails === null || programmeDetails === void 0 ? void 0 : programmeDetails.sector);
20441
20441
  setSubSector(programmeDetails === null || programmeDetails === void 0 ? void 0 : programmeDetails.sectoralScope);
20442
+ if (!ndcActionDetails) {
20443
+ console.log("Programme Details later changes : ->>>>>>>>>>>>>>>>>>>>>> ", sectorMitigationTypesListMapped[sector]
20444
+ ? (_c = (_b = (_a = sectorMitigationTypesListMapped[sector]) === null || _a === void 0 ? void 0 : _a.find(function (item) { return item.label === sector; })) === null || _b === void 0 ? void 0 : _b.label) !== null && _c !== void 0 ? _c : ""
20445
+ : "", mitigationSubTypesListMapped[subSector]
20446
+ ? (_e = (_d = mitigationSubTypesListMapped[subSector]) === null || _d === void 0 ? void 0 : _d.find(function (item) { return item.label === subSector; })) === null || _e === void 0 ? void 0 : _e.label
20447
+ : "");
20448
+ console.log("Other detail 115 ------------- > ", programmeDetails);
20449
+ form.setFieldsValue({
20450
+ mitigationType: sectorMitigationTypesListMapped[sector]
20451
+ ? (_h = (_g = (_f = sectorMitigationTypesListMapped[sector]) === null || _f === void 0 ? void 0 : _f.find(function (item) { return item.label === sector; })) === null || _g === void 0 ? void 0 : _g.label) !== null && _h !== void 0 ? _h : ""
20452
+ : "",
20453
+ mitigationSubType: mitigationSubTypesListMapped[subSector]
20454
+ ? (_k = (_j = mitigationSubTypesListMapped[subSector]) === null || _j === void 0 ? void 0 : _j.find(function (item) { return item.label === subSector; })) === null || _k === void 0 ? void 0 : _k.label
20455
+ : "",
20456
+ });
20457
+ }
20442
20458
  }
20443
20459
  }, [programmeDetails]);
20444
20460
  React.useEffect(function () {
@@ -20834,7 +20850,15 @@ var NdcActionDetails = function (props) {
20834
20850
  ndcActionType === exports.NdcActionTypes.CrossCutting) && (React.createElement(React.Fragment, null,
20835
20851
  React.createElement(antd.Row, { justify: "start", align: "middle" },
20836
20852
  React.createElement(antd.Col, null,
20837
- React.createElement(antd.Form.Item, { label: t("ndcAction:mitigationType"), name: "mitigationType", rules: [
20853
+ React.createElement(antd.Form.Item, { label: t("ndcAction:mitigationType"),
20854
+ // initialValue={
20855
+ // sectorMitigationTypesListMapped[sector]
20856
+ // ? sectorMitigationTypesListMapped[sector]?.find(
20857
+ // (item: any) => item.label === sector
20858
+ // )?.label ?? ""
20859
+ // : ""
20860
+ // }
20861
+ name: "mitigationType", rules: [
20838
20862
  {
20839
20863
  required: true,
20840
20864
  message: "".concat(t("ndcAction:mitigationType"), " ").concat(t("ndcAction:isRequired")),
@@ -20847,22 +20871,20 @@ var NdcActionDetails = function (props) {
20847
20871
  (programmeDetails === null || programmeDetails === void 0 ? void 0 : programmeDetails.sector) === exports.Sector.Education ||
20848
20872
  (programmeDetails === null || programmeDetails === void 0 ? void 0 : programmeDetails.sector) === exports.Sector.Hospitality
20849
20873
  ? mitigationTypeList
20850
- : sectorMitigationTypesListMapped[sector],
20851
- // defaultValue={
20852
- // sectorMitigationTypesListMapped[sector]
20853
- // ? sectorMitigationTypesListMapped[sector]?.find(
20854
- // (item: any) => item.label === sector
20855
- // )?.label ?? ""
20856
- // : ""
20857
- // }
20858
- value: sectorMitigationTypesListMapped[sector]
20859
- ? (_b = (_a = sectorMitigationTypesListMapped[sector]) === null || _a === void 0 ? void 0 : _a.find(function (item) { return item.label === sector; })) !== null && _b !== void 0 ? _b : { value: "", label: "" }
20860
- : { value: "", label: "" } }))),
20874
+ : sectorMitigationTypesListMapped[sector] }))),
20861
20875
  (ndcActionType === exports.NdcActionTypes.Mitigation ||
20862
20876
  ndcActionType === exports.NdcActionTypes.CrossCutting) &&
20863
20877
  mitigationType &&
20864
20878
  mitigationSubTypesListMapped[mitigationType] && (React.createElement(antd.Col, { style: { marginLeft: "38px" } },
20865
- React.createElement(antd.Form.Item, { label: t("ndcAction:mitigationSubType"), name: "mitigationSubType", rules: [
20879
+ React.createElement(antd.Form.Item, { label: t("ndcAction:mitigationSubType"), name: "mitigationSubType",
20880
+ // initialValue={
20881
+ // mitigationSubTypesListMapped[subSector]
20882
+ // ? mitigationSubTypesListMapped[subSector]?.find(
20883
+ // (item: any) => item.label === subSector
20884
+ // )?.label
20885
+ // : ""
20886
+ // }
20887
+ rules: [
20866
20888
  {
20867
20889
  required: true,
20868
20890
  message: "".concat(t("ndcAction:mitigationSubType"), " ").concat(t("ndcAction:isRequired")),
@@ -20871,13 +20893,7 @@ var NdcActionDetails = function (props) {
20871
20893
  React.createElement(antd.Select, { size: "large", onChange: handleMitigationSubTypeChange, style: {
20872
20894
  width: "249px",
20873
20895
  borderRadius: "4px",
20874
- }, options: mitigationSubTypesListMapped[mitigationType], value: mitigationSubType ||
20875
- ((_d = (mitigationSubTypesListMapped[subSector]
20876
- ? (_c = mitigationSubTypesListMapped[subSector]) === null || _c === void 0 ? void 0 : _c.find(function (item) { return item.label === subSector; })
20877
- : { value: "", label: "" })) !== null && _d !== void 0 ? _d : {
20878
- value: "",
20879
- label: "",
20880
- }) }))))),
20896
+ }, options: mitigationSubTypesListMapped[mitigationType] }))))),
20881
20897
  React.createElement(antd.Row, { justify: "start", align: "middle" },
20882
20898
  React.createElement(antd.Col, { span: 20 },
20883
20899
  React.createElement(antd.Form.Item, { label: t("ndcAction:methodology"), name: "methodology", rules: [