react-split-pane 0.1.77 → 0.1.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -44
- package/dist/index.cjs.js +799 -0
- package/dist/index.esm.js +795 -0
- package/index.d.ts +34 -32
- package/package.json +57 -32
- package/.editorconfig +0 -6
- package/.idea/jsLibraryMappings.xml +0 -6
- package/.idea/misc.xml +0 -7
- package/.idea/modules.xml +0 -8
- package/.idea/react-split-pane.iml +0 -9
- package/.idea/shelf/Get_Resizer_dimensions/shelved.patch +0 -206
- package/.idea/shelf/Get_Resizer_dimensions.xml +0 -4
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -1659
- package/.npmignore +0 -4
- package/.travis.yml +0 -10
- package/index.js +0 -3
- package/lib/Pane.js +0 -104
- package/lib/Resizer.js +0 -115
- package/lib/SplitPane.js +0 -422
- package/tsconfig.json +0 -11
package/README.md
CHANGED
|
@@ -1,37 +1,44 @@
|
|
|
1
1
|
# React Split Pane
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/react-split-pane)
|
|
4
|
+

|
|
5
|
+
[](https://npmcharts.com/compare/react-split-pane?minimal=true)
|
|
6
|
+
[](https://npmcharts.com/compare/react-split-pane?minimal=true)
|
|
9
7
|
[](https://travis-ci.org/tomkp/react-split-pane)
|
|
10
8
|
[](https://coveralls.io/r/tomkp/react-split-pane)
|
|
11
9
|
|
|
10
|
+
Split-Pane React component, can be nested or split vertically or horizontally. Check out some demos [here](http://react-split-pane.surge.sh/)!
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
## Installing
|
|
13
|
+
```sh
|
|
14
|
+
npm install react-split-pane
|
|
14
15
|
|
|
16
|
+
# or if you use yarn
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
<SplitPane split="vertical" minSize={50} defaultSize={100}>
|
|
18
|
-
<div></div>
|
|
19
|
-
<div></div>
|
|
20
|
-
</SplitPane>
|
|
18
|
+
yarn add react-split-pane
|
|
21
19
|
```
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
## Example Usage
|
|
22
|
+
```jsx
|
|
23
|
+
<SplitPane split="vertical" minSize={50} defaultSize={100}>
|
|
24
|
+
<div></div>
|
|
25
|
+
<div></div>
|
|
26
|
+
</SplitPane>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```jsx
|
|
30
|
+
<SplitPane split="vertical" minSize={50}>
|
|
31
|
+
<div></div>
|
|
32
|
+
<SplitPane split="horizontal">
|
|
33
|
+
<div></div>
|
|
34
|
+
<div></div>
|
|
35
|
+
</SplitPane>
|
|
36
|
+
</SplitPane>
|
|
31
37
|
```
|
|
32
38
|
|
|
33
|
-
|
|
39
|
+
## Props
|
|
34
40
|
|
|
41
|
+
### primary
|
|
35
42
|
By dragging 'draggable' surface you can change size of the first pane.
|
|
36
43
|
The first pane keeps then its size while the second pane is resized by browser window.
|
|
37
44
|
By default it is the left pane for 'vertical' SplitPane and the top pane for 'horizontal' SplitPane.
|
|
@@ -44,7 +51,7 @@ You can also set the size of the pane using the `size` prop. Note that a size se
|
|
|
44
51
|
|
|
45
52
|
In this example right pane keeps its width 200px while user is resizing browser window.
|
|
46
53
|
|
|
47
|
-
```
|
|
54
|
+
```jsx
|
|
48
55
|
<SplitPane split="vertical" defaultSize={200} primary="second">
|
|
49
56
|
<div></div>
|
|
50
57
|
<div></div>
|
|
@@ -63,7 +70,25 @@ size of the 'resizable' pane in this case). This can be useful also in the full-
|
|
|
63
70
|
### step
|
|
64
71
|
You can use the step prop to only allow resizing in fixed increments.
|
|
65
72
|
|
|
66
|
-
###
|
|
73
|
+
### onDragStarted
|
|
74
|
+
This callback is invoked when a drag starts.
|
|
75
|
+
|
|
76
|
+
### onDragFinished
|
|
77
|
+
This callback is invoked when a drag ends.
|
|
78
|
+
|
|
79
|
+
### onChange
|
|
80
|
+
This callback is invoked with the current drag during a drag event. It is recommended that it is wrapped in a debounce function.
|
|
81
|
+
|
|
82
|
+
### Inline Styles
|
|
83
|
+
|
|
84
|
+
You can also pass inline styles to the components via props. These are:
|
|
85
|
+
|
|
86
|
+
* `paneStyle` - Styling to be applied to both panes
|
|
87
|
+
* `pane1Style` - Styling to be applied to the first pane, with precedence over `paneStyle`
|
|
88
|
+
* `pane2Style` - Styling to be applied to the second pane, with precedence over `paneStyle`
|
|
89
|
+
* `resizerStyle` - Styling to be applied to the resizer bar
|
|
90
|
+
|
|
91
|
+
## Persisting Positions
|
|
67
92
|
|
|
68
93
|
Each SplitPane accepts an onChange function prop. Used in conjunction with
|
|
69
94
|
defaultSize and a persistence layer, you can ensure that your splitter choices
|
|
@@ -72,7 +97,7 @@ survive a refresh of your app.
|
|
|
72
97
|
For example, if you are comfortable with the trade-offs of localStorage, you
|
|
73
98
|
could do something like the following:
|
|
74
99
|
|
|
75
|
-
```
|
|
100
|
+
```jsx
|
|
76
101
|
<SplitPane split="vertical" minSize={50}
|
|
77
102
|
defaultSize={ parseInt(localStorage.getItem('splitPos'), 10) }
|
|
78
103
|
onChange={ size => localStorage.setItem('splitPos', size) }>
|
|
@@ -96,12 +121,7 @@ https://github.com/mozilla/localForage although hooking it up will be slightly
|
|
|
96
121
|
more involved. You are likely to be admired by all for judiciously avoiding
|
|
97
122
|
use of localStorage.
|
|
98
123
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
If you need more control over resizing, SplitPane can notify you about when resizing started
|
|
102
|
-
and when it ended through two callbacks: `onDragStarted` and `onDragFinished`.
|
|
103
|
-
|
|
104
|
-
### Example styling
|
|
124
|
+
## Example styling
|
|
105
125
|
|
|
106
126
|
This gives a single pixel wide divider, but with a 'grabbable' surface of 11 pixels.
|
|
107
127
|
|
|
@@ -161,23 +181,13 @@ Thanks to ```background-clip: padding-box;``` for making transparent borders pos
|
|
|
161
181
|
}
|
|
162
182
|
|
|
163
183
|
```
|
|
164
|
-
### Inline Styles
|
|
165
184
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
* `paneStyle` - Styling to be applied to both panes
|
|
169
|
-
* `pane1Style` - Styling to be applied to the first pane, with precedence over `paneStyle`
|
|
170
|
-
* `pane2Style` - Styling to be applied to the second pane, with precedence over `paneStyle`
|
|
171
|
-
* `resizerStyle` - Styling to be applied to the resizer bar
|
|
185
|
+
## Contributing
|
|
172
186
|
|
|
173
|
-
|
|
174
|
-
### Contributing
|
|
175
|
-
|
|
176
|
-
I'm always happy to receive Pull Requests for contributions of any kind.
|
|
187
|
+
I'm always happy to receive Pull Requests for contributions of any kind.
|
|
177
188
|
|
|
178
189
|
Please include tests and/or update the examples if possible.
|
|
179
|
-
|
|
190
|
+
|
|
180
191
|
**I'm working on an updated version of this library, and looking for help:** https://github.com/tomkp/react-split-pane/pull/240
|
|
181
|
-
|
|
192
|
+
|
|
182
193
|
Thanks, Tom
|
|
183
|
-
|