@undp/carbon-library 1.0.135-ghg-inventory.12.20 → 1.0.135-ghg-inventory.12.21

Sign up to get free protection for your applications and to get access to all the features.
package/dist/esm/index.js CHANGED
@@ -30235,15 +30235,12 @@ var GHGEmissionsComponent = function (props) {
30235
30235
  if (value && value < 0) {
30236
30236
  throw new Error();
30237
30237
  }
30238
- if (value && !Number.isInteger(value)) {
30239
- throw new Error();
30240
- }
30241
30238
  return [2 /*return*/];
30242
30239
  });
30243
30240
  }); },
30244
30241
  },
30245
30242
  ] },
30246
- React.createElement(InputNumber, { onChange: function (event) { return calculateSumCo2(event, panelHeading); } }))),
30243
+ React.createElement(InputNumber, { onChange: function (event) { return calculateSumCo2(event, panelHeading); }, disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }))),
30247
30244
  React.createElement(Col, { xl: 6 },
30248
30245
  React.createElement(Form.Item, { name: panelHeading + '_' + item + '_ch4', rules: [
30249
30246
  {
@@ -30252,15 +30249,12 @@ var GHGEmissionsComponent = function (props) {
30252
30249
  if (value && value < 0) {
30253
30250
  throw new Error();
30254
30251
  }
30255
- if (value && !Number.isInteger(value)) {
30256
- throw new Error();
30257
- }
30258
30252
  return [2 /*return*/];
30259
30253
  });
30260
30254
  }); },
30261
30255
  },
30262
30256
  ] },
30263
- React.createElement(InputNumber, { onChange: function (event) { return calculateSumCh4(event, panelHeading); } }))),
30257
+ React.createElement(InputNumber, { onChange: function (event) { return calculateSumCh4(event, panelHeading); }, disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }))),
30264
30258
  React.createElement(Col, { xl: 6 },
30265
30259
  React.createElement(Form.Item, { name: panelHeading + '_' + item + '_n2o', rules: [
30266
30260
  {
@@ -30269,15 +30263,12 @@ var GHGEmissionsComponent = function (props) {
30269
30263
  if (value && value < 0) {
30270
30264
  throw new Error();
30271
30265
  }
30272
- if (value && !Number.isInteger(value)) {
30273
- throw new Error();
30274
- }
30275
30266
  return [2 /*return*/];
30276
30267
  });
30277
30268
  }); },
30278
30269
  },
30279
30270
  ] },
30280
- React.createElement(InputNumber, { onChange: function (event) { return calculateSumN2o(event, panelHeading); } }))),
30271
+ React.createElement(InputNumber, { onChange: function (event) { return calculateSumN2o(event, panelHeading); }, disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }))),
30281
30272
  React.createElement(Col, { xl: 6 },
30282
30273
  React.createElement(Form.Item, { name: panelHeading + '_' + item + '_co2eq', rules: [
30283
30274
  {
@@ -30286,15 +30277,12 @@ var GHGEmissionsComponent = function (props) {
30286
30277
  if (value && value < 0) {
30287
30278
  throw new Error();
30288
30279
  }
30289
- if (value && !Number.isInteger(value)) {
30290
- throw new Error();
30291
- }
30292
30280
  return [2 /*return*/];
30293
30281
  });
30294
30282
  }); },
30295
30283
  },
30296
30284
  ] },
