Skip to content

Commit

Permalink
maxSizeClass minSizeClass
Browse files Browse the repository at this point in the history
  • Loading branch information
BipanKishore committed May 5, 2024
1 parent 35cf40d commit 154b2e7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/@types/component-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ export interface IPane {
minSize?: number;
resizer?: ReactNode;
resizerSize?: number;
minSizeClass?: string,
maxSizeClass?: string,
onMinSize?: (id: string, minSize:number) => void,
onMaxSize?: (id: string, maxSize:number) => void,
onNormalSize?: (id: string) => void
Expand Down
1 change: 1 addition & 0 deletions src/components/pane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const Pane = (props: IPane) => {

registerItem(
{
node,
destroy,
setSize
},
Expand Down
5 changes: 5 additions & 0 deletions src/models/pane-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,17 @@ export class PaneModel {

if (this.sizeState !== newSetSize) {
if (newSetSize === NORMAL_SIZE_STATE) {
this.api.node.classList.remove(props.minSizeClass, props.maxSizeClass)
props.onNormalSize(id)
}
if (newSetSize === MIN_SIZE_STATE) {
this.api.node.classList.remove(props.maxSizeClass)
this.api.node.classList.add(props.minSizeClass)
props.onMinSize(id, size)
}
if (newSetSize === MAX_SIZE_STATE) {
this.api.node.classList.remove(props.minSizeClass)
this.api.node.classList.add(props.maxSizeClass)
props.onMaxSize(id, size)
}
this.sizeState = newSetSize
Expand Down
2 changes: 2 additions & 0 deletions src/models/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export const attachDefaultPaneProps = (paneProps: IPane) => {
onNormalSize: noop,
onMinSize: noop,
onMaxSize: noop,
maxSizeClass: '',
minSizeClass: '',
minSize: 0,
maxSize: Infinity,
...propsWithNoUndefined
Expand Down

0 comments on commit 154b2e7

Please sign in to comment.