-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: react-data-grid-react-window should be complete extension package #26627
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
Merged
ling1726
merged 13 commits into
microsoft:master
from
ling1726:feat/data-grid-react-window
Feb 6, 2023
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
68a928a
feat: react-data-grid-react-window should be complete extension package
ling1726 67fbf0b
export useDataGridContextValues_unstable
ling1726 82fc5c6
changefile
ling1726 ea23509
remove duplicate export
ling1726 d6c5781
remove DataGridBody tests, not a core component here
ling1726 f596cad
Update packages/react-components/react-table/src/components/DataGrid/…
ling1726 b74061c
Merge remote-tracking branch 'origin/master' into feat/data-grid-reac…
ling1726 a1736ef
Merge branch 'feat/data-grid-react-window' of https://github.com/ling…
ling1726 0c372f6
make hack nicer
ling1726 3fd5a56
update m
ling1726 61fec7d
Update packages/react-components/react-data-grid-react-window/src/com…
ling1726 a0e63ab
update md
ling1726 54db0e4
Merge remote-tracking branch 'origin/master' into feat/data-grid-reac…
ling1726 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
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-components-7a8583a3-a0c8-4391-9083-d36fa2598973.json
This file contains hidden or 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,7 @@ | ||
| { | ||
| "type": "patch", | ||
| "comment": "feat: exports `useDataGridContextValues_unstable`", | ||
| "packageName": "@fluentui/react-components", | ||
| "email": "[email protected]", | ||
| "dependentChangeType": "patch" | ||
| } |
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-table-4d29794e-c7a5-4723-8a85-3e5668c2c102.json
This file contains hidden or 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,7 @@ | ||
| { | ||
| "type": "prerelease", | ||
| "comment": "feat: exports `useDataGridContextValues_unstable`", | ||
| "packageName": "@fluentui/react-table", | ||
| "email": "[email protected]", | ||
| "dependentChangeType": "patch" | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
1 change: 1 addition & 0 deletions
1
packages/react-components/react-data-grid-react-window/src/DataGrid.ts
This file contains hidden or 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 @@ | ||
| export * from './components/DataGrid/index'; |
1 change: 1 addition & 0 deletions
1
packages/react-components/react-data-grid-react-window/src/DataGridRow.ts
This file contains hidden or 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 @@ | ||
| export * from './components/DataGridRow'; |
18 changes: 18 additions & 0 deletions
18
packages/react-components/react-data-grid-react-window/src/components/DataGrid/DataGrid.tsx
This file contains hidden or 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,18 @@ | ||
| import * as React from 'react'; | ||
| import { useDataGrid_unstable } from './useDataGrid'; | ||
| import { | ||
| renderDataGrid_unstable, | ||
| useDataGridStyles_unstable, | ||
| useDataGridContextValues_unstable, | ||
| } from '@fluentui/react-table'; | ||
| import type { DataGridProps } from '@fluentui/react-table'; | ||
| import type { ForwardRefComponent } from '@fluentui/react-utilities'; | ||
|
|
||
| export const DataGrid: ForwardRefComponent<DataGridProps> = React.forwardRef((props, ref) => { | ||
| const state = useDataGrid_unstable(props, ref); | ||
|
|
||
| useDataGridStyles_unstable(state); | ||
| return renderDataGrid_unstable(state, useDataGridContextValues_unstable(state)); | ||
| }); | ||
|
|
||
| DataGrid.displayName = 'DataGrid'; |
2 changes: 2 additions & 0 deletions
2
packages/react-components/react-data-grid-react-window/src/components/DataGrid/index.ts
This file contains hidden or 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,2 @@ | ||
| export * from './DataGrid'; | ||
| export * from './useDataGrid'; |
16 changes: 16 additions & 0 deletions
16
...ages/react-components/react-data-grid-react-window/src/components/DataGrid/useDataGrid.ts
This file contains hidden or 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,16 @@ | ||
| import * as React from 'react'; | ||
| import type { DataGridProps, DataGridState } from '@fluentui/react-table'; | ||
| import { useDataGrid_unstable as useBaseState } from '@fluentui/react-table'; | ||
|
|
||
| /** | ||
| * Create the state required to render DataGrid. | ||
| * | ||
| * The returned state can be modified with hooks such as useDataGridStyles_unstable, | ||
| * before being passed to renderDataGrid_unstable. | ||
| * | ||
| * @param props - props from this instance of DataGrid | ||
| * @param ref - reference to root HTMLElement of DataGrid | ||
| */ | ||
| export const useDataGrid_unstable = (props: DataGridProps, ref: React.Ref<HTMLElement>): DataGridState => { | ||
| return useBaseState({ ...props, 'aria-rowcount': props.items.length }, ref); | ||
| }; |
15 changes: 0 additions & 15 deletions
15
...components/react-data-grid-react-window/src/components/DataGridBody/DataGridBody.test.tsx
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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
18 changes: 18 additions & 0 deletions
18
.../react-components/react-data-grid-react-window/src/components/DataGridRow/DataGridRow.tsx
This file contains hidden or 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,18 @@ | ||
| import * as React from 'react'; | ||
| import { useDataGridRowStyles_unstable, renderDataGridRow_unstable } from '@fluentui/react-table'; | ||
| import { useDataGridRow_unstable } from './useDataGridRow'; | ||
| import type { DataGridRowProps } from '@fluentui/react-table'; | ||
| import type { ForwardRefComponent } from '@fluentui/react-utilities'; | ||
|
|
||
| /** | ||
| * DataGridRow component | ||
| */ | ||
| export const DataGridRow: ForwardRefComponent<DataGridRowProps> & | ||
| (<TItem>(props: DataGridRowProps<TItem>) => JSX.Element) = React.forwardRef((props, ref) => { | ||
| const state = useDataGridRow_unstable(props, ref); | ||
|
|
||
| useDataGridRowStyles_unstable(state); | ||
| return renderDataGridRow_unstable(state); | ||
| }) as ForwardRefComponent<DataGridRowProps> & (<TItem>(props: DataGridRowProps<TItem>) => JSX.Element); | ||
|
|
||
| DataGridRow.displayName = 'DataGridRow'; |
2 changes: 2 additions & 0 deletions
2
packages/react-components/react-data-grid-react-window/src/components/DataGridRow/index.ts
This file contains hidden or 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,2 @@ | ||
| export * from './DataGridRow'; | ||
| export * from './useDataGridRow'; |
18 changes: 18 additions & 0 deletions
18
...eact-components/react-data-grid-react-window/src/components/DataGridRow/useDataGridRow.ts
This file contains hidden or 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,18 @@ | ||
| import * as React from 'react'; | ||
| import type { DataGridRowProps, DataGridRowState } from '@fluentui/react-table'; | ||
| import { useDataGridRow_unstable as useBaseState } from '@fluentui/react-table'; | ||
| import { useTableRowIndexContext } from '../../contexts/rowIndexContext'; | ||
|
|
||
| /** | ||
| * Create the state required to render DataGridRow. | ||
| * | ||
| * The returned state can be modified with hooks such as useDataGridRowStyles_unstable, | ||
| * before being passed to renderDataGridRow_unstable. | ||
| * | ||
| * @param props - props from this instance of DataGridRow | ||
| * @param ref - reference to root HTMLElement of DataGridRow | ||
| */ | ||
| export const useDataGridRow_unstable = (props: DataGridRowProps, ref: React.Ref<HTMLElement>): DataGridRowState => { | ||
| const rowIndex = useTableRowIndexContext(); | ||
| return useBaseState({ ...props, 'aria-rowindex': rowIndex }, ref); | ||
| }; |
9 changes: 9 additions & 0 deletions
9
packages/react-components/react-data-grid-react-window/src/contexts/rowIndexContext.ts
This file contains hidden or 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,9 @@ | ||
| import * as React from 'react'; | ||
|
|
||
| const rowIndexContext = React.createContext<number | undefined>(undefined); | ||
|
|
||
| export const tableRowIndexContextDefaultValue = undefined; | ||
|
|
||
| export const useTableRowIndexContext = () => React.useContext(rowIndexContext) ?? tableRowIndexContextDefaultValue; | ||
|
|
||
| export const TableRowIndexContextProvider = rowIndexContext.Provider; |
17 changes: 15 additions & 2 deletions
17
packages/react-components/react-data-grid-react-window/src/index.ts
This file contains hidden or 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,16 @@ | ||
| export { DataGridBody, useDataGridBody_unstable, renderDataGridBody_unstable } from './DataGridBody'; | ||
| export { DataGridBody } from './DataGridBody'; | ||
| export { DataGrid } from './DataGrid'; | ||
| export { DataGridRow } from './DataGridRow'; | ||
|
|
||
| export type { DataGridBodyProps, DataGridBodyState, DataGridBodySlots } from './DataGridBody'; | ||
| export { DataGridCell, DataGridHeader, DataGridHeaderCell, DataGridSelectionCell } from '@fluentui/react-table'; | ||
|
|
||
| export type { | ||
| DataGridCellProps, | ||
| DataGridHeaderCellProps, | ||
| DataGridHeaderProps, | ||
| DataGridSelectionCellProps, | ||
| DataGridRowProps, | ||
| DataGridProps, | ||
| } from '@fluentui/react-table'; | ||
|
|
||
| export type { DataGridBodyProps } from './DataGridBody'; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.