@elliemae/ds-resizeable-container 2.2.0-alpha.3 → 3.0.0-next.0
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/cjs/Resizable.js +213 -204
- package/cjs/defaultProps.js +6 -34
- package/cjs/index.js +11 -36
- package/cjs/props.js +22 -40
- package/esm/Resizable.js +190 -166
- package/esm/defaultProps.js +2 -5
- package/esm/index.js +1 -7
- package/esm/props.js +18 -11
- package/package.json +3 -3
- package/cjs/Resizable.js.map +0 -7
- package/cjs/defaultProps.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/props.js.map +0 -7
- package/esm/Resizable.js.map +0 -7
- package/esm/defaultProps.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/props.js.map +0 -7
package/cjs/Resizable.js
CHANGED
|
@@ -1,190 +1,172 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
var
|
|
41
|
-
var import_defaultProps = __toESM(require("./defaultProps"));
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _jsx2 = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
10
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.every.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.every.js');
|
|
14
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
15
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
16
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
17
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
18
|
+
var React = require('react');
|
|
19
|
+
var reactDesc = require('react-desc');
|
|
20
|
+
var styled = require('styled-components');
|
|
21
|
+
var dsSystem = require('@elliemae/ds-system');
|
|
22
|
+
var dsGrid = require('@elliemae/ds-grid');
|
|
23
|
+
var props = require('./props.js');
|
|
24
|
+
var defaultProps = require('./defaultProps.js');
|
|
25
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
26
|
+
|
|
27
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
28
|
+
|
|
29
|
+
var _jsx2__default = /*#__PURE__*/_interopDefaultLegacy(_jsx2);
|
|
30
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
31
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
32
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
33
|
+
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
34
|
+
|
|
35
|
+
const _excluded = ["innerRef"],
|
|
36
|
+
_excluded2 = ["children", "cols", "rows", "vertical", "horizontal"];
|
|
37
|
+
|
|
38
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
39
|
+
|
|
40
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
42
41
|
const safeDifference = 15;
|
|
43
42
|
const minDifference = 8;
|
|
44
|
-
const EVENT_TYPE = {
|
|
43
|
+
const EVENT_TYPE = {
|
|
44
|
+
MOUSE: 'mouse',
|
|
45
|
+
KEY: 'arrows'
|
|
46
|
+
};
|
|
45
47
|
const DIRECTION = {
|
|
46
|
-
L:
|
|
47
|
-
R:
|
|
48
|
-
U:
|
|
49
|
-
D:
|
|
48
|
+
L: 'left',
|
|
49
|
+
R: 'right',
|
|
50
|
+
U: 'up',
|
|
51
|
+
D: 'down'
|
|
50
52
|
};
|
|
53
|
+
|
|
51
54
|
function calcPosition(arrow, position) {
|
|
52
55
|
let offset;
|
|
56
|
+
|
|
53
57
|
switch (arrow) {
|
|
54
58
|
case DIRECTION.U:
|
|
55
59
|
offset = position - 3;
|
|
56
60
|
break;
|
|
61
|
+
|
|
57
62
|
case DIRECTION.D:
|
|
58
63
|
offset = position + 3;
|
|
59
64
|
break;
|
|
65
|
+
|
|
60
66
|
case DIRECTION.L:
|
|
61
67
|
offset = position - 3;
|
|
62
68
|
break;
|
|
69
|
+
|
|
63
70
|
case DIRECTION.R:
|
|
64
71
|
offset = position + 3;
|
|
65
72
|
break;
|
|
73
|
+
|
|
66
74
|
default:
|
|
67
75
|
offset = position;
|
|
68
76
|
}
|
|
77
|
+
|
|
69
78
|
return offset;
|
|
70
79
|
}
|
|
80
|
+
|
|
71
81
|
function cursorResolver(nextPx, px, isVertical) {
|
|
72
82
|
const orientation = {
|
|
73
|
-
vertical:
|
|
74
|
-
horizontal:
|
|
75
|
-
left:
|
|
76
|
-
right:
|
|
77
|
-
up:
|
|
78
|
-
down:
|
|
83
|
+
vertical: 'row-resize',
|
|
84
|
+
horizontal: 'col-resize',
|
|
85
|
+
left: 'w-resize',
|
|
86
|
+
right: 'e-resize',
|
|
87
|
+
up: 'n-resize',
|
|
88
|
+
down: 's-resize'
|
|
79
89
|
};
|
|
80
|
-
if (isVertical && nextPx && nextPx <= safeDifference + 1)
|
|
81
|
-
|
|
82
|
-
if (isVertical && px
|
|
83
|
-
|
|
84
|
-
if (isVertical && px <= safeDifference + 1)
|
|
85
|
-
|
|
86
|
-
if (!isVertical && nextPx && nextPx <= safeDifference + 1)
|
|
87
|
-
return orientation.left;
|
|
88
|
-
if (!isVertical && px <= safeDifference + 1)
|
|
89
|
-
return orientation.right;
|
|
90
|
-
if (!isVertical && px > safeDifference + 1)
|
|
91
|
-
return orientation.horizontal;
|
|
90
|
+
if (isVertical && nextPx && nextPx <= safeDifference + 1) return orientation.up;
|
|
91
|
+
if (isVertical && px > safeDifference + 1) return orientation.vertical;
|
|
92
|
+
if (isVertical && px <= safeDifference + 1) return orientation.down;
|
|
93
|
+
if (!isVertical && nextPx && nextPx <= safeDifference + 1) return orientation.left;
|
|
94
|
+
if (!isVertical && px <= safeDifference + 1) return orientation.right;
|
|
95
|
+
if (!isVertical && px > safeDifference + 1) return orientation.horizontal;
|
|
92
96
|
return isVertical ? orientation.vertical : orientation.horizontal;
|
|
93
97
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
98
|
+
|
|
99
|
+
function ResizableItemComponent(_ref) {
|
|
100
|
+
let {
|
|
101
|
+
innerRef
|
|
102
|
+
} = _ref,
|
|
103
|
+
p = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
104
|
+
|
|
105
|
+
return /*#__PURE__*/jsxRuntime.jsx(dsGrid.Grid, _objectSpread({
|
|
106
|
+
ref: innerRef
|
|
107
|
+
}, p));
|
|
99
108
|
}
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
+
|
|
110
|
+
const ResizableGrid = /*#__PURE__*/styled__default["default"](dsGrid.Grid).withConfig({
|
|
111
|
+
componentId: "sc-forwbw-0"
|
|
112
|
+
})([""]);
|
|
113
|
+
const ResizableItem = /*#__PURE__*/styled__default["default"](ResizableItemComponent).withConfig({
|
|
114
|
+
componentId: "sc-forwbw-1"
|
|
115
|
+
})(["position:relative;"]);
|
|
116
|
+
const ResizableBar = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
117
|
+
componentId: "sc-forwbw-2"
|
|
118
|
+
})(["position:absolute;cursor:", ";", ""], _ref2 => {
|
|
119
|
+
let {
|
|
120
|
+
container,
|
|
121
|
+
nextContainer,
|
|
122
|
+
v
|
|
123
|
+
} = _ref2;
|
|
124
|
+
return cursorResolver(nextContainer, container, v);
|
|
125
|
+
}, props => {
|
|
109
126
|
if (props.v) {
|
|
110
|
-
return
|
|
111
|
-
bottom: calc(${(0, import_ds_system.mapGap)(props.gutter)} * -0.5);
|
|
112
|
-
left: 0;
|
|
113
|
-
width: 100%;
|
|
114
|
-
height: 10px;
|
|
115
|
-
margin-bottom: -5px;
|
|
116
|
-
display: flex;
|
|
117
|
-
flex-direction: column;
|
|
118
|
-
justify-content:space-around;
|
|
119
|
-
align-items: center;
|
|
120
|
-
&:after{
|
|
121
|
-
width: 100%;
|
|
122
|
-
height: 1px;
|
|
123
|
-
display: block;
|
|
124
|
-
background: ${props.theme.colors.neutral["300"]};
|
|
125
|
-
content: '';
|
|
126
|
-
}
|
|
127
|
-
&:hover{
|
|
128
|
-
&:after{
|
|
129
|
-
background: ${props.theme.colors.brand["600"]};
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
`;
|
|
127
|
+
return "\n bottom: calc(".concat(dsSystem.mapGap(props.gutter), " * -0.5);\n left: 0;\n width: 100%;\n height: 10px;\n margin-bottom: -5px;\n display: flex;\n flex-direction: column;\n justify-content:space-around;\n align-items: center;\n &:after{\n width: 100%;\n height: 1px;\n display: block;\n background: ").concat(props.theme.colors.neutral['300'], ";\n content: '';\n }\n &:hover{\n &:after{\n background: ").concat(props.theme.colors.brand['600'], ";\n } \n }\n ");
|
|
133
128
|
}
|
|
134
|
-
|
|
135
|
-
top: 0;
|
|
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
|
-
function ResizableContainer({
|
|
162
|
-
children,
|
|
163
|
-
cols,
|
|
164
|
-
rows,
|
|
165
|
-
vertical,
|
|
166
|
-
horizontal,
|
|
167
|
-
...rest
|
|
168
|
-
}) {
|
|
169
|
-
const refs = (0, import_react.useRef)([]);
|
|
170
|
-
const [containers, setContainers] = (0, import_react.useState)(cols);
|
|
171
|
-
const [blocks, setBlocks] = (0, import_react.useState)(rows);
|
|
172
|
-
const [isDragging, setDragging] = (0, import_react.useState)(false);
|
|
173
|
-
const [start, setStartPoint] = (0, import_react.useState)(0);
|
|
174
|
-
const [resetPoint, setResetPoint] = (0, import_react.useState)();
|
|
175
|
-
(0, import_react.useEffect)(() => {
|
|
176
|
-
if (horizontal)
|
|
177
|
-
setContainers(getWidths(refs.current));
|
|
178
|
-
if (vertical)
|
|
179
|
-
setBlocks(getHeights(refs.current));
|
|
129
|
+
|
|
130
|
+
return "\n top: 0;\n right: calc(".concat(dsSystem.mapGap(props.gutter), " * -0.5);\n height: 100%;\n width: 10px;\n margin-right: -5px;\n display: flex;\n flex-direction: row;\n justify-content:space-around;\n align-items: center;\n &:after{\n height: 100%;\n width: 1px;\n display: block;\n background: ").concat(props.theme.colors.neutral['300'], ";\n content: '';\n }\n &:hover{\n &:after{\n background: ").concat(props.theme.colors.brand['600'], ";\n } \n }\n ");
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const getWidths = list => list.map(l => l.clientWidth);
|
|
134
|
+
|
|
135
|
+
const getHeights = list => list.map(l => l.clientHeight);
|
|
136
|
+
|
|
137
|
+
function ResizableContainer(_ref3) {
|
|
138
|
+
let {
|
|
139
|
+
children,
|
|
140
|
+
cols,
|
|
141
|
+
rows,
|
|
142
|
+
vertical,
|
|
143
|
+
horizontal
|
|
144
|
+
} = _ref3,
|
|
145
|
+
rest = _objectWithoutProperties__default["default"](_ref3, _excluded2);
|
|
146
|
+
|
|
147
|
+
const refs = React.useRef([]);
|
|
148
|
+
const [containers, setContainers] = React.useState(cols);
|
|
149
|
+
const [blocks, setBlocks] = React.useState(rows);
|
|
150
|
+
const [isDragging, setDragging] = React.useState(false);
|
|
151
|
+
const [start, setStartPoint] = React.useState(0);
|
|
152
|
+
const [resetPoint, setResetPoint] = React.useState();
|
|
153
|
+
React.useEffect(() => {
|
|
154
|
+
if (horizontal) setContainers(getWidths(refs.current));
|
|
155
|
+
if (vertical) setBlocks(getHeights(refs.current));
|
|
180
156
|
}, [refs.current, horizontal, vertical]);
|
|
181
|
-
|
|
157
|
+
|
|
158
|
+
const addRef = node => {
|
|
182
159
|
refs.current.push(node);
|
|
183
160
|
};
|
|
184
|
-
|
|
161
|
+
|
|
162
|
+
const resizePanels = function () {
|
|
163
|
+
let diff = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
164
|
+
let v = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
185
165
|
const index = parseInt(start.index, 10);
|
|
166
|
+
|
|
186
167
|
if (!v) {
|
|
187
168
|
const newContainers = [...containers];
|
|
169
|
+
|
|
188
170
|
if (newContainers[index + 1] && newContainers[index + 1] > minDifference) {
|
|
189
171
|
newContainers[index + 1] = newContainers[index + 1] - diff;
|
|
190
172
|
newContainers[index] = diff + newContainers[index];
|
|
@@ -192,10 +174,11 @@ function ResizableContainer({
|
|
|
192
174
|
newContainers[index - 1] = newContainers[index - 1] - diff;
|
|
193
175
|
newContainers[index] = diff + newContainers[index];
|
|
194
176
|
}
|
|
195
|
-
|
|
196
|
-
|
|
177
|
+
|
|
178
|
+
if (newContainers.every(c => c > safeDifference)) setContainers(newContainers);
|
|
197
179
|
} else {
|
|
198
180
|
const newBlocks = [...blocks];
|
|
181
|
+
|
|
199
182
|
if (newBlocks[index + 1] && newBlocks[index + 1] > minDifference) {
|
|
200
183
|
newBlocks[index + 1] = newBlocks[index + 1] - diff;
|
|
201
184
|
newBlocks[index] = diff + newBlocks[index];
|
|
@@ -203,11 +186,14 @@ function ResizableContainer({
|
|
|
203
186
|
newBlocks[index - 1] = newBlocks[index - 1] - diff;
|
|
204
187
|
newBlocks[index] = diff + newBlocks[index];
|
|
205
188
|
}
|
|
206
|
-
|
|
207
|
-
|
|
189
|
+
|
|
190
|
+
if (newBlocks.every(c => c > safeDifference)) setBlocks(newBlocks);
|
|
208
191
|
}
|
|
209
192
|
};
|
|
210
|
-
|
|
193
|
+
|
|
194
|
+
const startResize = function (event, index) {
|
|
195
|
+
let v = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
196
|
+
let type = arguments.length > 3 ? arguments[3] : undefined;
|
|
211
197
|
setDragging(type);
|
|
212
198
|
setStartPoint({
|
|
213
199
|
x: event.clientX,
|
|
@@ -215,30 +201,41 @@ function ResizableContainer({
|
|
|
215
201
|
index,
|
|
216
202
|
v
|
|
217
203
|
});
|
|
218
|
-
setResetPoint({
|
|
204
|
+
setResetPoint({
|
|
205
|
+
containers,
|
|
206
|
+
blocks
|
|
207
|
+
});
|
|
219
208
|
};
|
|
209
|
+
|
|
220
210
|
const moveResize = (event, type) => {
|
|
221
211
|
if (isDragging && isDragging === type && !start.v) {
|
|
222
212
|
const diff = event.clientX - start.x;
|
|
223
|
-
if (diff === 0)
|
|
224
|
-
|
|
225
|
-
|
|
213
|
+
if (diff === 0) return;
|
|
214
|
+
setStartPoint({
|
|
215
|
+
x: event.clientX,
|
|
216
|
+
index: start.index
|
|
217
|
+
});
|
|
226
218
|
resizePanels(diff);
|
|
227
219
|
} else if (isDragging && isDragging === type && start.v) {
|
|
228
220
|
const diff = event.clientY - start.y;
|
|
229
|
-
if (diff === 0)
|
|
230
|
-
|
|
231
|
-
|
|
221
|
+
if (diff === 0) return;
|
|
222
|
+
setStartPoint(_objectSpread(_objectSpread({}, start), {}, {
|
|
223
|
+
y: event.clientY,
|
|
224
|
+
index: start.index
|
|
225
|
+
}));
|
|
232
226
|
resizePanels(diff, true);
|
|
233
227
|
}
|
|
234
228
|
};
|
|
235
|
-
|
|
229
|
+
|
|
230
|
+
const endResize = type => {
|
|
236
231
|
if (isDragging === type) {
|
|
237
232
|
setDragging(false);
|
|
238
233
|
setStartPoint();
|
|
239
234
|
}
|
|
240
235
|
};
|
|
241
|
-
|
|
236
|
+
|
|
237
|
+
const handleKeyDown = function (e, index) {
|
|
238
|
+
let v = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
242
239
|
const keyCodes = {
|
|
243
240
|
37: DIRECTION.L,
|
|
244
241
|
Left: DIRECTION.L,
|
|
@@ -253,62 +250,74 @@ function ResizableContainer({
|
|
|
253
250
|
Down: DIRECTION.D,
|
|
254
251
|
ArrowDown: DIRECTION.D
|
|
255
252
|
};
|
|
253
|
+
|
|
256
254
|
if (keyCodes[e.key || e.keyCode]) {
|
|
257
255
|
e.preventDefault();
|
|
258
|
-
const {
|
|
256
|
+
const {
|
|
257
|
+
top: y,
|
|
258
|
+
left: x
|
|
259
|
+
} = e.target.getBoundingClientRect();
|
|
260
|
+
|
|
259
261
|
if (!start) {
|
|
260
|
-
startResize({
|
|
262
|
+
startResize({
|
|
263
|
+
clientX: x,
|
|
264
|
+
clientY: y
|
|
265
|
+
}, index, v, EVENT_TYPE.KEY);
|
|
261
266
|
} else {
|
|
262
267
|
const clientX = keyCodes[e.keyCode] === DIRECTION.L || keyCodes[e.keyCode] === DIRECTION.R ? calcPosition(keyCodes[e.keyCode], x) : x;
|
|
263
268
|
const clientY = keyCodes[e.keyCode] === DIRECTION.U || keyCodes[e.keyCode] === DIRECTION.D ? calcPosition(keyCodes[e.keyCode], y) : y;
|
|
264
|
-
moveResize({
|
|
269
|
+
moveResize({
|
|
270
|
+
clientX,
|
|
271
|
+
clientY
|
|
272
|
+
}, EVENT_TYPE.KEY);
|
|
265
273
|
}
|
|
266
274
|
}
|
|
267
275
|
};
|
|
268
|
-
|
|
276
|
+
|
|
277
|
+
const onLeave = type => {
|
|
269
278
|
if (isDragging === type) {
|
|
270
279
|
setDragging(false);
|
|
271
|
-
if (resetPoint && resetPoint.blocks)
|
|
272
|
-
|
|
273
|
-
if (resetPoint && resetPoint.containers)
|
|
274
|
-
setContainers(resetPoint.containers);
|
|
280
|
+
if (resetPoint && resetPoint.blocks) setBlocks(resetPoint.blocks);
|
|
281
|
+
if (resetPoint && resetPoint.containers) setContainers(resetPoint.containers);
|
|
275
282
|
}
|
|
276
283
|
};
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
284
|
+
|
|
285
|
+
const count = React__default["default"].Children.count(children);
|
|
286
|
+
return /*#__PURE__*/jsxRuntime.jsx(ResizableGrid, _objectSpread(_objectSpread({}, rest), {}, {
|
|
280
287
|
cols: containers,
|
|
281
288
|
onKeyUp: () => endResize(EVENT_TYPE.KEY),
|
|
282
289
|
onMouseLeave: () => onLeave(EVENT_TYPE.MOUSE),
|
|
283
|
-
onMouseMove:
|
|
290
|
+
onMouseMove: e => moveResize(e, EVENT_TYPE.MOUSE),
|
|
284
291
|
onMouseUp: () => endResize(EVENT_TYPE.MOUSE),
|
|
285
|
-
rows: blocks
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
292
|
+
rows: blocks,
|
|
293
|
+
children: React__default["default"].Children.map(children, (child, index) => /*#__PURE__*/_jsx2__default["default"](ResizableItem, {
|
|
294
|
+
"data-index": index,
|
|
295
|
+
innerRef: addRef
|
|
296
|
+
}, void 0, child, count - 1 !== index && horizontal && /*#__PURE__*/_jsx2__default["default"](ResizableBar, {
|
|
297
|
+
container: containers[index],
|
|
298
|
+
"data-index": index,
|
|
299
|
+
gutter: rest.gutter,
|
|
300
|
+
nextContainer: containers[index + 1],
|
|
301
|
+
onKeyDown: e => handleKeyDown(e, index, false),
|
|
302
|
+
onMouseDown: e => startResize(e, index, false, EVENT_TYPE.MOUSE),
|
|
303
|
+
tabIndex: 0
|
|
304
|
+
}), count - 1 !== index && vertical && /*#__PURE__*/_jsx2__default["default"](ResizableBar, {
|
|
305
|
+
container: blocks[index],
|
|
306
|
+
"data-index": index,
|
|
307
|
+
gutter: rest.gutter,
|
|
308
|
+
nextContainer: blocks[index + 1],
|
|
309
|
+
onKeyDown: e => handleKeyDown(e, index, true),
|
|
310
|
+
onMouseDown: e => startResize(e, index, true, EVENT_TYPE.MOUSE),
|
|
311
|
+
tabIndex: 0,
|
|
312
|
+
v: true
|
|
313
|
+
})))
|
|
314
|
+
}));
|
|
307
315
|
}
|
|
308
|
-
|
|
309
|
-
ResizableContainer.defaultProps =
|
|
310
|
-
const DSResizableContainerWithSchema =
|
|
311
|
-
DSResizableContainerWithSchema.propTypes =
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
316
|
+
|
|
317
|
+
ResizableContainer.defaultProps = defaultProps.defaultProps;
|
|
318
|
+
const DSResizableContainerWithSchema = reactDesc.describe(ResizableContainer);
|
|
319
|
+
DSResizableContainerWithSchema.propTypes = props.props;
|
|
320
|
+
|
|
321
|
+
exports.DSResizableContainerWithSchema = DSResizableContainerWithSchema;
|
|
322
|
+
exports.ResizableContainer = ResizableContainer;
|
|
323
|
+
exports["default"] = ResizableContainer;
|
package/cjs/defaultProps.js
CHANGED
|
@@ -1,38 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var defaultProps_exports = {};
|
|
29
|
-
__export(defaultProps_exports, {
|
|
30
|
-
defaultProps: () => defaultProps
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
33
5
|
const defaultProps = {
|
|
34
6
|
vertical: false,
|
|
35
7
|
horizontal: false
|
|
36
8
|
};
|
|
37
|
-
|
|
38
|
-
|
|
9
|
+
|
|
10
|
+
exports.defaultProps = defaultProps;
|
package/cjs/index.js
CHANGED
|
@@ -1,36 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var src_exports = {};
|
|
29
|
-
__export(src_exports, {
|
|
30
|
-
default: () => import_Resizable.default
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
__reExport(src_exports, __toESM(require("./Resizable")));
|
|
34
|
-
var import_Resizable = __toESM(require("./Resizable"));
|
|
35
|
-
module.exports = __toCommonJS(src_exports);
|
|
36
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var Resizable = require('./Resizable.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.DSResizableContainerWithSchema = Resizable.DSResizableContainerWithSchema;
|
|
10
|
+
exports.ResizableContainer = Resizable.ResizableContainer;
|
|
11
|
+
exports["default"] = Resizable.ResizableContainer;
|