30297
- React.createElement(InputNumber, { onChange: function (event) { return calculateSumCo2Eq(event, panelHeading); } }))))))); };
30285
+ React.createElement(InputNumber, { onChange: function (event) { return calculateSumCo2Eq(event, panelHeading); }, disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }))))))); };
30298
30286
  var renderPanelContentView = function (co2, ch4, n2o, co2eq, item, index) {
30299
30287
  return (React.createElement(Row, { gutter: 16, key: index, className: "panel-content-row" },
30300
30288
  React.createElement(Col, { xl: 12, md: 12, className: "panel-content-title" },
@@ -30475,9 +30463,9 @@ var GHGEmissionsComponent = function (props) {
30475
30463
  // Prevent upload
30476
30464
  return false;
30477
30465
  } },
30478
- React.createElement(Button, { icon: React.createElement(UploadOutlined, null) }, t("ghgInventory:upload"))))),
30466
+ React.createElement(Button, { icon: React.createElement(UploadOutlined, null), disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }, t("ghgInventory:upload"))))),
30479
30467
  React.createElement(Col, { xl: 16, md: 16, className: "add-new-upload-file-name-input" },
30480
- React.createElement(Input, { value: uploadedFileName, readOnly: true, suffix: uploadedFileName && (React.createElement(Button, { onClick: clearUploadDoc, icon: React.createElement(DeleteOutlined, null), style: { marginRight: '-10px', padding: '0px 6px' } })) }))))),
30468
+ React.createElement(Input, { value: uploadedFileName, disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly, readOnly: true, suffix: uploadedFileName && (React.createElement(Button, { onClick: clearUploadDoc, icon: React.createElement(DeleteOutlined, null), style: { marginRight: '-10px', padding: '0px 6px' } })) }))))),
30481
30469
  React.createElement(Row, { gutter: 16 },
30482
30470
  React.createElement(Col, { span: 9, offset: 12 },
30483
30471
  React.createElement(Row, { gutter: 16, className: "table-heading-row" },
@@ -30539,15 +30527,12 @@ var GHGEmissionsComponent = function (props) {
30539
30527
  if (value && value < 0) {
30540
30528
  throw new Error();
30541
30529
  }
30542
- if (value && !Number.isInteger(value)) {
30543
- throw new Error();
30544
- }
30545
30530
  return [2 /*return*/];
30546
30531
  });
30547
30532
  }); },
30548
30533
  },
30549
30534
  ] },
30550
- React.createElement(InputNumber, null))),
30535
+ React.createElement(InputNumber, { disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }))),
30551
30536
  React.createElement(Col, { xl: 6 },
30552
30537
  React.createElement(Form.Item, { name: "totalCo2WithoutLand_ch4", rules: [
30553
30538
  {
@@ -30556,15 +30541,12 @@ var GHGEmissionsComponent = function (props) {
30556
30541
  if (value && value < 0) {
30557
30542
  throw new Error();
30558
30543
  }
30559
- if (value && !Number.isInteger(value)) {
30560
- throw new Error();
30561
- }
30562
30544
  return [2 /*return*/];
30563
30545
  });
30564
30546
  }); },
30565
30547
  },
30566
30548
  ] },
30567
- React.createElement(InputNumber, null))),
30549
+ React.createElement(InputNumber, { disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }))),
30568
30550
  React.createElement(Col, { xl: 6 },
30569
30551
  React.createElement(Form.Item, { name: "totalCo2WithoutLand_n2o", rules: [
30570
30552
  {
@@ -30573,15 +30555,12 @@ var GHGEmissionsComponent = function (props) {
30573
30555
  if (value && value < 0) {
30574
30556
  throw new Error();
30575
30557
  }
30576
- if (value && !Number.isInteger(value)) {
30577
- throw new Error();
30578
- }
30579
30558
  return [2 /*return*/];
30580
30559
  });
30581
30560
  }); },
30582
30561
  },
30583
30562
  ] },
30584
- React.createElement(InputNumber, null))),
30563
+ React.createElement(InputNumber, { disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }))),
30585
30564
  React.createElement(Col, { xl: 6 },
30586
30565
  React.createElement(Form.Item, { name: "totalCo2WithoutLand_co2eq", rules: [
30587
30566
  {
@@ -30590,15 +30569,12 @@ var GHGEmissionsComponent = function (props) {
30590
30569
  if (value && value < 0) {
30591
30570
  throw new Error();
30592
30571
  }
30593
- if (value && !Number.isInteger(value)) {
30594
- throw new Error();
30595
- }
30596
30572
  return [2 /*return*/];
30597
30573
  });
30598
30574
  }); },
30599
30575
  },
30600
30576
  ] },
