@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/esm/index.js CHANGED
@@ -20392,22 +20392,21 @@ var enablementTypesAndValues = [
20392
20392
  ];
20393
20393
 
20394
20394
  var NdcActionDetails = function (props) {
20395
- var _a, _b, _c, _d;
20396
20395
  var isBackBtnVisible = props.isBackBtnVisible, onFormSubmit = props.onFormSubmit, ndcActionDetails = props.ndcActionDetails, translator = props.translator, programmeDetails = props.programmeDetails, onClickedBackBtn = props.onClickedBackBtn;
20397
20396
  translator.setDefaultNamespace("ndcAction");
20398
20397
  var t = translator.t;
20399
- var _e = useState(), ndcActionType = _e[0], setNdcActionType = _e[1];
20400
- var _f = useState(), methodology = _f[0], setMethodology = _f[1];
20401
- var _g = useState(), mitigationType = _g[0], setmitigationType = _g[1];
20402
- var _h = useState(""), mitigationSubType = _h[0], setMitigationSubType = _h[1];
20403
- var _j = useState(""), sector = _j[0], setSector = _j[1];
20404
- var _k = useState(""), subSector = _k[0], setSubSector = _k[1];
20405
- var _l = useState(ndcActionTypeList), ndcActionTypeListFiltered = _l[0]; _l[1];
20406
- var _m = useState([]), checkedOptionsGhgReduced = _m[0], setCheckedOptionsGhgReduced = _m[1];
20407
- var _o = useState([]), checkedOptionsGhgAvoided = _o[0], setCheckedOptionsGhgAvoided = _o[1];
20408
- var _p = useState(), inputNumberValueGhgAvoidedGas = _p[0], setInputNumberValueGhgAvoidedGas = _p[1];
20409
- var _q = useState(), inputNumberValueGhgReducedGas = _q[0], setInputNumberValueGhgReducedGas = _q[1];
20410
- var _r = useState(), includedInNAP = _r[0], setIncludedInNAP = _r[1];
20398
+ var _a = useState(), ndcActionType = _a[0], setNdcActionType = _a[1];
20399
+ var _b = useState(), methodology = _b[0], setMethodology = _b[1];
20400
+ var _c = useState(), mitigationType = _c[0], setmitigationType = _c[1];
20401
+ var _d = useState(""), mitigationSubType = _d[0], setMitigationSubType = _d[1];
20402
+ var _e = useState(""), sector = _e[0], setSector = _e[1];
20403
+ var _f = useState(""), subSector = _f[0], setSubSector = _f[1];
20404
+ var _g = useState(ndcActionTypeList), ndcActionTypeListFiltered = _g[0]; _g[1];
20405
+ var _h = useState([]), checkedOptionsGhgReduced = _h[0], setCheckedOptionsGhgReduced = _h[1];
20406
+ var _j = useState([]), checkedOptionsGhgAvoided = _j[0], setCheckedOptionsGhgAvoided = _j[1];
20407
+ var _k = useState(), inputNumberValueGhgAvoidedGas = _k[0], setInputNumberValueGhgAvoidedGas = _k[1];
20408
+ var _l = useState(), inputNumberValueGhgReducedGas = _l[0], setInputNumberValueGhgReducedGas = _l[1];
20409
+ var _m = useState(), includedInNAP = _m[0], setIncludedInNAP = _m[1];
20411
20410
  var form = Form.useForm()[0];
20412
20411
  var maximumImageSize = process.env.REACT_APP_MAXIMUM_FILE_SIZE
20413
20412
  ? parseInt(process.env.REACT_APP_MAXIMUM_FILE_SIZE)
@@ -20415,9 +20414,26 @@ var NdcActionDetails = function (props) {
20415
20414
  //changing value to N2O. Previously it was N20(N-Two-Zero)
20416
20415
  var ghgEmissionsGas = ["CO2", "CH4", "N2O", "HFCs", "PFCs", "SF6"];
20417
20416
  useEffect(function () {
20417
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
20418
20418
  if (programmeDetails) {
20419
20419
  setSector(programmeDetails === null || programmeDetails === void 0 ? void 0 : programmeDetails.sector);
20420
20420
  setSubSector(programmeDetails === null || programmeDetails === void 0 ? void 0 : programmeDetails.sectoralScope);
20421
+ if (!ndcActionDetails) {
20422
+ console.log("Programme Details later changes : ->>>>>>>>>>>>>>>>>>>>>> ", sectorMitigationTypesListMapped[sector]
20423
+ ? (_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 : ""
20424
+ : "", mitigationSubTypesListMapped[subSector]
20425
+ ? (_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
20426
+ : "");
20427
+ console.log("Other detail 115 ------------- > ", programmeDetails);
20428
+ form.setFieldsValue({
20429
+ mitigationType: sectorMitigationTypesListMapped[sector]
20430
+ ? (_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 : ""
20431
+ : "",
20432
+ mitigationSubType: mitigationSubTypesListMapped[subSector]
20433
+ ? (_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
20434
+ : "",
20435
+ });
20436
+ }
20421
20437
  }
20422
20438
  }, [programmeDetails]);
20423
20439
  useEffect(function () {
@@ -20813,7 +20829,15 @@ var NdcActionDetails = function (props) {
20813
20829
  ndcActionType === NdcActionTypes.CrossCutting) && (React.createElement(React.Fragment, null,
20814
20830
  React.createElement(Row, { justify: "start", align: "middle" },
20815
20831
  React.createElement(Col, null,
20816
- React.createElement(Form.Item, { label: t("ndcAction:mitigationType"), name: "mitigationType", rules: [
20832
+ React.createElement(Form.Item, { label: t("ndcAction:mitigationType"),
20833
+ // initialValue={
20834
+ // sectorMitigationTypesListMapped[sector]
20835
+ // ? sectorMitigationTypesListMapped[sector]?.find(
20836
+ // (item: any) => item.label === sector
20837
+ // )?.label ?? ""
20838
+ // : ""
20839
+ // }
20840
+ name: "mitigationType", rules: [
20817
20841
  {
20818
20842
  required: true,
20819
20843
  message: "".concat(t("ndcAction:mitigationType"), " ").concat(t("ndcAction:isRequired")),
@@ -20826,22 +20850,20 @@ var NdcActionDetails = function (props) {
20826
20850
  (programmeDetails === null || programmeDetails === void 0 ? void 0 : programmeDetails.sector) === Sector.Education ||
20827
20851
  (programmeDetails === null || programmeDetails === void 0 ? void 0 : programmeDetails.sector) === Sector.Hospitality
20828
20852
  ? mitigationTypeList
20829
- : sectorMitigationTypesListMapped[sector],
20830
- // defaultValue={
20831
- // sectorMitigationTypesListMapped[sector]
20832
- // ? sectorMitigationTypesListMapped[sector]?.find(
20833
- // (item: any) => item.label === sector
20834
- // )?.label ?? ""
20835
- // : ""
20836
- // }
20837
- value: sectorMitigationTypesListMapped[sector]
20838
- ? (_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: "" }
20839
- : { value: "", label: "" } }))),
20853
+ : sectorMitigationTypesListMapped[sector] }))),
20840
20854
  (ndcActionType === NdcActionTypes.Mitigation ||
20841
20855
  ndcActionType === NdcActionTypes.CrossCutting) &&
20842
20856
  mitigationType &&
20843
20857
  mitigationSubTypesListMapped[mitigationType] && (React.createElement(Col, { style: { marginLeft: "38px" } },
20844
- React.createElement(Form.Item, { label: t("ndcAction:mitigationSubType"), name: "mitigationSubType", rules: [
20858
+ React.createElement(Form.Item, { label: t("ndcAction:mitigationSubType"), name: "mitigationSubType",
20859
+ // initialValue={
20860
+ // mitigationSubTypesListMapped[subSector]
20861
+ // ? mitigationSubTypesListMapped[subSector]?.find(
20862
+ // (item: any) => item.label === subSector
20863
+ // )?.label
20864
+ // : ""
20865
+ // }
20866
+ rules: [
20845
20867
  {
20846
20868
  required: true,
20847
20869
  message: "".concat(t("ndcAction:mitigationSubType"), " ").concat(t("ndcAction:isRequired")),
@@ -20850,13 +20872,7 @@ var NdcActionDetails = function (props) {
20850
20872
  React.createElement(Select, { size: "large", onChange: handleMitigationSubTypeChange, style: {
20851
20873
  width: "249px",
20852
20874
  borderRadius: "4px",
20853
- }, options: mitigationSubTypesListMapped[mitigationType], value: mitigationSubType ||
20854
- ((_d = (mitigationSubTypesListMapped[subSector]
20855
- ? (_c = mitigationSubTypesListMapped[subSector]) === null || _c === void 0 ? void 0 : _c.find(function (item) { return item.label === subSector; })
20856
- : { value: "", label: "" })) !== null && _d !== void 0 ? _d : {
20857
- value: "",
20858
- label: "",
20859
- }) }))))),
20875
+ }, options: mitigationSubTypesListMapped[mitigationType] }))))),
20860
20876
  React.createElement(Row, { justify: "start", align: "middle" },
20861
20877
  React.createElement(Col, { span: 20 },
20862
20878
  React.createElement(Form.Item, { label: t("ndcAction:methodology"), name: "methodology", rules: [