@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/esm/index.js CHANGED
@@ -26757,13 +26757,11 @@ var NdcDetailsComponent = function (props) {
26757
26757
  var _q = useState(10), pageSize = _q[0], setPageSize = _q[1];
26758
26758
  var isEditing = function (record) { return record.id === editingKey; };
26759
26759
  var isMainActionInEditMode = function () {
26760
- if (editingKey) {
26761
- var action = ndcActionsList.find(function (item) { return item.id === editingKey; });
26762
- if (action && action.actionType === NdcDetailsActionType.MainAction) {
26763
- return true;
26764
- }
26765
- }
26766
- return false;
26760
+ var unsavedMainActions = ndcMainDetailsForPeriod.filter(function (item) {
26761
+ return item.status === NdcDetailsActionStatus.New &&
26762
+ item.actionType === NdcDetailsActionType.MainAction;
26763
+ });
26764
+ return unsavedMainActions.length > 0 ? true : false;
26767
26765
  };
26768
26766
  var userInfoState = useUserContext().userInfoState;
26769
26767
  useEffect(function () {
@@ -27189,9 +27187,11 @@ var NdcDetailsComponent = function (props) {
27189
27187
  !selectedPeriod.finalized && (React.createElement(Row, { justify: "center" },
27190
27188
  React.createElement(Button, { className: "btnAddNewMainAct", disabled: isMainActionInEditMode(), onClick: onClickedAddNewNdcDetail, type: "default" }, t("ndc:addNdcAction"))));
27191
27189
  } })))),
27192
- isGovernmentUser && !selectedPeriod.finalized ? (React.createElement(Row, { justify: "end" },
27193
- React.createElement(Button, { className: "mg-left-1 btn-danger", onClick: onClickedDeletePeriod, htmlType: "submit", disabled: isMainActionInEditMode(), loading: loading }, t("ndc:delete")),
27194
- React.createElement(Button, { className: "mg-left-1 footer-btns", type: "primary", onClick: onClickedFinalizePeriod, disabled: isMainActionInEditMode(), htmlType: "submit", loading: loading }, t("ndc:finalize")))) : ("")));
27190
+ isGovernmentUser && !selectedPeriod.finalized ? (React.createElement(Row, { justify: "end" }, isMainActionInEditMode() ? (React.createElement(React.Fragment, null,
27191
+ React.createElement(Button, { className: "mg-left-1", disabled: true }, t("ndc:delete")),
27192
+ React.createElement(Button, { className: "mg-left-1", disabled: true }, t("ndc:finalize")))) : (React.createElement(React.Fragment, null,
27193
+ React.createElement(Button, { className: "mg-left-1 btn-danger", onClick: onClickedDeletePeriod, htmlType: "submit", loading: loading }, t("ndc:delete")),
27194
+ React.createElement(Button, { className: "mg-left-1", type: "primary", onClick: onClickedFinalizePeriod, htmlType: "submit", loading: loading }, t("ndc:finalize")))))) : ("")));
27195
27195
  }
27196
27196
  function subNdcActionTableContent(record) {
27197
27197
  return (React.createElement(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) {