30601
- React.createElement(InputNumber, null)))))),
30577
+ React.createElement(InputNumber, { disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly })))))),
30602
30578
  React.createElement(Row, { gutter: 16, key: 'totalCo2WithLand', className: "total-co2-with-land-row" },
30603
30579
  React.createElement(Col, { xl: 12, md: 12, className: "total-co2-with-land-title" },
30604
30580
  React.createElement("span", null, t("ghgInventory:totalCo2WithLand"))),
@@ -30612,15 +30588,12 @@ var GHGEmissionsComponent = function (props) {
30612
30588
  if (value && value < 0) {
30613
30589
  throw new Error();
30614
30590
  }
30615
- if (value && !Number.isInteger(value)) {
30616
- throw new Error();
30617
- }
30618
30591
  return [2 /*return*/];
30619
30592
  });
30620
30593
  }); },
30621
30594
  },
30622
30595
  ] },
30623
- React.createElement(InputNumber, null))),
30596
+ React.createElement(InputNumber, { disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }))),
30624
30597
  React.createElement(Col, { xl: 6 },
30625
30598
  React.createElement(Form.Item, { name: "totalCo2WithLand_ch4", rules: [
30626
30599
  {
@@ -30629,15 +30602,12 @@ var GHGEmissionsComponent = function (props) {
30629
30602
  if (value && value < 0) {
30630
30603
  throw new Error();
30631
30604
  }
30632
- if (value && !Number.isInteger(value)) {
30633
- throw new Error();
30634
- }
30635
30605
  return [2 /*return*/];
30636
30606
  });
30637
30607
  }); },
30638
30608
  },
30639
30609
  ] },
30640
- React.createElement(InputNumber, null))),
30610
+ React.createElement(InputNumber, { disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }))),
30641
30611
  React.createElement(Col, { xl: 6 },
30642
30612
  React.createElement(Form.Item, { name: "totalCo2WithLand_n2o", rules: [
30643
30613
  {
@@ -30646,15 +30616,12 @@ var GHGEmissionsComponent = function (props) {
30646
30616
  if (value && value < 0) {
30647
30617
  throw new Error();
30648
30618
  }
30649
- if (value && !Number.isInteger(value)) {
30650
- throw new Error();
30651
- }
30652
30619
  return [2 /*return*/];
30653
30620
  });
30654
30621
  }); },
30655
30622
  },
30656
30623
  ] },
30657
- React.createElement(InputNumber, null))),
30624
+ React.createElement(InputNumber, { disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }))),
30658
30625
  React.createElement(Col, { xl: 6 },
30659
30626
  React.createElement(Form.Item, { name: "totalCo2WithLand_co2eq", rules: [
30660
30627
  {
@@ -30663,15 +30630,12 @@ var GHGEmissionsComponent = function (props) {
30663
30630
  if (value && value < 0) {
30664
30631
  throw new Error();
30665
30632
  }
30666
- if (value && !Number.isInteger(value)) {
30667
- throw new Error();
30668
- }
30669
30633
  return [2 /*return*/];
30670
30634
  });
30671
30635
  }); },
30672
30636
  },
30673
30637
  ] },
30674
- React.createElement(InputNumber, null)))))),
30638
+ React.createElement(InputNumber, { disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly })))))),
30675
30639
  (((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT || (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY)
30676
30640
  && ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly)) &&
30677
30641
  (React.createElement("div", { className: "steps-actions" },
@@ -31939,15 +31903,12 @@ var GHGProjectionsComponent = function (props) {
31939
31903
  if (value && value < 0) {
31940
31904
  throw new Error();
31941
31905
  }
31942
- if (value && !Number.isInteger(value)) {
31943
- throw new Error();
31944
- }
31945
31906
  return [2 /*return*/];
31946
31907
  });
31947
31908
  }); },
31948
31909
  },
31949
31910
  ] },
31950
- React.createElement(InputNumber, { onChange: function (event) { return calculateSumBau(event, panelHeading); } }))),
31911
+ React.createElement(InputNumber, { onChange: function (event) { return calculateSumBau(event, panelHeading); }, disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }))),
31951
31912
  React.createElement(Col, { xl: 7 },
31952
31913
  React.createElement(Form.Item, { name: panelHeading + '_' + item + '_conditionalNdc', rules: [
31953
31914
  {
@@ -31956,15 +31917,12 @@ var GHGProjectionsComponent = function (props) {
31956
31917
  if (value && value < 0) {
31957
31918
  throw new Error();
31958
31919
  }
31959
- if (value && !Number.isInteger(value)) {
31960
- throw new Error();
31961
- }
31962
31920
  return [2 /*return*/];
31963
31921
  });
31964
31922
  }); },
31965
31923
  },
