@undp/carbon-library 1.0.175-CARBON-363.59 → 1.0.175-CARBON-363.73

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,6 +18,7 @@ interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
18
18
  index: number;
19
19
  children: React.ReactNode;
20
20
  onBlurHandler: any;
21
+ t: any;
21
22
  }
22
23
  export declare const EditableCell: React.FC<EditableCellProps>;
23
24
  export {};
package/dist/esm/index.js CHANGED
@@ -26125,23 +26125,23 @@ var RegistryDashboardComponent = function (props) {
26125
26125
 
26126
26126
  React.createContext(null);
26127
26127
  var EditableCell = function (_a) {
26128
- var editing = _a.editing, dataIndex = _a.dataIndex, title = _a.title; _a.inputType; var record = _a.record; _a.index; var children = _a.children, onBlurHandler = _a.onBlurHandler, restProps = __rest(_a, ["editing", "dataIndex", "title", "inputType", "record", "index", "children", "onBlurHandler"]);
26128
+ var editing = _a.editing, dataIndex = _a.dataIndex, title = _a.title; _a.inputType; var record = _a.record; _a.index; var children = _a.children, onBlurHandler = _a.onBlurHandler, t = _a.t, restProps = __rest(_a, ["editing", "dataIndex", "title", "inputType", "record", "index", "children", "onBlurHandler", "t"]);
26129
26129
  var inputNode;
26130
26130
  if (dataIndex === "nationalPlanObjective") {
26131
- inputNode = (React.createElement(Input, { onBlur: function () { return onBlurHandler(record); }, placeholder: "Enter National Plan Objective" }));
26131
+ inputNode = (React.createElement(Input, { onBlur: function () { return onBlurHandler(record); }, placeholder: t("ndc:nationalPlanObjectivePlaceHolder") }));
26132
26132
  }
26133
26133
  else if (dataIndex === "kpi") {
26134
- inputNode = (React.createElement(InputNumber, { onBlur: function () { return onBlurHandler(record); }, placeholder: "Enter Kpi" }));
26134
+ inputNode = (React.createElement(InputNumber, { onBlur: function () { return onBlurHandler(record); }, placeholder: t("ndc:kpiPlaceHolder") }));
26135
26135
  }
26136
26136
  return (React.createElement("td", __assign({}, restProps), editing ? (React.createElement(Form.Item, { name: dataIndex, style: { margin: 0 }, rules: [
26137
26137
  {
26138
26138
  required: true,
26139
- message: "Please Input ".concat(title, "!"),
26139
+ message: "".concat(title, " ").concat(t("ndc:isRequired")),
26140
26140
  },
26141
26141
  ] }, inputNode)) : (children)));
26142
26142
  };
26143
26143
 
26144
- var css_248z$4 = ".ndc-steps-actions {\n display: flex;\n flex-direction: row-reverse;\n margin-right: 1rem;\n justify-content: center; }\n .ndc-steps-actions .action-btn {\n border: 1px solid #16b1ff;\n color: #16b1ff;\n margin-right: 1rem; }\n .ndc-steps-actions .back-btn {\n border: 1px solid rgba(140, 140, 140, 0.7);\n color: rgba(140, 140, 140, 0.7);\n margin-right: 1rem; }\n .ndc-steps-actions .mg-left-1 {\n margin-left: 1rem; }\n\n.ndc-details .ant-table-expanded-row .ant-table-cell {\n padding-left: 33px; }\n\n.ndc-details .ant-input-number-input-wrap {\n margin-right: 10px; }\n";
26144
+ var css_248z$4 = ".ndc-steps-actions {\n display: flex;\n flex-direction: row-reverse;\n margin-right: 1rem;\n justify-content: center; }\n .ndc-steps-actions .action-btn {\n border: 1px solid #16b1ff;\n color: #16b1ff;\n margin-right: 1rem; }\n .ndc-steps-actions .back-btn {\n border: 1px solid rgba(140, 140, 140, 0.7);\n color: rgba(140, 140, 140, 0.7);\n margin-right: 1rem; }\n .ndc-steps-actions .mg-left-1 {\n margin-left: 1rem; }\n\n.ndc-details .ant-input-number-input-wrap {\n margin-right: 10px; }\n";
26145
26145
  styleInject(css_248z$4);
26146
26146
 
26147
26147
  var NdcDetailsActionType;
@@ -26269,7 +26269,7 @@ var NdcDetailsComponent = function (props) {
26269
26269
  return __generator(this, function (_a) {
26270
26270
  switch (_a.label) {
26271
26271
  case 0:
26272
- _a.trys.push([0, 9, 10, 11]);
26272
+ _a.trys.push([0, 9, , 10]);
26273
26273
  updatedFields = void 0;
26274
26274
  _a.label = 1;
26275
26275
  case 1:
@@ -26304,20 +26304,18 @@ var NdcDetailsComponent = function (props) {
26304
26304
  case 8:
26305
26305
  fetchNdcDetailActions();
26306
26306
  setEditingKey(-1);
26307
- return [3 /*break*/, 11];
26307
+ return [3 /*break*/, 10];
26308
26308
  case 9:
26309
26309
  exception_2 = _a.sent();
26310
+ setEditingKey(-1);
26310
26311
  message.open({
26311
26312
  type: "error",
26312
26313
  content: exception_2.message,
26313
26314
  duration: 3,
26314
26315
  style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26315
26316
  });
26316
- return [3 /*break*/, 11];
26317
- case 10:
26318
- setEditingKey(-1);
26319
- return [7 /*endfinally*/];
26320
- case 11: return [2 /*return*/];
26317
+ return [3 /*break*/, 10];
26318
+ case 10: return [2 /*return*/];
26321
26319
  }
26322
26320
  });
26323
26321
  }); };
