beautiful-grid 1.0.19 → 1.0.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.
@@ -1835,7 +1835,18 @@ function AppStoreProvider(_a) {
1835
1835
  });
1836
1836
  },
1837
1837
  setCellSelecting: function (cellSelecting) { return set(function (state) { return (state.disabled && cellSelecting ? {} : { cellSelecting: cellSelecting }); }); },
1838
- clearCellSelection: function () { return set({ cellSelectionRange: undefined, cellSelectionRanges: [], cellSelecting: false }); },
1838
+ clearCellSelection: function () {
1839
+ return set(function (state) {
1840
+ var _a, _b;
1841
+ // Outside clicks reach every mounted grid; keep an empty selection from notifying subscribers again.
1842
+ if (state.cellSelectionRange === undefined &&
1843
+ ((_b = (_a = state.cellSelectionRanges) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) === 0 &&
1844
+ !state.cellSelecting) {
1845
+ return state;
1846
+ }
1847
+ return { cellSelectionRange: undefined, cellSelectionRanges: [], cellSelecting: false };
1848
+ });
1849
+ },
1839
1850
  });
1840
1851
  });
1841
1852
  }
@@ -1645,7 +1645,15 @@ export function AppStoreProvider({ children, initialState }) {
1645
1645
  cellSelectionRanges,
1646
1646
  }),
1647
1647
  setCellSelecting: cellSelecting => set(state => (state.disabled && cellSelecting ? {} : { cellSelecting })),
1648
- clearCellSelection: () => set({ cellSelectionRange: undefined, cellSelectionRanges: [], cellSelecting: false }),
1648
+ clearCellSelection: () => set(state => {
1649
+ // Outside clicks reach every mounted grid; keep an empty selection from notifying subscribers again.
1650
+ if (state.cellSelectionRange === undefined &&
1651
+ (state.cellSelectionRanges?.length ?? 0) === 0 &&
1652
+ !state.cellSelecting) {
1653
+ return state;
1654
+ }
1655
+ return { cellSelectionRange: undefined, cellSelectionRanges: [], cellSelecting: false };
1656
+ }),
1649
1657
  }));
1650
1658
  }
1651
1659
  return React.createElement(StoreContext.Provider, { value: storeRef.current }, children);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beautiful-grid",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "A beautiful, powerful, open-source React Data Grid.",
5
5
  "homepage": "https://bgrid.axisj.com",
6
6
  "bugs": {