@erpsquad/common 1.9.3 → 1.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34794,7 +34794,7 @@ var renderer5 = {
34794
34794
  })
34795
34795
  };
34796
34796
  var dropdown_cell_default = renderer5;
34797
- var ArticleCellEditor = React.lazy(async () => await import("./article-cell-editor-JDI676YI-Datekod9.esm.js"));
34797
+ var ArticleCellEditor = React.lazy(async () => await import("./article-cell-editor-JDI676YI-D1C2oF1f.esm.js"));
34798
34798
  var renderer6 = {
34799
34799
  kind: GridCellKind.Custom,
34800
34800
  isMatch: (c2) => c2.data.kind === "article-cell",
@@ -36714,6 +36714,7 @@ const MaterialEditableTable = React__default.memo(({
36714
36714
  handleSaveRow(editingRow, values, table2);
36715
36715
  if (!isValid) return;
36716
36716
  if (isValid) {
36717
+ setDisableNextEdit(false);
36717
36718
  clearRow(editingRow.id);
36718
36719
  setTimeout(() => table2.setCreatingRow(true), 200);
36719
36720
  }
@@ -36731,7 +36732,8 @@ const MaterialEditableTable = React__default.memo(({
36731
36732
  (_b = (_a = table2.options).onCreatingRowSave) == null ? void 0 : _b.call(_a, { row: creatingRow, values, table: table2 });
36732
36733
  if (!isValid) return;
36733
36734
  if (isValid) {
36734
- clearRow(creatingRow.id);
36735
+ setDisableNextEdit(false);
36736
+ clearRow("mrt-row-create");
36735
36737
  setTimeout(() => table2.setCreatingRow(true), 200);
36736
36738
  }
36737
36739
  },
@@ -36974,33 +36976,36 @@ const MaterialEditableTable = React__default.memo(({
36974
36976
  muiTableBodyRowProps: ({ row: row2, table: table2 }) => {
36975
36977
  var _a, _b, _c, _d, _e, _f, _g;
36976
36978
  const editingRowId = ((_b = (_a = table2.getState()) == null ? void 0 : _a.editingRow) == null ? void 0 : _b.id) || ((_d = (_c = table2.getState()) == null ? void 0 : _c.creatingRow) == null ? void 0 : _d.id) || null;
36977
- const creatingRowId = ((_f = (_e = table2.getState()) == null ? void 0 : _e.creatingRow) == null ? void 0 : _f.id) || null;
36979
+ ((_f = (_e = table2.getState()) == null ? void 0 : _e.creatingRow) == null ? void 0 : _f.id) || null;
36978
36980
  const isErrorRow = Boolean((_g = row2 == null ? void 0 : row2.original) == null ? void 0 : _g.has_error);
36979
- const isCurrentlyEditing = editingRowId === row2.id;
36980
36981
  return {
36981
36982
  onClick: () => {
36982
36983
  setSelectedRow(row2.id);
36983
36984
  },
36984
- onKeyDown: (e3) => {
36985
- if (isCurrentlyEditing) {
36986
- if (e3.key === "Enter") {
36987
- e3.preventDefault();
36988
- table2.setEditingRow(null);
36989
- } else if (e3.key === "Escape") {
36990
- e3.preventDefault();
36991
- console.log("Escape pressed, canceling edit for row:", row2.id);
36992
- if (creatingRowId === row2.id) {
36993
- table2.setCreatingRow(null);
36994
- } else {
36995
- table2.setEditingRow(null);
36996
- }
36997
- setDisableNextEdit(false);
36998
- if (creatingRowId !== row2.id) {
36999
- handleSaveRow(row2, row2._valuesCache || row2.original, table2);
37000
- }
37001
- }
37002
- }
37003
- },
36985
+ // onKeyDown: (e) => {
36986
+ // // Handle keyboard events for editing
36987
+ // if (isCurrentlyEditing) {
36988
+ // if (e.key === 'Enter') {
36989
+ // // Save on Enter
36990
+ // e.preventDefault();
36991
+ // table.setEditingRow(null);
36992
+ // } else if (e.key === 'Escape') {
36993
+ // // Cancel on Escape
36994
+ // e.preventDefault();
36995
+ // console.log('Escape pressed, canceling edit for row:', row.id);
36996
+ // if (creatingRowId === row.id) {
36997
+ // table.setCreatingRow(null);
36998
+ // } else {
36999
+ // table.setEditingRow(null);
37000
+ // }
37001
+ // // Immediately reset disableNextEdit to allow re-editing
37002
+ // setDisableNextEdit(false);
37003
+ // if (creatingRowId !== row.id) {
37004
+ // handleSaveRow(row, row._valuesCache || row.original, table);
37005
+ // }
37006
+ // }
37007
+ // }
37008
+ // },
37004
37009
  sx: {
37005
37010
  cursor: "pointer",
37006
37011
  // backgroundColor: !editingRowId
@@ -37124,6 +37129,10 @@ const MaterialEditableTable = React__default.memo(({
37124
37129
  },
37125
37130
  onClick: (e3) => {
37126
37131
  var _a, _b, _c, _d;
37132
+ const target = e3.target;
37133
+ const tableCell = target.closest(".MuiTableCell-body");
37134
+ const isInsideTable = tableCell && !tableCell.querySelector(".delete-row");
37135
+ if (!isInsideTable) return;
37127
37136
  const columnDef = column.columnDef;
37128
37137
  const isOnClickEditable = columnDef.isOnClickEditable !== false;
37129
37138
  if (!isOnClickEditable) {
@@ -37149,7 +37158,7 @@ const MaterialEditableTable = React__default.memo(({
37149
37158
  const creatingRowId = ((_a = table2.getState().creatingRow) == null ? void 0 : _a.id) ?? null;
37150
37159
  if (e3.key === "Escape") {
37151
37160
  if (creatingRowId === row2.id) {
37152
- clearRow(row2.id);
37161
+ clearRow("mrt-row-create");
37153
37162
  table2.setCreatingRow(null);
37154
37163
  } else {
37155
37164
  const editingRow = table2.getState().editingRow;
@@ -45716,4 +45725,4 @@ export {
45716
45725
  AreaLineChart as y,
45717
45726
  ChartLegends as z
45718
45727
  };
45719
- //# sourceMappingURL=uom-field-wrapper-u_5j6Mqe.esm.js.map
45728
+ //# sourceMappingURL=uom-field-wrapper-RQOElitw.esm.js.map