-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DataGrid] Refactor state #412
Merged
+2,348
−1,838
Merged
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
af1df68
WIP state refactoring on pagination
dtassone 9f89b01
fix merging issues
dtassone 95434d5
WIP working on the rowsReducer and global state
dtassone 153813f
fixes state refactoring finalizing api
dtassone a2ac04b
refactored grid reducer
dtassone 3cbdb8d
fix issue with state and cleanup
dtassone 6d26841
fix state and added sortedSelctor for viewport
dtassone aabf153
prettier
dtassone 853198e
fix state virtualisation
dtassone 84e77d5
small refactoring with selector
dtassone d874bae
rollback lint rules
dtassone 5d3d8e3
remove options prop to useGridSelector
dtassone 31c2a96
prettier
dtassone 5220264
cleanup commented code
dtassone 9359199
fix pagination and rendering issues
dtassone 55d6d99
fix sorting and refactored hooks props
dtassone ed6a93e
Refactored useSorting to new gridState
dtassone a6c9bf2
rebased and fix issues
dtassone ed67afe
cleanup
dtassone e3d03a3
prettier
dtassone 2817bf9
fix test
dtassone d847d5f
rebased
dtassone ae53a83
fix demo app
dtassone 5b232d4
small refactoring on header item
dtassone 091a07f
fix dependency cycle
dtassone 19c4ede
fix index
dtassone ed328d3
prettier
dtassone e403bb3
removed unused fn
dtassone 94140d8
fixing test
dtassone a344fba
small refactoringg
dtassone 9bb2d3b
prettier
dtassone caa1398
perf improvements and keyboard refactoring
dtassone 82ec871
improve perf and fix keyboard and test
dtassone 77bcac0
move virtualisation folder
dtassone 2f4586a
prettier
dtassone a4c6e47
refactor useComponents and useEvents
dtassone 4de3fd9
yarn docs ts formatted
dtassone 37e2f19
fix demos and issue with resizing
dtassone 75ce9fc
fix types in doc
dtassone 20e4a54
small fix prettier
dtassone 30e7853
fix rows perf, and prettier
dtassone e0801e3
fix dependency array
dtassone bc93224
fix prettier
dtassone 7466c49
restored rowIndex
dtassone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix dependency cycle
commit 091a07f2a86df43f316b1851cb135272b2772425
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 6 additions & 39 deletions
45
packages/grid/_modules_/grid/hooks/features/core/gridState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
packages/grid/_modules_/grid/hooks/features/core/useGridSelector.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/grid/_modules_/grid/hooks/features/pagination/paginationReducer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/grid/_modules_/grid/hooks/features/pagination/paginationSelector.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { GridState } from '../core/gridState'; | ||
import { PaginationState } from './paginationReducer'; | ||
|
||
export const paginationSelector = (state: GridState) => state.pagination; | ||
export const paginationSelector = (state: any) : PaginationState => state.pagination; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export * from './sortingSelector'; | ||
export * from './useSorting'; | ||
export { getInitialSortingState } from './sortingState'; | ||
export { SortingState } from './sortingState'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/grid/_modules_/grid/hooks/features/sorting/sortingState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { RowId } from '../../../models/rows'; | ||
import { SortModel } from '../../../models/sortModel'; | ||
|
||
export interface SortingState { | ||
sortedRows: RowId[]; | ||
sortModel: SortModel; | ||
} | ||
|
||
export function getInitialSortingState(): SortingState { | ||
return {sortedRows: [], sortModel: []}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/grid/_modules_/grid/hooks/root/useApiEventHandler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
packages/grid/_modules_/grid/hooks/root/useNativeEventListener.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './useVirtualColumns'; | ||
export * from './useVirtualRows'; | ||
export * from './renderingState'; |
23 changes: 23 additions & 0 deletions
23
packages/grid/_modules_/grid/hooks/virtualization/renderingState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ContainerProps } from '../../models/containerProps'; | ||
import { RenderContextProps } from '../../models/renderContextProps'; | ||
import { ScrollParams } from '../utils/useScrollFn'; | ||
|
||
export interface InternalRenderingState { | ||
virtualPage: number; | ||
virtualRowsCount: number; | ||
renderContext: Partial<RenderContextProps> | null; | ||
realScroll: ScrollParams; | ||
renderingZoneScroll: ScrollParams; | ||
renderedSizes: ContainerProps | null; | ||
} | ||
|
||
export const getInitialRenderingState = (): InternalRenderingState => { | ||
return { | ||
realScroll: {left: 0, top: 0}, | ||
renderContext: null, | ||
renderingZoneScroll: {left: 0, top: 0}, | ||
virtualPage: 0, | ||
virtualRowsCount: 0, | ||
renderedSizes: null, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { GridState } from '../../hooks/features/core/gridState'; | ||
|
||
export interface StateApi { | ||
/** | ||
* Property that contains the whole state of the grid. | ||
*/ | ||
state: GridState; | ||
/** | ||
* allows to get the whole state of the grid if stateId is null or to get a part of the state if stateId has a value. | ||
*/ | ||
getState: <T>(stateId?: string) => T; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.