31966
31924
  ] },
31967
- React.createElement(InputNumber, { onChange: function (event) { return calculateSumConditionalNdc(event, panelHeading); } }))),
31925
+ React.createElement(InputNumber, { onChange: function (event) { return calculateSumConditionalNdc(event, panelHeading); }, disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }))),
31968
31926
  React.createElement(Col, { xl: 7 },
31969
31927
  React.createElement(Form.Item, { name: panelHeading + '_' + item + '_unconditionalNdc', rules: [
31970
31928
  {
@@ -31973,15 +31931,12 @@ var GHGProjectionsComponent = function (props) {
31973
31931
  if (value && value < 0) {
31974
31932
  throw new Error();
31975
31933
  }
31976
- if (value && !Number.isInteger(value)) {
31977
- throw new Error();
31978
- }
31979
31934
  return [2 /*return*/];
31980
31935
  });
31981
31936
  }); },
31982
31937
  },
31983
31938
  ] },
31984
- React.createElement(InputNumber, { onChange: function (event) { return calculateSumUnconditionalNdc(event, panelHeading); } }))))))); };
31939
+ React.createElement(InputNumber, { onChange: function (event) { return calculateSumUnconditionalNdc(event, panelHeading); }, disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }))))))); };
31985
31940
  var renderPanelContentView = function (bau, conditionalNdc, unconditionalNdc, item, index) {
31986
31941
  return (React.createElement(Row, { gutter: 16, key: index, className: "panel-content-row" },
31987
31942
  React.createElement(Col, { xl: 12, md: 12, className: "panel-content-title" },
@@ -32157,9 +32112,9 @@ var GHGProjectionsComponent = function (props) {
32157
32112
  // Prevent upload
32158
32113
  return false;
32159
32114
  } },
32160
- React.createElement(Button, { icon: React.createElement(UploadOutlined, null) }, t("ghgInventory:upload"))))),
32115
+ React.createElement(Button, { icon: React.createElement(UploadOutlined, null), disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }, t("ghgInventory:upload"))))),
32161
32116
  React.createElement(Col, { xl: 16, md: 16, className: "add-new-upload-file-name-input" },
32162
- React.createElement(Input, { value: uploadedFileName, readOnly: true, suffix: uploadedFileName && (React.createElement(Button, { onClick: clearUploadDoc, icon: React.createElement(DeleteOutlined, null), style: { marginRight: '-10px', padding: '0px 6px' } })) }))))),
32117
+ React.createElement(Input, { value: uploadedFileName, disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly, readOnly: true, suffix: uploadedFileName && (React.createElement(Button, { onClick: clearUploadDoc, icon: React.createElement(DeleteOutlined, null), style: { marginRight: '-10px', padding: '0px 6px' } })) }))))),
32163
32118
  React.createElement(Row, { gutter: 16 },
32164
32119
  React.createElement(Col, { span: 9, offset: 12 },
32165
32120
  React.createElement(Row, { gutter: 16, className: "table-heading-row" },
@@ -32210,15 +32165,12 @@ var GHGProjectionsComponent = function (props) {
32210
32165
  if (value && value < 0) {
32211
32166
  throw new Error();
32212
32167
  }
32213
- if (value && !Number.isInteger(value)) {
32214
- throw new Error();
32215
- }
32216
32168
  return [2 /*return*/];
32217
32169
  });
32218
32170
  }); },
32219
32171
  },
32220
32172
  ] },
