@dooherceg/material-react-table 3.2.19 → 3.2.20

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.
package/dist/index.d.ts CHANGED
@@ -647,9 +647,13 @@ type MRT_TableInstance<TData extends MRT_RowData> = Omit<Table<TData>, 'getAllCo
647
647
  setNewEntryModal: Dispatch<SetStateAction<MRT_NewEntryModalState>>;
648
648
  setRowReorderingSelection: Dispatch<SetStateAction<MRT_RowReorderingSelectionState>>;
649
649
  addRow: (rows: MRT_RowManipulationInput<TData>) => void;
650
- updateRow: (rows: MRT_RowManipulationInput<TData>) => void;
650
+ updateRow: (rows: MRT_RowManipulationInput<Partial<TData> & {
651
+ id: string;
652
+ }>) => void;
651
653
  setRows: (rows: MRT_RowManipulationInput<TData>) => void;
652
- upsertRow: (rows: MRT_RowManipulationInput<TData>) => void;
654
+ upsertRow: (rows: MRT_RowManipulationInput<Partial<TData> & {
655
+ id: string;
656
+ }>) => void;
653
657
  removeRow: (rows: string | string[]) => void;
654
658
  refetch?: () => void;
655
659
  };
package/dist/index.esm.js CHANGED
@@ -2705,11 +2705,8 @@ const handleUpdateRow = ({ getRowId, setRowsState, }) => {
2705
2705
  if (!rowsToUpdate.length)
2706
2706
  return previousRows;
2707
2707
  const rowById = new Map();
2708
- rowsToUpdate.forEach((row, index) => {
2709
- const rowId = getResolvedRowId(row, index, undefined, getRowId);
2710
- if (rowId !== undefined) {
2711
- rowById.set(rowId, row);
2712
- }
2708
+ rowsToUpdate.forEach((row) => {
2709
+ rowById.set(row.id, row);
2713
2710
  });
2714
2711
  return previousRows.map((row, index) => {
2715
2712
  const rowId = getResolvedRowId(row, index, undefined, getRowId);
@@ -2739,14 +2736,13 @@ const handleUpsertRow = ({ getRowId, pageSize, setRowsState, }) => {
2739
2736
  }
2740
2737
  });
2741
2738
  const rowsToInsert = [];
2742
- rowsToUpsert.forEach((row, index) => {
2743
- const rowId = getResolvedRowId(row, index, undefined, getRowId);
2744
- const existingIndex = rowId !== undefined ? indexByRowId.get(rowId) : undefined;
2739
+ rowsToUpsert.forEach((row) => {
2740
+ const existingIndex = indexByRowId.get(row.id);
2745
2741
  if (existingIndex === undefined) {
2746
2742
  rowsToInsert.push(row);
2747
2743
  return;
2748
2744
  }
2749
- nextRows[existingIndex] = row;
2745
+ nextRows[existingIndex] = Object.assign(Object.assign({}, nextRows[existingIndex]), row);
2750
2746
  });
2751
2747
  return capRowsToPageSize([...rowsToInsert, ...nextRows], pageSize);
2752
2748
  });