Skip to content

Commit 320eff7

Browse files
committed
Merge branch 'feature/resize-handles' into feature/97-custom-resize-handles
# Conflicts: # src/core-types.ts
2 parents c872c7b + 01d9aae commit 320eff7

36 files changed

+7372
-5455
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
.env.test.local
1818
.env.production.local
1919

20+
debug.log*
2021
npm-debug.log*
2122
yarn-debug.log*
2223
yarn-error.log*
2324
**/.rpt2_cache
2425
**/.next
25-
**/storybook-static
26+
**/storybook-static
27+
.vscode

.storybook/preview-head.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,9 @@
2222

2323
.spaces-resize-handle {
2424
background-color: red !important;
25+
opacity: 0.5;
26+
}
27+
.innerZoomElementWrapper .spaces-fullpage-layout {
28+
position: absolute !important;
2529
}
2630
</style>

npm-audit.html

Lines changed: 2382 additions & 0 deletions
Large diffs are not rendered by default.

package-lock.json

Lines changed: 3692 additions & 5089 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
},
3333
"devDependencies": {
3434
"@babel/core": "^7.5.5",
35-
"@storybook/addon-actions": "^6.3.2",
36-
"@storybook/addon-docs": "^6.3.2",
37-
"@storybook/addon-knobs": "^6.2.9",
38-
"@storybook/addon-links": "^6.3.2",
39-
"@storybook/addons": "^6.3.2",
40-
"@storybook/react": "^6.3.2",
41-
"@testing-library/jest-dom": "^5.5.0",
42-
"@testing-library/react": "^10.0.3",
35+
"@storybook/addon-actions": "^6.3.12",
36+
"@storybook/addon-docs": "^6.3.12",
37+
"@storybook/addon-knobs": "^6.3.1",
38+
"@storybook/addon-links": "^6.3.12",
39+
"@storybook/addons": "^6.3.12",
40+
"@storybook/react": "^6.3.12",
41+
"@testing-library/jest-dom": "^5.15.0",
42+
"@testing-library/react": "^12.1.2",
4343
"@types/jest": "^24.0.15",
4444
"@types/node": "^12.6.8",
4545
"@types/prop-types": "^15.7.3",
@@ -55,25 +55,25 @@
5555
"jest-expect-message": "^1.0.2",
5656
"node-sass": "^4.14.1",
5757
"prettier": "^1.19.1",
58-
"react": "^16.13.1",
58+
"react": "^17.0.2",
5959
"react-docgen-typescript-loader": "^3.7.0",
60-
"react-dom": "^16.13.1",
61-
"rollup": "^1.19.4",
60+
"react-dom": "^17.0.2",
61+
"rollup": "^2.60.0",
6262
"rollup-plugin-babel": "^4.3.3",
6363
"rollup-plugin-commonjs": "^10.0.2",
6464
"rollup-plugin-fork-ts-checker": "0.0.6",
6565
"rollup-plugin-node-resolve": "^5.2.0",
6666
"rollup-plugin-postcss": "^2.0.3",
6767
"rollup-plugin-replace": "^2.2.0",
6868
"rollup-plugin-sourcemaps": "^0.4.2",
69-
"rollup-plugin-typescript2": "^0.22.1",
69+
"rollup-plugin-typescript2": "^0.30.0",
7070
"rollup-plugin-uglify": "^6.0.4",
7171
"rollup-watch": "^4.3.1",
7272
"sass-loader": "^8.0.2",
7373
"ts-jest": "^25.4.0",
7474
"ts-loader": "^6.2.1",
75-
"tslib": "^1.10.0",
76-
"typescript": "^3.9.9"
75+
"tslib": "^2.3.1",
76+
"typescript": "^4.4.4"
7777
},
7878
"resolutions": {
7979
"cssstyle": "2.3.0"

proposed.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const Window : React.FC = ({children}) => {
2+
const Inner : React.FC = ({ children }) => {
3+
const { startMouseDrag } = useSpaceContext();
4+
5+
return (
6+
<>
7+
<Top size={30} className="title-bar" onMouseDown={e => startMouseDrag(e)}>Title</Top>
8+
<Fill className="contents">
9+
{children}
10+
</Fill>
11+
</>
12+
)
13+
}
14+
15+
return (
16+
<Positioned className="window">
17+
<ResizeHandle size={10} type="left" placement="overlay-boundary" />
18+
<ResizeHandle size={10} type="top" placement="overlay-boundary" />
19+
<ResizeHandle size={10} type="right" placement="overlay-boundary" />
20+
<ResizeHandle size={10} type="bottom" placement="overlay-boundary" />
21+
<Inner>{children}</Inner}
22+
</Positioned>
23+
)
24+
}

src/components/Anchored.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { ICommonProps, SizeUnit, Type, AnchorType, ResizeHandlePlacement } from "../core-types";
1+
import { SizeUnit, Type, AnchorType, ResizeHandlePlacement } from "../core-types";
22
import * as React from "react";
33
import { Space } from "./Space";
44
import * as PropTypes from "prop-types";
5-
import { commonProps } from "../core-react";
5+
import { commonProps, IReactSpaceProps } from "../core-react";
66

7-
interface IAnchorProps extends ICommonProps {
7+
interface IAnchorProps extends IReactSpaceProps {
88
size: SizeUnit;
99
order?: number;
1010
resizable?: boolean;

src/components/Custom.tsx

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { ICommonProps, Type, SizeUnit, IPositionalProps, AnchorType } from "../core-types";
1+
import { Type, SizeUnit, IPositionalProps, AnchorType, ResizeType, ResizeHandlePlacement } from "../core-types";
22
import * as React from "react";
33
import { Space } from "./Space";
44
import * 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 (

src/components/Fill.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { ICommonProps, Type } from "../core-types";
1+
import { Type } from "../core-types";
22
import * as React from "react";
33
import { Space } from "./Space";
4-
import { commonProps } from "../core-react";
4+
import { commonProps, IReactSpaceProps } from "../core-react";
55

6-
export const Fill: React.FC<ICommonProps> = (props) => (
6+
export const Fill: React.FC<IReactSpaceProps> = (props) => (
77
<Space {...props} type={Type.Fill} position={{ left: 0, top: 0, right: 0, bottom: 0 }}>
88
{props.children}
99
</Space>

src/components/Fixed.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { ICommonProps, SizeUnit, Type } from "../core-types";
1+
import { SizeUnit, Type } from "../core-types";
22
import * as React from "react";
33
import { Space } from "./Space";
44
import * as PropTypes from "prop-types";
5-
import { commonProps } from "../core-react";
5+
import { commonProps, IReactSpaceProps } from "../core-react";
66

7-
interface IFixedProps extends ICommonProps {
7+
interface IFixedProps extends IReactSpaceProps {
88
width?: SizeUnit;
99
height: SizeUnit;
1010
}

0 commit comments

Comments
 (0)