32221
- React.createElement(InputNumber, null))),
32173
+ React.createElement(InputNumber, { disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }))),
32222
32174
  React.createElement(Col, { xl: 7 },
32223
32175
  React.createElement(Form.Item, { name: "totalCo2WithoutLand_conditionalNdc", rules: [
32224
32176
  {
@@ -32227,15 +32179,12 @@ var GHGProjectionsComponent = function (props) {
32227
32179
  if (value && value < 0) {
32228
32180
  throw new Error();
32229
32181
  }
32230
- if (value && !Number.isInteger(value)) {
32231
- throw new Error();
32232
- }
32233
32182
  return [2 /*return*/];
32234
32183
  });
32235
32184
  }); },
32236
32185
  },
32237
32186
  ] },
32238
- React.createElement(InputNumber, null))),
32187
+ React.createElement(InputNumber, { disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }))),
32239
32188
  React.createElement(Col, { xl: 7 },
32240
32189
  React.createElement(Form.Item, { name: "totalCo2WithoutLand_unconditionalNdc", rules: [
32241
32190
  {
@@ -32244,15 +32193,12 @@ var GHGProjectionsComponent = function (props) {
32244
32193
  if (value && value < 0) {
32245
32194
  throw new Error();
32246
32195
  }
32247
- if (value && !Number.isInteger(value)) {
32248
- throw new Error();
32249
- }
32250
32196
  return [2 /*return*/];
32251
32197
  });
32252
32198
  }); },
32253
32199
  },
32254
32200
  ] },
32255
- React.createElement(InputNumber, null)))))),
32201
+ React.createElement(InputNumber, { disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly })))))),
32256
32202
  React.createElement(Row, { gutter: 16, key: 'totalCo2WithLand', className: "total-co2-with-land-row" },
32257
32203
  React.createElement(Col, { xl: 12, md: 12, className: "total-co2-with-land-title" },
32258
32204
  React.createElement("span", null, t("ghgInventory:totalCo2WithLand"))),
@@ -32266,15 +32212,12 @@ var GHGProjectionsComponent = function (props) {
32266
32212
  if (value && value < 0) {
32267
32213
  throw new Error();
32268
32214
  }
32269
- if (value && !Number.isInteger(value)) {
32270
- throw new Error();
32271
- }
32272
32215
  return [2 /*return*/];
32273
32216
  });
32274
32217
  }); },
32275
32218
  },
32276
32219
  ] },
32277
- React.createElement(InputNumber, null))),
32220
+ React.createElement(InputNumber, { disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }))),
32278
32221
  React.createElement(Col, { xl: 7 },
32279
32222
  React.createElement(Form.Item, { name: "totalCo2WithLand_conditionalNdc", rules: [
32280
32223
  {
@@ -32283,15 +32226,12 @@ var GHGProjectionsComponent = function (props) {
32283
32226
  if (value && value < 0) {
32284
32227
  throw new Error();
32285
32228
  }
32286
- if (value && !Number.isInteger(value)) {
32287
- throw new Error();
32288
- }
32289
32229
  return [2 /*return*/];
32290
32230
  });
32291
32231
  }); },
32292
32232
  },
32293
32233
  ] },
32294
- React.createElement(InputNumber, null))),
32234
+ React.createElement(InputNumber, { disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly }))),
32295
32235
  React.createElement(Col, { xl: 7 },
32296
32236
  React.createElement(Form.Item, { name: "totalCo2WithLand_unconditionalNdc", rules: [
32297
32237
  {
@@ -32300,15 +32240,12 @@ var GHGProjectionsComponent = function (props) {
32300
32240
  if (value && value < 0) {
32301
32241
  throw new Error();
32302
32242
  }
32303
- if (value && !Number.isInteger(value)) {
32304
- throw new Error();
32305
- }
32306
32243
  return [2 /*return*/];
32307
32244
  });
32308
32245
  }); },
32309
32246
  },
32310
32247
  ] },
32311
- React.createElement(InputNumber, null)))))),
32248
+ React.createElement(InputNumber, { disabled: (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) === Role.ViewOnly })))))),
32312
32249
  (((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.GOVERNMENT || (userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.companyRole) === CompanyRole.MINISTRY)
32313
32250
  && ((userInfoState === null || userInfoState === void 0 ? void 0 : userInfoState.userRole) !== Role.ViewOnly)) &&
32314
32251
  (React.createElement("div", { className: "steps-actions" },