chore: docs

This commit is contained in:
mathuo 2023-03-19 22:36:24 +04:00
parent c44ccfa52e
commit d1f67828e3
No known key found for this signature in database
GPG Key ID: C6EEDEFD6CA07281
3 changed files with 28 additions and 16 deletions

View File

@ -656,8 +656,26 @@ const GroupControlComponent = (props: IDockviewGroupControlProps) => {
<DockviewGroupControl /> <DockviewGroupControl />
</Container> </Container>
### Constraints
You may wish to specify a minimum or maximum height or width for a group which can be done through the group api.
```tsx
api.group.api.setConstraints(...)
```
> Constraints are currently only supported for groups and not individual panels.
> If you specific a constraint on a group and move a panel within that group to another group it will no
> longer be subject to those constraints since those constraints were on the group and not on the individual panel.
<Container>
<DockviewConstraints />
</Container>
## Events ## Events
A simple example showing events fired by `dockviewz that can be interacted with.
<Container height={600}> <Container height={600}>
<EventsDockview /> <EventsDockview />
</Container> </Container>
@ -684,9 +702,3 @@ hello 2
<div style={{ height: '400px', width: '100%' }}> <div style={{ height: '400px', width: '100%' }}>
<App /> <App />
</div> </div>
## Contraints
<Container>
<DockviewConstraints />
</Container>

View File

@ -71,7 +71,7 @@ const App = () => {
const [api, setApi] = React.useState<DockviewApi>(); const [api, setApi] = React.useState<DockviewApi>();
const onReady = (event: DockviewReadyEvent) => { const onReady = (event: DockviewReadyEvent) => {
event.api.addPanel({ const panel = event.api.addPanel({
id: 'panel_1', id: 'panel_1',
component: 'default', component: 'default',
}); });

View File

@ -182,49 +182,49 @@ const EventsDockview = () => {
panels: { panels: {
panel_1: { panel_1: {
id: 'panel_1', id: 'panel_1',
view: { content: { id: 'default' } }, contentComponent: 'default',
params: { title: 'Panel 1' }, params: { title: 'Panel 1' },
title: 'panel_1', title: 'panel_1',
}, },
panel_2: { panel_2: {
id: 'panel_2', id: 'panel_2',
view: { content: { id: 'default' } }, contentComponent: 'default',
params: { title: 'Panel 2' }, params: { title: 'Panel 2' },
title: 'panel_2', title: 'panel_2',
}, },
panel_3: { panel_3: {
id: 'panel_3', id: 'panel_3',
view: { content: { id: 'default' } }, contentComponent: 'default',
params: { title: 'Panel 3' }, params: { title: 'Panel 3' },
title: 'panel_3', title: 'panel_3',
}, },
panel_4: { panel_4: {
id: 'panel_4', id: 'panel_4',
view: { content: { id: 'default' } }, contentComponent: 'default',
params: { title: 'Panel 4' }, params: { title: 'Panel 4' },
title: 'panel_4', title: 'panel_4',
}, },
panel_5: { panel_5: {
id: 'panel_5', id: 'panel_5',
view: { content: { id: 'default' } }, contentComponent: 'default',
params: { title: 'Panel 5' }, params: { title: 'Panel 5' },
title: 'panel_5', title: 'panel_5',
}, },
panel_6: { panel_6: {
id: 'panel_6', id: 'panel_6',
view: { content: { id: 'default' } }, contentComponent: 'default',
params: { title: 'Panel 6' }, params: { title: 'Panel 6' },
title: 'panel_6', title: 'panel_6',
}, },
panel_8: { panel_8: {
id: 'panel_8', id: 'panel_8',
view: { content: { id: 'default' } }, contentComponent: 'default',
params: { title: 'Panel 8' }, params: { title: 'Panel 8' },
title: 'panel_8', title: 'panel_8',
}, },
panel_7: { panel_7: {
id: 'panel_7', id: 'panel_7',
view: { content: { id: 'default' } }, contentComponent: 'default',
params: { title: 'Panel 7' }, params: { title: 'Panel 7' },
title: 'panel_7', title: 'panel_7',
}, },
@ -334,7 +334,7 @@ const EventsDockview = () => {
className="dockview-theme-abyss" className="dockview-theme-abyss"
/> />
</div> </div>
<div style={{ flexGrow: 1 }}> <div style={{ flexGrow: 1, paddingTop: '5px' }}>
<Console lines={lines} /> <Console lines={lines} />
</div> </div>
</div> </div>