react-split-pane 0.1.87 → 0.1.89
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/CHANGELOG.md +21 -0
- package/README.md +135 -89
- package/dist/index.cjs.js +18 -1935
- package/dist/index.esm.js +15 -1934
- package/package.json +22 -12
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
### [0.1.89](https://github.com/tomkp/react-split-pane/compare/v0.1.88...v0.1.89) (2019-11-12)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* also include named exports ([bfd16af](https://github.com/tomkp/react-split-pane/commit/bfd16afe8e4f186968ecfd73929a961a9525abed))
|
|
11
|
+
* ignore changelog in prettier ([7c0a6a4](https://github.com/tomkp/react-split-pane/commit/7c0a6a4f123fe266dece1d823bd0de580cca6507))
|
|
12
|
+
|
|
13
|
+
### [0.1.88](https://github.com/tomkp/react-split-pane/compare/v0.1.87...v0.1.88) (2019-11-12)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
- new less complex site w parcel and gh-pages deploys ([#378](https://github.com/tomkp/react-split-pane/issues/378)) ([ea98d68](https://github.com/tomkp/react-split-pane/commit/ea98d6853f71c479b3b351a4dd23520fe7595409))
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
- excluded react and react-dom from bundle ([#349](https://github.com/tomkp/react-split-pane/issues/349)) ([eb6b2bc](https://github.com/tomkp/react-split-pane/commit/eb6b2bc92873f1b671243de4f8fba96029f119df))
|
package/README.md
CHANGED
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
[](https://travis-ci.org/tomkp/react-split-pane)
|
|
8
8
|
[](https://coveralls.io/r/tomkp/react-split-pane)
|
|
9
9
|
|
|
10
|
-
Split-Pane React component, can be nested or split vertically or horizontally
|
|
10
|
+
Split-Pane React component, can be nested or split vertically or horizontally!
|
|
11
11
|
|
|
12
12
|
## Installing
|
|
13
|
+
|
|
13
14
|
```sh
|
|
14
15
|
npm install react-split-pane
|
|
15
16
|
|
|
@@ -19,26 +20,28 @@ yarn add react-split-pane
|
|
|
19
20
|
```
|
|
20
21
|
|
|
21
22
|
## Example Usage
|
|
23
|
+
|
|
22
24
|
```jsx
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
<SplitPane split="vertical" minSize={50} defaultSize={100}>
|
|
26
|
+
<div />
|
|
27
|
+
<div />
|
|
28
|
+
</SplitPane>
|
|
27
29
|
```
|
|
28
30
|
|
|
29
31
|
```jsx
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
</SplitPane>
|
|
32
|
+
<SplitPane split="vertical" minSize={50}>
|
|
33
|
+
<div />
|
|
34
|
+
<SplitPane split="horizontal">
|
|
35
|
+
<div />
|
|
36
|
+
<div />
|
|
36
37
|
</SplitPane>
|
|
38
|
+
</SplitPane>
|
|
37
39
|
```
|
|
38
40
|
|
|
39
41
|
## Props
|
|
40
42
|
|
|
41
43
|
### primary
|
|
44
|
+
|
|
42
45
|
By dragging 'draggable' surface you can change size of the first pane.
|
|
43
46
|
The first pane keeps then its size while the second pane is resized by browser window.
|
|
44
47
|
By default it is the left pane for 'vertical' SplitPane and the top pane for 'horizontal' SplitPane.
|
|
@@ -52,13 +55,14 @@ You can also set the size of the pane using the `size` prop. Note that a size se
|
|
|
52
55
|
In this example right pane keeps its width 200px while user is resizing browser window.
|
|
53
56
|
|
|
54
57
|
```jsx
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
<SplitPane split="vertical" defaultSize={200} primary="second">
|
|
59
|
+
<div />
|
|
60
|
+
<div />
|
|
61
|
+
</SplitPane>
|
|
59
62
|
```
|
|
60
63
|
|
|
61
64
|
### maxSize
|
|
65
|
+
|
|
62
66
|
You can limit the maximal size of the 'fixed' pane using the maxSize parameter with a positive value (measured in pixels but state just a number).
|
|
63
67
|
If you wrap the SplitPane into a container component (yes you can, just remember the container has to have the relative or absolute positioning),
|
|
64
68
|
then you'll need to limit the movement of the splitter (resizer) at the end of the SplitPane (otherwise it can be dragged outside the SplitPane
|
|
@@ -68,30 +72,34 @@ And more: if you set the maxSize to negative value (e.g. -200), then the splitte
|
|
|
68
72
|
size of the 'resizable' pane in this case). This can be useful also in the full-screen case of use.
|
|
69
73
|
|
|
70
74
|
### step
|
|
75
|
+
|
|
71
76
|
You can use the step prop to only allow resizing in fixed increments.
|
|
72
77
|
|
|
73
78
|
### onDragStarted
|
|
79
|
+
|
|
74
80
|
This callback is invoked when a drag starts.
|
|
75
81
|
|
|
76
82
|
### onDragFinished
|
|
83
|
+
|
|
77
84
|
This callback is invoked when a drag ends.
|
|
78
85
|
|
|
79
86
|
### onChange
|
|
87
|
+
|
|
80
88
|
This callback is invoked with the current drag during a drag event. It is recommended that it is wrapped in a debounce function.
|
|
81
89
|
|
|
82
90
|
### Inline Styles
|
|
83
91
|
|
|
84
92
|
You can also pass inline styles to the components via props. These are:
|
|
85
93
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
94
|
+
- `style` - Styling to be applied to the main container.
|
|
95
|
+
- `paneStyle` - Styling to be applied to both panes
|
|
96
|
+
- `pane1Style` - Styling to be applied to the first pane, with precedence over `paneStyle`
|
|
97
|
+
- `pane2Style` - Styling to be applied to the second pane, with precedence over `paneStyle`
|
|
98
|
+
- `resizerStyle` - Styling to be applied to the resizer bar
|
|
91
99
|
|
|
92
100
|
## Persisting Positions
|
|
93
101
|
|
|
94
|
-
Each SplitPane accepts an onChange function prop.
|
|
102
|
+
Each SplitPane accepts an onChange function prop. Used in conjunction with
|
|
95
103
|
defaultSize and a persistence layer, you can ensure that your splitter choices
|
|
96
104
|
survive a refresh of your app.
|
|
97
105
|
|
|
@@ -99,89 +107,129 @@ For example, if you are comfortable with the trade-offs of localStorage, you
|
|
|
99
107
|
could do something like the following:
|
|
100
108
|
|
|
101
109
|
```jsx
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
110
|
+
<SplitPane
|
|
111
|
+
split="vertical"
|
|
112
|
+
minSize={50}
|
|
113
|
+
defaultSize={parseInt(localStorage.getItem('splitPos'), 10)}
|
|
114
|
+
onChange={size => localStorage.setItem('splitPos', size)}
|
|
115
|
+
>
|
|
116
|
+
<div />
|
|
117
|
+
<div />
|
|
118
|
+
</SplitPane>
|
|
108
119
|
```
|
|
109
120
|
|
|
110
|
-
Disclaimer: localStorage has a variety of performance trade-offs.
|
|
121
|
+
Disclaimer: localStorage has a variety of performance trade-offs. Browsers such
|
|
111
122
|
as Firefox have now optimized localStorage use so that they will asynchronously
|
|
112
123
|
initiate a read of all saved localStorage data for an origin once they know the
|
|
113
|
-
page will load.
|
|
124
|
+
page will load. If the data has not fully loaded by the time code accesses
|
|
114
125
|
localStorage, the code will cause the page's main thread to block until the
|
|
115
|
-
database load completes.
|
|
116
|
-
run or layout will occur.
|
|
117
|
-
disk storage, this will be less of a problem.
|
|
126
|
+
database load completes. When the main thread is blocked, no other JS code will
|
|
127
|
+
run or layout will occur. In multiprocess browsers and for users with fast
|
|
128
|
+
disk storage, this will be less of a problem. You _are_ likely to get yelled at
|
|
118
129
|
if you use localStorage.
|
|
119
130
|
|
|
120
131
|
A potentially better idea is to use something like
|
|
121
132
|
https://github.com/mozilla/localForage although hooking it up will be slightly
|
|
122
|
-
more involved.
|
|
133
|
+
more involved. You are likely to be admired by all for judiciously avoiding
|
|
123
134
|
use of localStorage.
|
|
124
135
|
|
|
125
136
|
## Example styling
|
|
126
137
|
|
|
127
138
|
This gives a single pixel wide divider, but with a 'grabbable' surface of 11 pixels.
|
|
128
139
|
|
|
129
|
-
Thanks to
|
|
130
|
-
|
|
140
|
+
Thanks to `background-clip: padding-box;` for making transparent borders possible.
|
|
131
141
|
|
|
132
142
|
```css
|
|
143
|
+
.Resizer {
|
|
144
|
+
background: #000;
|
|
145
|
+
opacity: 0.2;
|
|
146
|
+
z-index: 1;
|
|
147
|
+
-moz-box-sizing: border-box;
|
|
148
|
+
-webkit-box-sizing: border-box;
|
|
149
|
+
box-sizing: border-box;
|
|
150
|
+
-moz-background-clip: padding;
|
|
151
|
+
-webkit-background-clip: padding;
|
|
152
|
+
background-clip: padding-box;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.Resizer:hover {
|
|
156
|
+
-webkit-transition: all 2s ease;
|
|
157
|
+
transition: all 2s ease;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.Resizer.horizontal {
|
|
161
|
+
height: 11px;
|
|
162
|
+
margin: -5px 0;
|
|
163
|
+
border-top: 5px solid rgba(255, 255, 255, 0);
|
|
164
|
+
border-bottom: 5px solid rgba(255, 255, 255, 0);
|
|
165
|
+
cursor: row-resize;
|
|
166
|
+
width: 100%;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.Resizer.horizontal:hover {
|
|
170
|
+
border-top: 5px solid rgba(0, 0, 0, 0.5);
|
|
171
|
+
border-bottom: 5px solid rgba(0, 0, 0, 0.5);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.Resizer.vertical {
|
|
175
|
+
width: 11px;
|
|
176
|
+
margin: 0 -5px;
|
|
177
|
+
border-left: 5px solid rgba(255, 255, 255, 0);
|
|
178
|
+
border-right: 5px solid rgba(255, 255, 255, 0);
|
|
179
|
+
cursor: col-resize;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.Resizer.vertical:hover {
|
|
183
|
+
border-left: 5px solid rgba(0, 0, 0, 0.5);
|
|
184
|
+
border-right: 5px solid rgba(0, 0, 0, 0.5);
|
|
185
|
+
}
|
|
186
|
+
.Resizer.disabled {
|
|
187
|
+
cursor: not-allowed;
|
|
188
|
+
}
|
|
189
|
+
.Resizer.disabled:hover {
|
|
190
|
+
border-color: transparent;
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## New Version
|
|
195
|
+
|
|
196
|
+
**I'm working on an updated version of this library, and looking for help:**
|
|
133
197
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
border-right: 5px solid rgba(255, 255, 255, 0);
|
|
170
|
-
cursor: col-resize;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.Resizer.vertical:hover {
|
|
174
|
-
border-left: 5px solid rgba(0, 0, 0, 0.5);
|
|
175
|
-
border-right: 5px solid rgba(0, 0, 0, 0.5);
|
|
176
|
-
}
|
|
177
|
-
.Resizer.disabled {
|
|
178
|
-
cursor: not-allowed;
|
|
179
|
-
}
|
|
180
|
-
.Resizer.disabled:hover {
|
|
181
|
-
border-color: transparent;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
```
|
|
198
|
+
Demo
|
|
199
|
+
|
|
200
|
+
http://react-split-pane-v2.surge.sh/
|
|
201
|
+
|
|
202
|
+
Install
|
|
203
|
+
|
|
204
|
+
```sh
|
|
205
|
+
npm install react-split-pane@next
|
|
206
|
+
|
|
207
|
+
# or if you use yarn
|
|
208
|
+
|
|
209
|
+
yarn add react-split-pane@next
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Usage
|
|
213
|
+
|
|
214
|
+
```jsx
|
|
215
|
+
import SplitPane, { Pane } from 'react-split-pane';
|
|
216
|
+
|
|
217
|
+
<SplitPane split="vertical">
|
|
218
|
+
<Pane initialSize="200px">You can use a Pane component</Pane>
|
|
219
|
+
<div>or you can use a plain old div</div>
|
|
220
|
+
<Pane initialSize="25%" minSize="10%" maxSize="500px">
|
|
221
|
+
Using a Pane allows you to specify any constraints directly
|
|
222
|
+
</Pane>
|
|
223
|
+
</SplitPane>;
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Pull request
|
|
227
|
+
|
|
228
|
+
https://github.com/tomkp/react-split-pane/pull/240
|
|
229
|
+
|
|
230
|
+
More discussion
|
|
231
|
+
|
|
232
|
+
https://github.com/tomkp/react-split-pane/issues/233
|
|
185
233
|
|
|
186
234
|
## Contributing
|
|
187
235
|
|
|
@@ -189,6 +237,4 @@ I'm always happy to receive Pull Requests for contributions of any kind.
|
|
|
189
237
|
|
|
190
238
|
Please include tests and/or update the examples if possible.
|
|
191
239
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
Thanks, Tom
|
|
240
|
+
Thanks, Tom
|