Skip to content

Commit a592dbf

Browse files
committed
update document
1 parent 7aa6a89 commit a592dbf

File tree

3 files changed

+96
-3
lines changed

3 files changed

+96
-3
lines changed

README.md

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,67 @@
1-
# @jswl/vindow
1+
# @react-libraries/virtual-window
22

33
## Description
44

55
VirtualWindow for React
66

7+
## Image
8+
9+
![image](https://user-images.githubusercontent.com/54426986/106378682-07d79c80-63ea-11eb-8934-d0c150f5b340.gif)
10+
11+
## Example
12+
13+
```tsx
14+
const SampleComponent = () => (
15+
<VirtualWindow title="Title" width={200} height={100}>
16+
Contents
17+
</VirtualWindow>
18+
);
19+
```
20+
721
## Storybook
822

9-
[Storybook](https://reactlibraries.github.io/virtual-window/captures/master/stories/?path=/docs/components-virtualwindow--primary)
23+
[Storybook samples](https://reactlibraries.github.io/virtual-window/captures/master/stories/?path=/docs/components-virtualwindow--primary)
24+
25+
## \<VirtualWindow> parameters
26+
27+
| Name | Type | Default | Description |
28+
| ------------- | ------------------------------ | ------------------------------ | ----------------------------------------------------- |
29+
| title | ReactNode | "" | Window title |
30+
| overlapped | boolean | true | Whether to set position to fixed |
31+
| titleEnable | boolean | true | Whether to display the title |
32+
| titleSize | number | 32 | Title bar size |
33+
| titleButtons | {} | {max:true,min:true,close:true} | Presence or absence of a button attached to the title |
34+
| active | boolean | false | Whether to activate in the initial state |
35+
| baseX | start \| center \| end | start | Placement criteria in the X direction |
36+
| baseY | start \| center \| end | start | Placement criteria in the Y direction |
37+
| x | number | 0 | Initial X position |
38+
| y | number | 0 | Initial Y position |
39+
| width | number | 640 | Initial width |
40+
| height | number | 480 | Initial height |
41+
| state | normal \| max \| min \| close | normal | Window state |
42+
| frameSize | number | 1 | Frame size |
43+
| resize | boolean | true | Whether to allow resizing |
44+
| resizeBold | number | 8 | Invisible frame size for resizing |
45+
| clientStyle | React.CSSProperties | undefined | Client style |
46+
| clientClass | string | undefined | Client class name |
47+
| clientMovable | boolean | false | Whether the client can be dragged and dropped |
48+
| dispatch | Ref | undefined | Dispatch for parameter setting |
49+
| onUpdate | (params: WindowParams) => void | undefined | State change event |
50+
51+
## WindowParams
52+
53+
| Name | Type | Description |
54+
| ------ | ------------------------- | --------------- |
55+
| active | boolean | Window active |
56+
| x | number | Current x |
57+
| y | number | Current y |
58+
| width | number | Current width |
59+
| height | number | Current height |
60+
| state | normal \|max\|min \|close | Window state |
61+
| init | boolean | Initial display |
62+
63+
## dispatch
64+
65+
`dispatch({type:"state", payload:'normal'|'max'|'min'|'close'});`
66+
`dispatch({type:"position", payload:{x:number,y:number}});`
67+
`dispatch({type:"size", payload:{width:number,height:number}});`

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@react-libraries/virtual-window",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"main": "dist/index.js",
55
"license": "MIT",
66
"author": "SoraKumo <[email protected]>",

src/Types/types.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,47 @@ export interface CustomEvent extends Event {
6363
}
6464

6565
export type WindowParams = {
66+
/**
67+
* Window active
68+
*
69+
* @type {boolean}
70+
*/
6671
active: boolean;
72+
/**
73+
* Current x
74+
*
75+
* @type {number}
76+
*/
6777
x: number;
78+
/**
79+
* Current y
80+
*
81+
* @type {number}
82+
*/
6883
y: number;
84+
/**
85+
* Current width
86+
*
87+
* @type {number}
88+
*/
6989
width: number;
90+
/**
91+
* Current height
92+
*
93+
* @type {number}
94+
*/
7095
height: number;
96+
/**
97+
* Current state
98+
*
99+
* @type {WindowState}
100+
*/
71101
state: WindowState;
102+
/**
103+
* Initial display
104+
*
105+
* @type {boolean}
106+
*/
72107
init: boolean;
73108
};
74109

0 commit comments

Comments
 (0)