@undp/carbon-library 1.0.281-CARBON-363.0 → 1.0.281-CARBON-363.4

Sign up to get free protection for your applications and to get access to all the features.
package/dist/cjs/index.js CHANGED
@@ -26777,13 +26777,11 @@ var NdcDetailsComponent = function (props) {
26777
26777
  var _q = React.useState(10), pageSize = _q[0], setPageSize = _q[1];
26778
26778
  var isEditing = function (record) { return record.id === editingKey; };
26779
26779
  var isMainActionInEditMode = function () {
26780
- if (editingKey) {
26781
- var action = ndcActionsList.find(function (item) { return item.id === editingKey; });
26782
- if (action && action.actionType === NdcDetailsActionType.MainAction) {
26783
- return true;
26784
- }
26785
- }
26786
- return false;
26780
+ var unsavedMainActions = ndcMainDetailsForPeriod.filter(function (item) {
26781
+ return item.status === NdcDetailsActionStatus.New &&
26782
+ item.actionType === NdcDetailsActionType.MainAction;
26783
+ });
26784
+ return unsavedMainActions.length > 0 ? true : false;
26787
26785
  };
26788
26786
  var userInfoState = useUserContext().userInfoState;
26789
26787
  React.useEffect(function () {
@@ -27209,9 +27207,11 @@ var NdcDetailsComponent = function (props) {
27209
27207
  !selectedPeriod.finalized && (React.createElement(antd.Row, { justify: "center" },
27210
27208
  React.createElement(antd.Button, { className: "btnAddNewMainAct", disabled: isMainActionInEditMode(), onClick: onClickedAddNewNdcDetail, type: "default" }, t("ndc:addNdcAction"))));
27211
27209
  } })))),
27212
- isGovernmentUser && !selectedPeriod.finalized ? (React.createElement(antd.Row, { justify: "end" },
27213
- React.createElement(antd.Button, { className: "mg-left-1 btn-danger", onClick: onClickedDeletePeriod, htmlType: "submit", disabled: isMainActionInEditMode(), loading: loading }, t("ndc:delete")),
27214
- React.createElement(antd.Button, { className: "mg-left-1 footer-btns", type: "primary", onClick: onClickedFinalizePeriod, disabled: isMainActionInEditMode(), htmlType: "submit", loading: loading }, t("ndc:finalize")))) : ("")));
27210
+ isGovernmentUser && !selectedPeriod.finalized ? (React.createElement(antd.Row, { justify: "end" }, isMainActionInEditMode() ? (React.createElement(React.Fragment, null,
27211
+ React.createElement(antd.Button, { className: "mg-left-1", disabled: true }, t("ndc:delete")),
27212
+ React.createElement(antd.Button, { className: "mg-left-1", disabled: true }, t("ndc:finalize")))) : (React.createElement(React.Fragment, null,
27213
+ React.createElement(antd.Button, { className: "mg-left-1 btn-danger", onClick: onClickedDeletePeriod, htmlType: "submit", loading: loading }, t("ndc:delete")),
27214
+ React.createElement(antd.Button, { className: "mg-left-1", type: "primary", onClick: onClickedFinalizePeriod, htmlType: "submit", loading: loading }, t("ndc:finalize")))))) : ("")));
27215
27215
  }
27216
27216
  function subNdcActionTableContent(record) {
27217
27217
  return (React.createElement(antd.Table, { tableLayout: "fixed", rowKey: "id", components: components, rowClassName: function () { return "editable-row"; }, className: "common-table-class", bordered: true, dataSource: subNdcActionsForPeriod, loading: loading, onRow: function (record, rowIndex) {