@@ -26368,7 +26366,7 @@ var NdcDetailsComponent = function (props) {
26368
26366
  dataIndex: "nationalPlanObjective",
26369
26367
  key: "nationalPlanObjective",
26370
26368
  align: "left",
26371
- width: 300,
26369
+ width: 400,
26372
26370
  editable: true,
26373
26371
  render: function (_, record) { return (React.createElement(Space, { size: "middle" }, record.nationalPlanObjective ? (React.createElement("span", null, record.nationalPlanObjective)) : (React.createElement(Input, { placeholder: "Enter National Plan Objective" })))); },
26374
26372
  },
@@ -26386,10 +26384,10 @@ var NdcDetailsComponent = function (props) {
26386
26384
  dataIndex: "ministryName",
26387
26385
  key: "ministryName",
26388
26386
  align: "left",
26389
- width: 200,
26387
+ width: 300,
26390
26388
  editable: false,
26391
26389
  render: function (_, record) { return (React.createElement(React.Fragment, null,
26392
- React.createElement(Select, { disabled: !(isSubNdcActionsEditable(record) && isEditing(record)), defaultValue: record.ministryName ? record.ministryName : loginMinistry, style: { width: 320 }, onChange: function (value, option) {
26390
+ React.createElement(Select, { disabled: !(isSubNdcActionsEditable(record) && isEditing(record)), defaultValue: record.ministryName ? record.ministryName : loginMinistry, style: { width: 220 }, onChange: function (value, option) {
26393
26391
  record.ministryName = option.label;
26394
26392
  handleSave(record);
26395
26393
  }, options: ministryOrgList }))); },
@@ -26399,7 +26397,7 @@ var NdcDetailsComponent = function (props) {
26399
26397
  dataIndex: "status",
26400
26398
  key: "status",
26401
26399
  align: "left",
26402
- width: "15%",
26400
+ width: 200,
26403
26401
  editable: false,
26404
26402
  render: function (_, record) {
26405
26403
  var menu = actionMenu(record);
@@ -26431,6 +26429,7 @@ var NdcDetailsComponent = function (props) {
26431
26429
  handleSave(record);
26432
26430
  }
26433
26431
  },
26432
+ t: t,
26434
26433
  };
26435
26434
  } });
26436
26435
  });
