UNPKG

ra-core

Version:

Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React

23 lines 782 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useUnselectAll = void 0; const react_1 = require("react"); const useRecordSelection_1 = require("./useRecordSelection.cjs"); /** * Hook to unselect all row of a datagrid * * @example * * const unselectAll = useUnselectAll('posts'); * unselectAll(); */ const useUnselectAll = (resource, storeKey) => { const [, { clearSelection }] = (0, useRecordSelection_1.useRecordSelection)(resource ? { resource, storeKey } : { disableSyncWithStore: true, storeKey }); return (0, react_1.useCallback)((fromAllStoreKeys) => { clearSelection(fromAllStoreKeys); }, [clearSelection]); }; exports.useUnselectAll = useUnselectAll; //# sourceMappingURL=useUnselectAll.js.map