@@ -6,6 +6,8 @@ import { IReactSpaceCommonProps } from "../core-react";
66import { anchoredProps , IAnchorProps } from "./Anchored" ;
77
88type ICustomProps = Omit < IReactSpaceCommonProps & IAnchorProps , "size" > & {
9+ type ?: Type ;
10+
911 // Anchored
1012 anchor ?: AnchorType ;
1113 anchorSize ?: SizeUnit ;
@@ -17,13 +19,14 @@ type ICustomProps = Omit<IReactSpaceCommonProps & IAnchorProps, "size"> & {
1719 bottom ?: SizeUnit | undefined ;
1820 width ?: SizeUnit | undefined ;
1921 height ?: SizeUnit | undefined ;
20- isPositioned ?: boolean ;
2122 resizeTypes ?: ResizeType [ ] ;
2223} ;
2324
2425const customProps = {
2526 ...anchoredProps ,
2627 ...{
28+ type : PropTypes . oneOf ( [ Type . Positioned , Type . Fill , Type . Anchored ] ) ,
29+
2730 anchor : PropTypes . oneOf ( [ AnchorType . Left , AnchorType . Top , AnchorType . Right , AnchorType . Bottom ] ) ,
2831 anchorSize : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
2932
@@ -33,13 +36,13 @@ const customProps = {
3336 bottom : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
3437 width : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
3538 height : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
36- isPositioned : PropTypes . bool ,
37- resizeTypes : PropTypes . any ,
39+ resizeTypes : PropTypes . array ,
3840 } ,
3941} ;
4042
4143export const Custom : React . FC < ICustomProps > = ( {
4244 children,
45+ type,
4346 left,
4447 top,
4548 right,
@@ -48,15 +51,27 @@ export const Custom: React.FC<ICustomProps> = ({
4851 height,
4952 anchorSize,
5053 anchor,
51- isPositioned,
5254 resizable,
5355 resizeTypes,
5456 ...props
5557} ) => {
5658 let position : IPositionalProps ;
57- let type = Type . Positioned ;
59+ type = type || Type . Fill ;
5860
59- if ( ! isPositioned ) {
61+ if ( type === Type . Positioned ) {
62+ position = {
63+ left : left ,
64+ top : top ,
65+ right : right ,
66+ bottom : bottom ,
67+ width : width ,
68+ height : height ,
69+ leftResizable : resizeTypes && resizeTypes . includes ( ResizeType . Left ) ,
70+ topResizable : resizeTypes && resizeTypes . includes ( ResizeType . Top ) ,
71+ rightResizable : resizeTypes && resizeTypes . includes ( ResizeType . Right ) ,
72+ bottomResizable : resizeTypes && resizeTypes . includes ( ResizeType . Bottom ) ,
73+ } ;
74+ } else {
6075 if ( anchor === AnchorType . Left ) {
6176 position = { left : 0 , top : 0 , bottom : 0 , width : anchorSize , rightResizable : resizable } ;
6277 type = Type . Anchored ;
@@ -78,19 +93,6 @@ export const Custom: React.FC<ICustomProps> = ({
7893 } ;
7994 type = Type . Fill ;
8095 }
81- } else {
82- position = {
83- left : left ,
84- top : top ,
85- right : right ,
86- bottom : bottom ,
87- width : width ,
88- height : height ,
89- leftResizable : resizeTypes && resizeTypes . includes ( ResizeType . Left ) ,
90- topResizable : resizeTypes && resizeTypes . includes ( ResizeType . Top ) ,
91- rightResizable : resizeTypes && resizeTypes . includes ( ResizeType . Right ) ,
92- bottomResizable : resizeTypes && resizeTypes . includes ( ResizeType . Bottom ) ,
93- } ;
9496 }
9597
9698 return (
0 commit comments