Closed jancimertel closed 1 year ago
I'm glad you found it easy to use - I'm still working on the documentation and hoping to add a number of new examples linked to CodeSandbox soon to allow people to view and edit the code behind the examples too. I've tried to answer your question below with some detail.
TLDR: This should work for the group api props.api.group.api.setConstraints(...)
and is a bug that I will fix. To set this directly on a panel is slightly more complicated but I understand why it could be required.
Long Answer: When using the DockviewReact
component a user adds panels which are added to groups. Internally what's being resized when you drag the resize handles is the group, the group resizes which then forces the panel to resize with the group.
The class representing the group does contain variables minimumWidth
, maximumWidth
, minimumHeight
and maximumHeight
which are used to maintain minimum and maximum dimensions on the groups and by default the minimums are set to 100px
and the maximums are set to Number.MAX_SAFE_INTEGER
.
You will see this in action if you try and minimize a group. You will not be able to make it smaller than
100px
in either the vertical (height) or horizontal (width) direction.
From the props objects when you define a panel you can access the panel api via props.api
. You can also access the group object via priops.api.group
and the group api via the rather ugly expresssion props.api.group.api
(this should really just be simplified to props.group.api
but that's another problem).
Both the panel and group api expose the method setContraints
and neither unfortuantely work currently. The fact that it doesn't work for props.api.group.api.setContraints(...)
is actually a bug, this should work and I will get this fixed. For the panel it's slightly more complicated since a panel doesn't currently have the concept of a miniumum and maximum width and height, the panel just derives this information from it's associated group.
The above fixes were released in version 1.7.0. setContraints
on the panel has been removed whilst a valid solution for this is thought out. setContraints
on the group continues to exist and has been fixed.
thank you! works nicely.
Hello.
Thank you for the package, i found it convenient and easy to use. Still, a problem occured:
Im not sure if i understand the
setConstraints
method from here, but it does seem not to work - no restrictions applied. setSize works, but to keep the group's size in required range, i need to call it repeatedly.Any plan for the setConstraints to be fixed? Or is there any plan to use boolean flag to lock some group's size?