1- import { ICommonProps , Type , SizeUnit , IPositionalProps , AnchorType } from "../core-types" ;
1+ import { Type , SizeUnit , IPositionalProps , AnchorType , ResizeType , ResizeHandlePlacement } from "../core-types" ;
22import * as React from "react" ;
33import { Space } from "./Space" ;
44import * as PropTypes from "prop-types" ;
5- import { commonProps } from "../core-react" ;
5+ import { commonProps , IReactSpaceProps } from "../core-react" ;
66
7- interface ICustomProps extends ICommonProps {
7+ interface ICustomProps extends IReactSpaceProps {
88 left ?: SizeUnit | undefined ;
99 top ?: SizeUnit | undefined ;
1010 right ?: SizeUnit | undefined ;
@@ -15,7 +15,9 @@ interface ICustomProps extends ICommonProps {
1515 anchor ?: AnchorType ;
1616 anchorSize ?: SizeUnit ;
1717 resizable ?: boolean ;
18+ resizeTypes ?: ResizeType [ ] ;
1819 handleSize ?: number ;
20+ handlePlacement ?: ResizeHandlePlacement ;
1921 overlayHandle ?: boolean ;
2022 minimumSize ?: number ;
2123 maximumSize ?: number ;
@@ -35,30 +37,47 @@ export const Custom: React.FC<ICustomProps> = ({
3537 anchor,
3638 isPositioned,
3739 resizable,
40+ resizeTypes,
3841 ...props
3942} ) => {
4043 let position : IPositionalProps ;
4144 let type = Type . Positioned ;
4245
4346 if ( ! isPositioned ) {
4447 if ( anchor === AnchorType . Left ) {
45- position = { left : 0 , top : 0 , bottom : 0 , width : anchorSize , right : undefined , rightResizable : resizable } ;
48+ position = { left : 0 , top : 0 , bottom : 0 , width : anchorSize , rightResizable : resizable } ;
4649 type = Type . Anchored ;
4750 } else if ( anchor === AnchorType . Right ) {
48- position = { right : 0 , top : 0 , bottom : 0 , width : anchorSize , left : undefined , leftResizable : resizable } ;
51+ position = { right : 0 , top : 0 , bottom : 0 , width : anchorSize , leftResizable : resizable } ;
4952 type = Type . Anchored ;
5053 } else if ( anchor === AnchorType . Top ) {
51- position = { left : 0 , top : 0 , right : 0 , height : anchorSize , bottom : undefined , bottomResizable : resizable } ;
54+ position = { left : 0 , top : 0 , right : 0 , height : anchorSize , bottomResizable : resizable } ;
5255 type = Type . Anchored ;
5356 } else if ( anchor === AnchorType . Bottom ) {
54- position = { left : 0 , bottom : 0 , right : 0 , height : anchorSize , top : undefined , topResizable : resizable } ;
57+ position = { left : 0 , bottom : 0 , right : 0 , height : anchorSize , topResizable : resizable } ;
5558 type = Type . Anchored ;
5659 } else {
57- position = { left : 0 , top : 0 , bottom : 0 , right : 0 , width : undefined , height : undefined } ;
60+ position = {
61+ left : 0 ,
62+ top : 0 ,
63+ bottom : 0 ,
64+ right : 0 ,
65+ } ;
5866 type = Type . Fill ;
5967 }
6068 } else {
61- position = { left : left , top : top , right : right , bottom : bottom , width : width , height : height } ;
69+ position = {
70+ left : left ,
71+ top : top ,
72+ right : right ,
73+ bottom : bottom ,
74+ width : width ,
75+ height : height ,
76+ leftResizable : resizeTypes && resizeTypes . includes ( ResizeType . Left ) ,
77+ topResizable : resizeTypes && resizeTypes . includes ( ResizeType . Top ) ,
78+ rightResizable : resizeTypes && resizeTypes . includes ( ResizeType . Right ) ,
79+ bottomResizable : resizeTypes && resizeTypes . includes ( ResizeType . Bottom ) ,
80+ } ;
6281 }
6382
6483 return (
0 commit comments