@@ -26485,6 +26484,15 @@ var NdcDetailsComponent = function (props) {
26485
26484
  var onClickedFinalizePeriod = function () { return __awaiter(void 0, void 0, void 0, function () {
26486
26485
  var pendingActions;
26487
26486
  return __generator(this, function (_a) {
26487
+ if (subNdcActionsForPeriod.length === 0) {
26488
+ message.open({
26489
+ type: "error",
26490
+ content: t("ndc:finalizeNdcEmptyErrorText"),
26491
+ duration: 3,
26492
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26493
+ });
26494
+ return [2 /*return*/];
26495
+ }
26488
26496
  pendingActions = subNdcActionsForPeriod.filter(function (action) {
26489
26497
  return action.status === NdcDetailsActionStatus.Pending;
26490
26498
  });
@@ -26531,12 +26539,11 @@ var NdcDetailsComponent = function (props) {
26531
26539
  React.createElement(Row, null,
26532
26540
  React.createElement(Col, { span: 24 },
26533
26541
  React.createElement(Form, { form: form, component: false },
26534
- React.createElement(Table, { key: tableKey, rowKey: "id", components: components, rowClassName: function () { return "editable-row"; }, bordered: true, loading: loading, dataSource: ndcMainDetailsForPeriod, columns: columns, expandedRowKeys: expandedRowKeys, onExpand: onMainTableRowExpand, expandable: {
26542
+ React.createElement(Table, { tableLayout: "fixed", key: tableKey, rowKey: "id", components: components, rowClassName: function () { return "editable-row"; }, bordered: true, loading: loading, dataSource: ndcMainDetailsForPeriod, columns: columns, expandedRowKeys: expandedRowKeys, onExpand: onMainTableRowExpand, expandable: {
26535
26543
  expandedRowRender: function (record) {
26536
26544
  return subNdcActionTableContent();
26537
26545
  },
26538
- indentSize: 30,
26539
- columnWidth: 30,
26546
+ columnWidth: 40,
26540
26547
  }, onRow: function (record, rowIndex) {
26541
26548
  return {
26542
26549
  onClick: function (event) {
@@ -26566,7 +26573,7 @@ var NdcDetailsComponent = function (props) {
26566
26573
  React.createElement(Button, { className: "mg-left-1", type: "primary", onClick: onClickedFinalizePeriod, htmlType: "submit", loading: loading }, t("ndc:finalize")))) : ("")));
26567
26574
  }
26568
26575
  function subNdcActionTableContent(record) {
26569
- return (React.createElement(Table, { rowKey: "id", components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: subNdcActionsForPeriod, loading: loading, onRow: function (record, rowIndex) {
26576
+ return (React.createElement(Table, { tableLayout: "fixed", rowKey: "id", components: components, rowClassName: function () { return "editable-row"; }, bordered: true, dataSource: subNdcActionsForPeriod, loading: loading, onRow: function (record, rowIndex) {
26570
26577
  return {
26571
26578
  onClick: function (event) {
26572
26579
  if (record.id &&
@@ -26697,13 +26704,43 @@ var NdcDetailsComponent = function (props) {
26697
26704
  });
26698
26705
  return [3 /*break*/, 11];
26699
26706
  case 11:
26700
- if (actionResponse &&
26701
- (actionInfo.action === "Delete" || actionInfo.action === "Finalize")) {
26702
- fetchNdcDetailPeriods();
26703
- }
26704
- else if (actionResponse &&
26705
- (actionInfo.action === "Approve" || actionInfo.action === "Reject")) {
26706
- fetchNdcDetailActions();
26707
+ if (actionResponse) {
26708
+ if (actionInfo.action === "Delete") {
26709
+ message.open({
26710
+ type: "success",
26711
+ content: t("ndc:deletePeriodSuccessMsg"),
26712
+ duration: 3,
26713
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26714
+ });
26715
+ fetchNdcDetailPeriods();
26716
+ }
26717
+ else if (actionInfo.action === "Finalize") {
26718
+ message.open({
26719
+ type: "success",
26720
+ content: t("ndc:finalizeSuccessMsg"),
26721
+ duration: 3,
26722
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26723
+ });
26724
+ fetchNdcDetailPeriods();
26725
+ }
26726
+ else if (actionInfo.action === "Approve") {
26727
+ message.open({
26728
+ type: "success",
26729
+ content: t("ndc:approveSuccessMsg"),
26730
+ duration: 3,
26731
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26732
+ });
26733
+ fetchNdcDetailActions();
26734
+ }
26735
+ else if (actionInfo.action === "Reject") {
26736
+ message.open({
26737
+ type: "success",
26738
+ content: t("ndc:rejectSuccessMsg"),
26739
+ duration: 3,
26740
+ style: { textAlign: "right", marginRight: 15, marginTop: 10 },
26741
+ });
26742
+ fetchNdcDetailActions();
26743
+ }
26707
26744
  }
26708
26745
  setOpenConfirmationModal(false);
26709
26746
  setLoading(false);