-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stabilized virtualization algo for horizontal layout
- Loading branch information
1 parent
186b124
commit 54c9679
Showing
13 changed files
with
324 additions
and
33 deletions.
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
101 changes: 101 additions & 0 deletions
101
examples/src/pages/tests/horizontal-layout/example.page.tsx
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,101 @@ | ||
import * as React from 'react'; | ||
|
||
import { | ||
InfiniteTable, | ||
InfiniteTablePropColumns, | ||
} from '@infinite-table/infinite-react'; | ||
import { DataSource } from '@infinite-table/infinite-react'; | ||
|
||
type Developer = { | ||
id: number; | ||
|
||
firstName: string; | ||
lastName: string; | ||
|
||
currency: string; | ||
country: string; | ||
preferredLanguage: string; | ||
stack: string; | ||
canDesign: 'yes' | 'no'; | ||
|
||
age: number; | ||
salary: number; | ||
}; | ||
|
||
const style = () => { | ||
return { | ||
background: `rgb(255 0 0 / 12%)`, | ||
}; | ||
}; | ||
|
||
const columns: InfiniteTablePropColumns<Developer> = { | ||
id: { | ||
field: 'id', | ||
type: 'number', | ||
style, | ||
}, | ||
canDesign: { | ||
field: 'canDesign', | ||
}, | ||
salary: { | ||
field: 'salary', | ||
type: 'number', | ||
// style, | ||
}, | ||
firstName: { | ||
field: 'firstName', | ||
}, | ||
age: { | ||
field: 'age', | ||
type: 'number', | ||
// style, | ||
}, | ||
|
||
stack: { field: 'stack', renderMenuIcon: false }, | ||
currency: { field: 'currency' }, | ||
country: { field: 'country' }, | ||
}; | ||
|
||
export default () => { | ||
const dataSource = React.useCallback(() => { | ||
return fetch(process.env.NEXT_PUBLIC_BASE_URL + '/developers100') | ||
.then((r) => r.json()) | ||
.then((data) => { | ||
return data; | ||
// return new Promise((resolve) => { | ||
// setTimeout(() => { | ||
// resolve(data); | ||
// }, 10); | ||
// }); | ||
}); | ||
}, []); | ||
return ( | ||
<> | ||
<React.StrictMode> | ||
<DataSource<Developer> | ||
data={dataSource} | ||
primaryKey="id" | ||
defaultGroupBy={[ | ||
{ | ||
field: 'currency', | ||
}, | ||
{ | ||
field: 'stack', | ||
}, | ||
]} | ||
> | ||
<InfiniteTable<Developer> | ||
columns={columns} | ||
wrapRowsHorizontally={true} | ||
columnDefaultWidth={120} | ||
domProps={{ | ||
style: { | ||
minHeight: '70vh', | ||
}, | ||
}} | ||
/> | ||
</DataSource> | ||
</React.StrictMode> | ||
</> | ||
); | ||
}; |
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
Oops, something went wrong.