-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Generic Virtualizer #25451
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
Mitch-At-Work
merged 3 commits into
microsoft:master
from
Mitch-At-Work:user/mifraser/list-virtualizer
Jan 18, 2023
Merged
Generic Virtualizer #25451
Changes from all commits
Commits
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
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
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-components-b74a6283-d65f-4c27-9a78-fa1003628656.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: Export 'Virtualizer' as unstable", | ||
| "packageName": "@fluentui/react-components", | ||
| "email": "mifraser@microsoft.com", | ||
| "dependentChangeType": "patch" | ||
| } |
7 changes: 7 additions & 0 deletions
7
change/@fluentui-virtualizer-8e97ec39-c768-4e8b-85fc-5a50b7b425e1.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: Initial unstable release of the Virtualizer", | ||
| "packageName": "@fluentui/react-virtualizer", | ||
| "email": "mifraser@microsoft.com", | ||
| "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
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,4 @@ | ||
| { | ||
| "presets": ["@griffel"], | ||
| "plugins": ["annotate-pure-calls", "@babel/transform-react-pure-annotations"] | ||
| } |
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,4 @@ | ||
| { | ||
| "extends": ["plugin:@fluentui/eslint-plugin/react"], | ||
| "root": true | ||
| } |
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,30 @@ | ||
| .storybook/ | ||
| .vscode/ | ||
| bundle-size/ | ||
| config/ | ||
| coverage/ | ||
| docs/ | ||
| etc/ | ||
| node_modules/ | ||
| src/ | ||
| stories/ | ||
| dist/types/ | ||
| temp/ | ||
| __fixtures__ | ||
| __mocks__ | ||
| __tests__ | ||
|
|
||
| *.api.json | ||
| *.log | ||
| *.spec.* | ||
| *.cy.* | ||
| *.test.* | ||
| *.yml | ||
|
|
||
| # config files | ||
| *config.* | ||
| *rc.* | ||
| .editorconfig | ||
| .eslint* | ||
| .git* | ||
| .prettierignore |
14 changes: 14 additions & 0 deletions
14
packages/react-components/react-virtualizer/.storybook/main.js
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,14 @@ | ||
| const rootMain = require('../../../../.storybook/main'); | ||
|
|
||
| module.exports = /** @type {Omit<import('../../../../.storybook/main'), 'typescript'|'babel'>} */ ({ | ||
| ...rootMain, | ||
| stories: [...rootMain.stories, '../stories/**/*.stories.mdx', '../stories/**/index.stories.@(ts|tsx)'], | ||
| addons: [...rootMain.addons], | ||
| webpackFinal: (config, options) => { | ||
| const localConfig = { ...rootMain.webpackFinal(config, options) }; | ||
|
|
||
| // add your own webpack tweaks if needed | ||
|
|
||
| return localConfig; | ||
| }, | ||
| }); |
7 changes: 7 additions & 0 deletions
7
packages/react-components/react-virtualizer/.storybook/preview.js
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 @@ | ||
| import * as rootPreview from '../../../../.storybook/preview'; | ||
|
|
||
| /** @type {typeof rootPreview.decorators} */ | ||
| export const decorators = [...rootPreview.decorators]; | ||
|
|
||
| /** @type {typeof rootPreview.parameters} */ | ||
| export const parameters = { ...rootPreview.parameters }; |
10 changes: 10 additions & 0 deletions
10
packages/react-components/react-virtualizer/.storybook/tsconfig.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,10 @@ | ||
| { | ||
| "extends": "../tsconfig.json", | ||
| "compilerOptions": { | ||
| "outDir": "", | ||
| "allowJs": true, | ||
| "checkJs": true, | ||
| "types": ["static-assets", "environment", "storybook__addons"] | ||
| }, | ||
| "include": ["../stories/**/*.stories.ts", "../stories/**/*.stories.tsx", "*.js"] | ||
| } |
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,15 @@ | ||
| @fluentui/react-virtualizer | ||
|
|
||
| Copyright (c) Microsoft Corporation | ||
|
|
||
| All rights reserved. | ||
|
|
||
| MIT License | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
|
||
| Note: Usage of the fonts and icons referenced in Fluent UI React is subject to the terms listed at https://aka.ms/fluentui-assets-license |
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,5 @@ | ||
| # @fluentui/react-virtualizer | ||
|
|
||
| **Virtualizer components for [Fluent UI React](https://react.fluentui.dev/)** | ||
|
|
||
| These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release. |
4 changes: 4 additions & 0 deletions
4
packages/react-components/react-virtualizer/config/api-extractor.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,4 @@ | ||
| { | ||
| "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", | ||
| "extends": "@fluentui/scripts-api-extractor/api-extractor.common.v-next.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 @@ | ||
| /** Jest test setup file. */ |
80 changes: 80 additions & 0 deletions
80
packages/react-components/react-virtualizer/etc/react-virtualizer.api.md
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,80 @@ | ||
| ## API Report File for "@fluentui/react-virtualizer" | ||
|
|
||
| > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). | ||
|
|
||
| ```ts | ||
|
|
||
| import type { ComponentProps } from '@fluentui/react-utilities'; | ||
| import type { ComponentState } from '@fluentui/react-utilities'; | ||
| import type { Dispatch } from 'react'; | ||
| import type { FC } from 'react'; | ||
| import type { MutableRefObject } from 'react'; | ||
| import * as React_2 from 'react'; | ||
| import type { SetStateAction } from 'react'; | ||
| import type { Slot } from '@fluentui/react-utilities'; | ||
| import type { SlotClassNames } from '@fluentui/react-utilities'; | ||
|
|
||
| // @public (undocumented) | ||
| export const renderVirtualizer_unstable: (state: VirtualizerState) => JSX.Element; | ||
|
|
||
| // @public | ||
| export const useIntersectionObserver: (callback: IntersectionObserverCallback, options?: IntersectionObserverInit | undefined) => { | ||
| setObserverList: Dispatch<SetStateAction<Element[] | undefined>>; | ||
| setObserverInit: Dispatch<SetStateAction<IntersectionObserverInit | undefined>>; | ||
| observer: MutableRefObject<IntersectionObserver | undefined>; | ||
| }; | ||
|
|
||
| // @public (undocumented) | ||
| export function useVirtualizer_unstable(props: VirtualizerProps): VirtualizerState; | ||
|
|
||
| // @public | ||
| export const useVirtualizerStyles_unstable: (state: VirtualizerState) => VirtualizerState; | ||
|
|
||
| // @public | ||
| export const Virtualizer: FC<VirtualizerProps>; | ||
|
|
||
| // @public (undocumented) | ||
| export type VirtualizerChildRenderFunction = (index: number) => React_2.ReactNode; | ||
|
|
||
| // @public (undocumented) | ||
| export const virtualizerClassNames: SlotClassNames<VirtualizerSlots>; | ||
|
|
||
| // @public (undocumented) | ||
| export type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>> & { | ||
| children: VirtualizerChildRenderFunction; | ||
| itemSize: number; | ||
| numItems: number; | ||
| virtualizerLength: number; | ||
| bufferItems?: number; | ||
| bufferSize?: number; | ||
| intersectionObserverRoot?: React_2.MutableRefObject<HTMLElement | null>; | ||
| axis?: 'vertical' | 'horizontal'; | ||
| reversed?: boolean; | ||
| getItemSize?: (index: number) => number; | ||
| onUpdateIndex?: (index: number, prevIndex: number) => void; | ||
| onCalculateIndex?: (newIndex: number) => number; | ||
| }; | ||
|
|
||
| // @public (undocumented) | ||
| export type VirtualizerSlots = { | ||
| before: NonNullable<Slot<'div', 'td'>>; | ||
| beforeContainer: NonNullable<Slot<'div', 'tr'>>; | ||
| after: NonNullable<Slot<'div', 'td'>>; | ||
| afterContainer: NonNullable<Slot<'div', 'tr'>>; | ||
| }; | ||
|
|
||
| // @public (undocumented) | ||
| export type VirtualizerState = ComponentState<VirtualizerSlots> & { | ||
| virtualizedChildren: React_2.ReactNode[]; | ||
| virtualizerStartIndex: number; | ||
| afterBufferHeight: number; | ||
| beforeBufferHeight: number; | ||
| totalVirtualizerHeight: number; | ||
| axis?: 'vertical' | 'horizontal'; | ||
| reversed?: boolean; | ||
| bufferSize: number; | ||
| }; | ||
|
|
||
| // (No @packageDocumentation comment for this package) | ||
|
|
||
| ``` |
21 changes: 21 additions & 0 deletions
21
packages/react-components/react-virtualizer/jest.config.js
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,21 @@ | ||
| // @ts-check | ||
|
|
||
| /** | ||
| * @type {import('@jest/types').Config.InitialOptions} | ||
| */ | ||
| module.exports = { | ||
| displayName: 'virtualizer', | ||
| preset: '../../../jest.preset.js', | ||
| globals: { | ||
| 'ts-jest': { | ||
| tsconfig: '<rootDir>/tsconfig.spec.json', | ||
| diagnostics: false, | ||
| }, | ||
| }, | ||
| transform: { | ||
| '^.+\\.tsx?$': 'ts-jest', | ||
| }, | ||
| coverageDirectory: './coverage', | ||
| setupFilesAfterEnv: ['./config/tests.js'], | ||
| snapshotSerializers: ['@griffel/jest-serializer'], | ||
| }; |
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,3 @@ | ||
| import { preset } from '@fluentui/scripts-tasks'; | ||
|
|
||
| preset(); |
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,59 @@ | ||
| { | ||
| "name": "@fluentui/react-virtualizer", | ||
| "version": "9.0.0-alpha.0", | ||
| "description": "Generic and composable virtualizer framework built on browser intersection observer", | ||
| "main": "lib-commonjs/index.js", | ||
| "module": "lib/index.js", | ||
| "typings": "./dist/index.d.ts", | ||
| "sideEffects": false, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/microsoft/fluentui" | ||
| }, | ||
| "license": "MIT", | ||
| "scripts": { | ||
| "build": "just-scripts build", | ||
| "clean": "just-scripts clean", | ||
| "code-style": "just-scripts code-style", | ||
| "just": "just-scripts", | ||
| "lint": "just-scripts lint", | ||
| "test": "jest --passWithNoTests", | ||
| "storybook": "start-storybook", | ||
| "start": "yarn storybook", | ||
| "generate-api": "tsc -p ./tsconfig.lib.json --emitDeclarationOnly && just-scripts api-extractor", | ||
| "type-check": "tsc -b tsconfig.json" | ||
| }, | ||
| "devDependencies": { | ||
| "@fluentui/eslint-plugin": "*", | ||
| "@fluentui/react-conformance": "*", | ||
| "@fluentui/react-conformance-griffel": "9.0.0-beta.19", | ||
| "@fluentui/scripts-api-extractor": "*", | ||
| "@fluentui/scripts-tasks": "*" | ||
| }, | ||
| "dependencies": { | ||
| "@fluentui/react-utilities": "^9.4.0", | ||
| "@griffel/react": "^1.5.2", | ||
| "tslib": "^2.1.0" | ||
| }, | ||
| "peerDependencies": { | ||
| "@types/react": ">=16.8.0 <18.0.0", | ||
| "@types/react-dom": ">=16.8.0 <18.0.0", | ||
| "react": ">=16.8.0 <18.0.0", | ||
| "react-dom": ">=16.8.0 <18.0.0" | ||
|
Comment on lines
+39
to
+42
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These should be up to 19.0.0
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Causing this bug #26859 |
||
| }, | ||
| "beachball": { | ||
| "disallowedChangeTypes": [ | ||
| "major", | ||
| "minor", | ||
| "patch" | ||
| ] | ||
| }, | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "import": "./lib/index.js", | ||
| "require": "./lib-commonjs/index.js" | ||
| }, | ||
| "./package.json": "./package.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 @@ | ||
| export * from './hooks/index'; |
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/Virtualizer/index'; |
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.
Uh oh!
There was an error while loading. Please reload this page.