-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Tomi Virkki <[email protected]>
- Loading branch information
1 parent
60bdb4f
commit 10fe004
Showing
3 changed files
with
55 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Grid, type GridDataProvider } from '../../src/Grid.js'; | ||
import { GridSelectionColumn } from '../../src/GridSelectionColumn.js'; | ||
import { GridTreeColumn } from '../../src/GridTreeColumn.js'; | ||
import { GridColumn } from '../../src/GridColumn.js'; | ||
import { Tooltip } from '../../src/Tooltip.js'; | ||
|
||
type Item = { | ||
name: string; | ||
children: boolean; | ||
}; | ||
|
||
const dataProvider: GridDataProvider<Item> = ({ parentItem, page, pageSize }, cb) => { | ||
const levelSize = parentItem ? 5 : 100; | ||
|
||
const pageItems = [...Array(Math.min(levelSize, pageSize))].map((_, i) => { | ||
const indexInLevel = page * pageSize + i; | ||
|
||
return { | ||
name: `${parentItem ? parentItem.name + '-' : ''}${indexInLevel}`, | ||
children: true, | ||
}; | ||
}); | ||
|
||
cb(pageItems, levelSize); | ||
}; | ||
|
||
export default function () { | ||
return ( | ||
<Grid itemIdPath="name" dataProvider={dataProvider}> | ||
<GridSelectionColumn frozen autoSelect dragSelect /> | ||
<GridTreeColumn frozen path="name" width="200px" /> | ||
<GridColumn path="name" width="200px" /> | ||
<GridColumn path="name" width="200px" /> | ||
<GridColumn path="name" width="200px" /> | ||
|
||
<Tooltip slot="tooltip" hoverDelay={500} hideDelay={500} /> | ||
</Grid> | ||
); | ||
} |
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