koval-ui
Version:
React components collection with minimalistic design. Supports theming, layout, and input validation.
1 lines • 1.23 kB
Source Map (JSON)
{"version":3,"file":"useSorting.cjs","sources":["../../../../../src/lib/DataTable/tableFeatures/useSorting.ts"],"sourcesContent":["import {useState, useEffect} from 'react';\nimport type {SortingState} from '@tanstack/react-table';\n\n// import type {ProcessingModes} from './types.ts';\n\nexport type Props = {\n sortingProp: SortingState;\n onSortingChange: (sortingState: SortingState) => void;\n // processingMode?: keyof typeof ProcessingModes;\n};\n\nexport const useSorting = ({sortingProp, onSortingChange}: Props) => {\n const [sorting, setSorting] = useState<SortingState>(sortingProp);\n\n useEffect(() => {\n setSorting(sortingProp);\n }, [sortingProp]);\n\n useEffect(() => {\n onSortingChange(sorting);\n }, [onSortingChange, sorting]);\n\n return {sorting, setSorting};\n};\n"],"names":["useSorting","sortingProp","onSortingChange","sorting","setSorting","useState","useEffect"],"mappings":"sHAWaA,EAAa,CAAC,CAAC,YAAAC,EAAa,gBAAAC,KAA4B,CACjE,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAAA,SAAuBJ,CAAW,EAEhEK,OAAAA,EAAAA,UAAU,IAAM,CACZF,EAAWH,CAAW,CAAA,EACvB,CAACA,CAAW,CAAC,EAEhBK,EAAAA,UAAU,IAAM,CACZJ,EAAgBC,CAAO,CAAA,EACxB,CAACD,EAAiBC,CAAO,CAAC,EAEtB,CAAC,QAAAA,EAAS,WAAAC,CAAU,CAC/B"}