@elliemae/ds-resizeable-container 2.2.0-alpha.1 → 2.2.0-alpha.5
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 +204 -213
- package/cjs/Resizable.js.map +7 -0
- package/cjs/defaultProps.js +34 -6
- package/cjs/defaultProps.js.map +7 -0
- package/cjs/index.js +36 -11
- package/cjs/index.js.map +7 -0
- package/cjs/props.js +40 -22
- package/cjs/props.js.map +7 -0
- package/esm/Resizable.js +166 -190
- package/esm/Resizable.js.map +7 -0
- package/esm/defaultProps.js +5 -2
- package/esm/defaultProps.js.map +7 -0
- package/esm/index.js +7 -1
- package/esm/index.js.map +7 -0
- package/esm/props.js +11 -18
- package/esm/props.js.map +7 -0
- package/package.json +3 -3
package/cjs/Resizable.js
CHANGED
|
@@ -1,172 +1,190 @@
|
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
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 Resizable_exports = {};
|
|
29
|
+
__export(Resizable_exports, {
|
|
30
|
+
DSResizableContainerWithSchema: () => DSResizableContainerWithSchema,
|
|
31
|
+
ResizableContainer: () => ResizableContainer,
|
|
32
|
+
default: () => Resizable_default
|
|
33
|
+
});
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_react_desc = require("react-desc");
|
|
37
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
38
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
39
|
+
var import_ds_grid = require("@elliemae/ds-grid");
|
|
40
|
+
var import_props = require("./props");
|
|
41
|
+
var import_defaultProps = require("./defaultProps");
|
|
41
42
|
const safeDifference = 15;
|
|
42
43
|
const minDifference = 8;
|
|
43
|
-
const EVENT_TYPE = {
|
|
44
|
-
MOUSE: 'mouse',
|
|
45
|
-
KEY: 'arrows'
|
|
46
|
-
};
|
|
44
|
+
const EVENT_TYPE = { MOUSE: "mouse", KEY: "arrows" };
|
|
47
45
|
const DIRECTION = {
|
|
48
|
-
L:
|
|
49
|
-
R:
|
|
50
|
-
U:
|
|
51
|
-
D:
|
|
46
|
+
L: "left",
|
|
47
|
+
R: "right",
|
|
48
|
+
U: "up",
|
|
49
|
+
D: "down"
|
|
52
50
|
};
|
|
53
|
-
|
|
54
51
|
function calcPosition(arrow, position) {
|
|
55
52
|
let offset;
|
|
56
|
-
|
|
57
53
|
switch (arrow) {
|
|
58
54
|
case DIRECTION.U:
|
|
59
55
|
offset = position - 3;
|
|
60
56
|
break;
|
|
61
|
-
|
|
62
57
|
case DIRECTION.D:
|
|
63
58
|
offset = position + 3;
|
|
64
59
|
break;
|
|
65
|
-
|
|
66
60
|
case DIRECTION.L:
|
|
67
61
|
offset = position - 3;
|
|
68
62
|
break;
|
|
69
|
-
|
|
70
63
|
case DIRECTION.R:
|
|
71
64
|
offset = position + 3;
|
|
72
65
|
break;
|
|
73
|
-
|
|
74
66
|
default:
|
|
75
67
|
offset = position;
|
|
76
68
|
}
|
|
77
|
-
|
|
78
69
|
return offset;
|
|
79
70
|
}
|
|
80
|
-
|
|
81
71
|
function cursorResolver(nextPx, px, isVertical) {
|
|
82
72
|
const orientation = {
|
|
83
|
-
vertical:
|
|
84
|
-
horizontal:
|
|
85
|
-
left:
|
|
86
|
-
right:
|
|
87
|
-
up:
|
|
88
|
-
down:
|
|
73
|
+
vertical: "row-resize",
|
|
74
|
+
horizontal: "col-resize",
|
|
75
|
+
left: "w-resize",
|
|
76
|
+
right: "e-resize",
|
|
77
|
+
up: "n-resize",
|
|
78
|
+
down: "s-resize"
|
|
89
79
|
};
|
|
90
|
-
if (isVertical && nextPx && nextPx <= safeDifference + 1)
|
|
91
|
-
|
|
92
|
-
if (isVertical && px
|
|
93
|
-
|
|
94
|
-
if (
|
|
95
|
-
|
|
80
|
+
if (isVertical && nextPx && nextPx <= safeDifference + 1)
|
|
81
|
+
return orientation.up;
|
|
82
|
+
if (isVertical && px > safeDifference + 1)
|
|
83
|
+
return orientation.vertical;
|
|
84
|
+
if (isVertical && px <= safeDifference + 1)
|
|
85
|
+
return orientation.down;
|
|
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;
|
|
96
92
|
return isVertical ? orientation.vertical : orientation.horizontal;
|
|
97
93
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
p = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
104
|
-
|
|
105
|
-
return /*#__PURE__*/jsxRuntime.jsx(dsGrid.Grid, _objectSpread({
|
|
106
|
-
ref: innerRef
|
|
107
|
-
}, p));
|
|
94
|
+
function ResizableItemComponent({ innerRef, ...p }) {
|
|
95
|
+
return /* @__PURE__ */ import_react.default.createElement(import_ds_grid.Grid, {
|
|
96
|
+
ref: innerRef,
|
|
97
|
+
...p
|
|
98
|
+
});
|
|
108
99
|
}
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
})(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
})(["position:absolute;cursor:", ";", ""], _ref2 => {
|
|
119
|
-
let {
|
|
120
|
-
container,
|
|
121
|
-
nextContainer,
|
|
122
|
-
v
|
|
123
|
-
} = _ref2;
|
|
124
|
-
return cursorResolver(nextContainer, container, v);
|
|
125
|
-
}, props => {
|
|
100
|
+
const ResizableGrid = (0, import_styled_components.default)(import_ds_grid.Grid)``;
|
|
101
|
+
const ResizableItem = (0, import_styled_components.default)(ResizableItemComponent)`
|
|
102
|
+
position: relative;
|
|
103
|
+
`;
|
|
104
|
+
const ResizableBar = import_styled_components.default.div`
|
|
105
|
+
position: absolute;
|
|
106
|
+
cursor: ${({ container, nextContainer, v }) => cursorResolver(nextContainer, container, v)};
|
|
107
|
+
|
|
108
|
+
${(props) => {
|
|
126
109
|
if (props.v) {
|
|
127
|
-
return
|
|
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
|
+
`;
|
|
128
133
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
134
|
+
return `
|
|
135
|
+
top: 0;
|
|
136
|
+
right: calc(${(0, import_ds_system.mapGap)(props.gutter)} * -0.5);
|
|
137
|
+
height: 100%;
|
|
138
|
+
width: 10px;
|
|
139
|
+
margin-right: -5px;
|
|
140
|
+
display: flex;
|
|
141
|
+
flex-direction: row;
|
|
142
|
+
justify-content:space-around;
|
|
143
|
+
align-items: center;
|
|
144
|
+
&:after{
|
|
145
|
+
height: 100%;
|
|
146
|
+
width: 1px;
|
|
147
|
+
display: block;
|
|
148
|
+
background: ${props.theme.colors.neutral["300"]};
|
|
149
|
+
content: '';
|
|
150
|
+
}
|
|
151
|
+
&:hover{
|
|
152
|
+
&:after{
|
|
153
|
+
background: ${props.theme.colors.brand["600"]};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
`;
|
|
157
|
+
}}
|
|
158
|
+
`;
|
|
159
|
+
const getWidths = (list) => list.map((l) => l.clientWidth);
|
|
160
|
+
const getHeights = (list) => list.map((l) => l.clientHeight);
|
|
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));
|
|
156
180
|
}, [refs.current, horizontal, vertical]);
|
|
157
|
-
|
|
158
|
-
const addRef = node => {
|
|
181
|
+
const addRef = (node) => {
|
|
159
182
|
refs.current.push(node);
|
|
160
183
|
};
|
|
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;
|
|
184
|
+
const resizePanels = (diff = 1, v = false) => {
|
|
165
185
|
const index = parseInt(start.index, 10);
|
|
166
|
-
|
|
167
186
|
if (!v) {
|
|
168
187
|
const newContainers = [...containers];
|
|
169
|
-
|
|
170
188
|
if (newContainers[index + 1] && newContainers[index + 1] > minDifference) {
|
|
171
189
|
newContainers[index + 1] = newContainers[index + 1] - diff;
|
|
172
190
|
newContainers[index] = diff + newContainers[index];
|
|
@@ -174,11 +192,10 @@ function ResizableContainer(_ref3) {
|
|
|
174
192
|
newContainers[index - 1] = newContainers[index - 1] - diff;
|
|
175
193
|
newContainers[index] = diff + newContainers[index];
|
|
176
194
|
}
|
|
177
|
-
|
|
178
|
-
|
|
195
|
+
if (newContainers.every((c) => c > safeDifference))
|
|
196
|
+
setContainers(newContainers);
|
|
179
197
|
} else {
|
|
180
198
|
const newBlocks = [...blocks];
|
|
181
|
-
|
|
182
199
|
if (newBlocks[index + 1] && newBlocks[index + 1] > minDifference) {
|
|
183
200
|
newBlocks[index + 1] = newBlocks[index + 1] - diff;
|
|
184
201
|
newBlocks[index] = diff + newBlocks[index];
|
|
@@ -186,14 +203,11 @@ function ResizableContainer(_ref3) {
|
|
|
186
203
|
newBlocks[index - 1] = newBlocks[index - 1] - diff;
|
|
187
204
|
newBlocks[index] = diff + newBlocks[index];
|
|
188
205
|
}
|
|
189
|
-
|
|
190
|
-
|
|
206
|
+
if (newBlocks.every((c) => c > safeDifference))
|
|
207
|
+
setBlocks(newBlocks);
|
|
191
208
|
}
|
|
192
209
|
};
|
|
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;
|
|
210
|
+
const startResize = (event, index, v = false, type) => {
|
|
197
211
|
setDragging(type);
|
|
198
212
|
setStartPoint({
|
|
199
213
|
x: event.clientX,
|
|
@@ -201,41 +215,30 @@ function ResizableContainer(_ref3) {
|
|
|
201
215
|
index,
|
|
202
216
|
v
|
|
203
217
|
});
|
|
204
|
-
setResetPoint({
|
|
205
|
-
containers,
|
|
206
|
-
blocks
|
|
207
|
-
});
|
|
218
|
+
setResetPoint({ containers, blocks });
|
|
208
219
|
};
|
|
209
|
-
|
|
210
220
|
const moveResize = (event, type) => {
|
|
211
221
|
if (isDragging && isDragging === type && !start.v) {
|
|
212
222
|
const diff = event.clientX - start.x;
|
|
213
|
-
if (diff === 0)
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
index: start.index
|
|
217
|
-
});
|
|
223
|
+
if (diff === 0)
|
|
224
|
+
return;
|
|
225
|
+
setStartPoint({ x: event.clientX, index: start.index });
|
|
218
226
|
resizePanels(diff);
|
|
219
227
|
} else if (isDragging && isDragging === type && start.v) {
|
|
220
228
|
const diff = event.clientY - start.y;
|
|
221
|
-
if (diff === 0)
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
index: start.index
|
|
225
|
-
}));
|
|
229
|
+
if (diff === 0)
|
|
230
|
+
return;
|
|
231
|
+
setStartPoint({ ...start, y: event.clientY, index: start.index });
|
|
226
232
|
resizePanels(diff, true);
|
|
227
233
|
}
|
|
228
234
|
};
|
|
229
|
-
|
|
230
|
-
const endResize = type => {
|
|
235
|
+
const endResize = (type) => {
|
|
231
236
|
if (isDragging === type) {
|
|
232
237
|
setDragging(false);
|
|
233
238
|
setStartPoint();
|
|
234
239
|
}
|
|
235
240
|
};
|
|
236
|
-
|
|
237
|
-
const handleKeyDown = function (e, index) {
|
|
238
|
-
let v = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
241
|
+
const handleKeyDown = (e, index, v = false) => {
|
|
239
242
|
const keyCodes = {
|
|
240
243
|
37: DIRECTION.L,
|
|
241
244
|
Left: DIRECTION.L,
|
|
@@ -250,74 +253,62 @@ function ResizableContainer(_ref3) {
|
|
|
250
253
|
Down: DIRECTION.D,
|
|
251
254
|
ArrowDown: DIRECTION.D
|
|
252
255
|
};
|
|
253
|
-
|
|
254
256
|
if (keyCodes[e.key || e.keyCode]) {
|
|
255
257
|
e.preventDefault();
|
|
256
|
-
const {
|
|
257
|
-
top: y,
|
|
258
|
-
left: x
|
|
259
|
-
} = e.target.getBoundingClientRect();
|
|
260
|
-
|
|
258
|
+
const { top: y, left: x } = e.target.getBoundingClientRect();
|
|
261
259
|
if (!start) {
|
|
262
|
-
startResize({
|
|
263
|
-
clientX: x,
|
|
264
|
-
clientY: y
|
|
265
|
-
}, index, v, EVENT_TYPE.KEY);
|
|
260
|
+
startResize({ clientX: x, clientY: y }, index, v, EVENT_TYPE.KEY);
|
|
266
261
|
} else {
|
|
267
262
|
const clientX = keyCodes[e.keyCode] === DIRECTION.L || keyCodes[e.keyCode] === DIRECTION.R ? calcPosition(keyCodes[e.keyCode], x) : x;
|
|
268
263
|
const clientY = keyCodes[e.keyCode] === DIRECTION.U || keyCodes[e.keyCode] === DIRECTION.D ? calcPosition(keyCodes[e.keyCode], y) : y;
|
|
269
|
-
moveResize({
|
|
270
|
-
clientX,
|
|
271
|
-
clientY
|
|
272
|
-
}, EVENT_TYPE.KEY);
|
|
264
|
+
moveResize({ clientX, clientY }, EVENT_TYPE.KEY);
|
|
273
265
|
}
|
|
274
266
|
}
|
|
275
267
|
};
|
|
276
|
-
|
|
277
|
-
const onLeave = type => {
|
|
268
|
+
const onLeave = (type) => {
|
|
278
269
|
if (isDragging === type) {
|
|
279
270
|
setDragging(false);
|
|
280
|
-
if (resetPoint && resetPoint.blocks)
|
|
281
|
-
|
|
271
|
+
if (resetPoint && resetPoint.blocks)
|
|
272
|
+
setBlocks(resetPoint.blocks);
|
|
273
|
+
if (resetPoint && resetPoint.containers)
|
|
274
|
+
setContainers(resetPoint.containers);
|
|
282
275
|
}
|
|
283
276
|
};
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
277
|
+
const count = import_react.default.Children.count(children);
|
|
278
|
+
return /* @__PURE__ */ import_react.default.createElement(ResizableGrid, {
|
|
279
|
+
...rest,
|
|
287
280
|
cols: containers,
|
|
288
281
|
onKeyUp: () => endResize(EVENT_TYPE.KEY),
|
|
289
282
|
onMouseLeave: () => onLeave(EVENT_TYPE.MOUSE),
|
|
290
|
-
onMouseMove: e => moveResize(e, EVENT_TYPE.MOUSE),
|
|
283
|
+
onMouseMove: (e) => moveResize(e, EVENT_TYPE.MOUSE),
|
|
291
284
|
onMouseUp: () => endResize(EVENT_TYPE.MOUSE),
|
|
292
|
-
rows: blocks
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}));
|
|
285
|
+
rows: blocks
|
|
286
|
+
}, import_react.default.Children.map(children, (child, index) => /* @__PURE__ */ import_react.default.createElement(ResizableItem, {
|
|
287
|
+
"data-index": index,
|
|
288
|
+
innerRef: addRef
|
|
289
|
+
}, child, count - 1 !== index && horizontal && /* @__PURE__ */ import_react.default.createElement(ResizableBar, {
|
|
290
|
+
container: containers[index],
|
|
291
|
+
"data-index": index,
|
|
292
|
+
gutter: rest.gutter,
|
|
293
|
+
nextContainer: containers[index + 1],
|
|
294
|
+
onKeyDown: (e) => handleKeyDown(e, index, false),
|
|
295
|
+
onMouseDown: (e) => startResize(e, index, false, EVENT_TYPE.MOUSE),
|
|
296
|
+
tabIndex: 0
|
|
297
|
+
}), count - 1 !== index && vertical && /* @__PURE__ */ import_react.default.createElement(ResizableBar, {
|
|
298
|
+
container: blocks[index],
|
|
299
|
+
"data-index": index,
|
|
300
|
+
gutter: rest.gutter,
|
|
301
|
+
nextContainer: blocks[index + 1],
|
|
302
|
+
onKeyDown: (e) => handleKeyDown(e, index, true),
|
|
303
|
+
onMouseDown: (e) => startResize(e, index, true, EVENT_TYPE.MOUSE),
|
|
304
|
+
tabIndex: 0,
|
|
305
|
+
v: true
|
|
306
|
+
}))));
|
|
315
307
|
}
|
|
316
|
-
|
|
317
|
-
ResizableContainer.defaultProps =
|
|
318
|
-
const DSResizableContainerWithSchema =
|
|
319
|
-
DSResizableContainerWithSchema.propTypes =
|
|
320
|
-
|
|
321
|
-
exports
|
|
322
|
-
|
|
323
|
-
exports["default"] = ResizableContainer;
|
|
308
|
+
ResizableContainer.propTypes = import_props.props;
|
|
309
|
+
ResizableContainer.defaultProps = import_defaultProps.defaultProps;
|
|
310
|
+
const DSResizableContainerWithSchema = (0, import_react_desc.describe)(ResizableContainer);
|
|
311
|
+
DSResizableContainerWithSchema.propTypes = import_props.props;
|
|
312
|
+
var Resizable_default = ResizableContainer;
|
|
313
|
+
module.exports = __toCommonJS(Resizable_exports);
|
|
314
|
+
//# sourceMappingURL=Resizable.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Resizable.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-lines */\n/* eslint-disable max-statements */\nimport React, { useRef, useState, useEffect } from 'react';\nimport { describe } from 'react-desc';\nimport styled from 'styled-components';\nimport { mapGap } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { props as rprops } from './props';\nimport { defaultProps } from './defaultProps';\n\nconst safeDifference = 15;\nconst minDifference = 8;\nconst EVENT_TYPE = { MOUSE: 'mouse', KEY: 'arrows' };\nconst DIRECTION = {\n L: 'left',\n R: 'right',\n U: 'up',\n D: 'down',\n};\n\nfunction calcPosition(arrow, position) {\n let offset;\n switch (arrow) {\n case DIRECTION.U:\n offset = position - 3;\n break;\n case DIRECTION.D:\n offset = position + 3;\n break;\n case DIRECTION.L:\n offset = position - 3;\n break;\n case DIRECTION.R:\n offset = position + 3;\n break;\n default:\n offset = position;\n }\n return offset;\n}\n\nfunction cursorResolver(nextPx, px, isVertical) {\n const orientation = {\n vertical: 'row-resize',\n horizontal: 'col-resize',\n left: 'w-resize',\n right: 'e-resize',\n up: 'n-resize',\n down: 's-resize',\n };\n\n if (isVertical && nextPx && nextPx <= safeDifference + 1)\n return orientation.up;\n if (isVertical && px > safeDifference + 1) return orientation.vertical;\n if (isVertical && px <= safeDifference + 1) return orientation.down;\n\n if (!isVertical && nextPx && nextPx <= safeDifference + 1)\n return orientation.left;\n if (!isVertical && px <= safeDifference + 1) return orientation.right;\n if (!isVertical && px > safeDifference + 1) return orientation.horizontal;\n\n return isVertical ? orientation.vertical : orientation.horizontal;\n}\n\nfunction ResizableItemComponent({ innerRef, ...p }) {\n return <Grid ref={innerRef} {...p} />;\n}\n\nconst ResizableGrid = styled(Grid)``;\nconst ResizableItem = styled(ResizableItemComponent)`\n position: relative;\n`;\nconst ResizableBar = styled.div`\n position: absolute;\n cursor: ${({ container, nextContainer, v }) =>\n cursorResolver(nextContainer, container, v)};\n\n ${(props) => {\n if (props.v) {\n return `\n bottom: calc(${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: ${props.theme.colors.neutral['300']};\n content: '';\n }\n &:hover{\n &:after{\n background: ${props.theme.colors.brand['600']};\n } \n }\n `;\n }\n return `\n top: 0;\n right: calc(${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: ${props.theme.colors.neutral['300']};\n content: '';\n }\n &:hover{\n &:after{\n background: ${props.theme.colors.brand['600']};\n } \n }\n `;\n }}\n`;\nconst getWidths = (list) => list.map((l) => l.clientWidth);\nconst getHeights = (list) => list.map((l) => l.clientHeight);\n\nfunction ResizableContainer({\n children,\n cols,\n rows,\n vertical,\n horizontal,\n ...rest\n}) {\n const refs = useRef([]);\n const [containers, setContainers] = useState(cols);\n const [blocks, setBlocks] = useState(rows);\n const [isDragging, setDragging] = useState(false);\n const [start, setStartPoint] = useState(0);\n const [resetPoint, setResetPoint] = useState();\n\n useEffect(() => {\n if (horizontal) setContainers(getWidths(refs.current));\n if (vertical) setBlocks(getHeights(refs.current));\n }, [refs.current, horizontal, vertical]);\n const addRef = (node) => {\n refs.current.push(node);\n };\n const resizePanels = (diff = 1, v = false) => {\n const index = parseInt(start.index, 10);\n if (!v) {\n const newContainers = [...containers];\n if (\n newContainers[index + 1] &&\n newContainers[index + 1] > minDifference\n ) {\n newContainers[index + 1] = newContainers[index + 1] - diff;\n newContainers[index] = diff + newContainers[index];\n } else if (\n newContainers[index - 1] &&\n newContainers[index - 1] > minDifference\n ) {\n newContainers[index - 1] = newContainers[index - 1] - diff;\n newContainers[index] = diff + newContainers[index];\n }\n if (newContainers.every((c) => c > safeDifference))\n setContainers(newContainers);\n } else {\n const newBlocks = [...blocks];\n if (newBlocks[index + 1] && newBlocks[index + 1] > minDifference) {\n newBlocks[index + 1] = newBlocks[index + 1] - diff;\n newBlocks[index] = diff + newBlocks[index];\n } else if (newBlocks[index - 1] && newBlocks[index - 1] > minDifference) {\n newBlocks[index - 1] = newBlocks[index - 1] - diff;\n newBlocks[index] = diff + newBlocks[index];\n }\n if (newBlocks.every((c) => c > safeDifference)) setBlocks(newBlocks);\n }\n };\n const startResize = (event, index, v = false, type) => {\n setDragging(type);\n setStartPoint({\n x: event.clientX,\n y: event.clientY,\n index,\n v,\n });\n setResetPoint({ containers, blocks });\n };\n const moveResize = (event, type) => {\n if (isDragging && isDragging === type && !start.v) {\n const diff = event.clientX - start.x;\n if (diff === 0) return;\n setStartPoint({ x: event.clientX, index: start.index });\n resizePanels(diff);\n } else if (isDragging && isDragging === type && start.v) {\n const diff = event.clientY - start.y;\n if (diff === 0) return;\n setStartPoint({ ...start, y: event.clientY, index: start.index });\n resizePanels(diff, true);\n }\n };\n const endResize = (type) => {\n if (isDragging === type) {\n setDragging(false);\n setStartPoint();\n }\n };\n const handleKeyDown = (e, index, v = false) => {\n const keyCodes = {\n 37: DIRECTION.L,\n Left: DIRECTION.L,\n ArrowLeft: DIRECTION.L,\n 38: DIRECTION.U,\n Up: DIRECTION.U,\n ArrowUp: DIRECTION.U,\n 39: DIRECTION.R,\n Right: DIRECTION.R,\n ArrowRight: DIRECTION.R,\n 40: DIRECTION.D,\n Down: DIRECTION.D,\n ArrowDown: DIRECTION.D,\n };\n\n if (keyCodes[e.key || e.keyCode]) {\n e.preventDefault();\n const { top: y, left: x } = e.target.getBoundingClientRect();\n if (!start) {\n startResize({ clientX: x, clientY: y }, index, v, EVENT_TYPE.KEY);\n } else {\n const clientX =\n keyCodes[e.keyCode] === DIRECTION.L ||\n keyCodes[e.keyCode] === DIRECTION.R\n ? calcPosition(keyCodes[e.keyCode], x)\n : x;\n const clientY =\n keyCodes[e.keyCode] === DIRECTION.U ||\n keyCodes[e.keyCode] === DIRECTION.D\n ? calcPosition(keyCodes[e.keyCode], y)\n : y;\n\n moveResize({ clientX, clientY }, EVENT_TYPE.KEY);\n }\n }\n };\n\n const onLeave = (type) => {\n if (isDragging === type) {\n setDragging(false);\n\n if (resetPoint && resetPoint.blocks) setBlocks(resetPoint.blocks);\n if (resetPoint && resetPoint.containers)\n setContainers(resetPoint.containers);\n }\n };\n const count = React.Children.count(children);\n\n return (\n <ResizableGrid\n {...rest}\n cols={containers}\n onKeyUp={() => endResize(EVENT_TYPE.KEY)}\n onMouseLeave={() => onLeave(EVENT_TYPE.MOUSE)}\n onMouseMove={(e) => moveResize(e, EVENT_TYPE.MOUSE)}\n onMouseUp={() => endResize(EVENT_TYPE.MOUSE)}\n rows={blocks}\n >\n {React.Children.map(children, (child, index) => (\n <ResizableItem data-index={index} innerRef={addRef}>\n {child}\n {count - 1 !== index && horizontal && (\n <ResizableBar\n container={containers[index]}\n data-index={index}\n gutter={rest.gutter}\n nextContainer={containers[index + 1]}\n onKeyDown={(e) => handleKeyDown(e, index, false)}\n onMouseDown={(e) =>\n startResize(e, index, false, EVENT_TYPE.MOUSE)\n }\n tabIndex={0}\n />\n )}\n {count - 1 !== index && vertical && (\n <ResizableBar\n container={blocks[index]}\n data-index={index}\n gutter={rest.gutter}\n nextContainer={blocks[index + 1]}\n onKeyDown={(e) => handleKeyDown(e, index, true)}\n onMouseDown={(e) => startResize(e, index, true, EVENT_TYPE.MOUSE)}\n tabIndex={0}\n v\n />\n )}\n </ResizableItem>\n ))}\n </ResizableGrid>\n );\n}\n\nResizableContainer.propTypes = rprops;\nResizableContainer.defaultProps = defaultProps;\n\nconst DSResizableContainerWithSchema = describe(ResizableContainer);\nDSResizableContainerWithSchema.propTypes = rprops;\n\nexport { ResizableContainer, DSResizableContainerWithSchema };\nexport default ResizableContainer;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAAmD;AACnD,wBAAyB;AACzB,+BAAmB;AACnB,uBAAuB;AACvB,qBAAqB;AACrB,mBAAgC;AAChC,0BAA6B;AAE7B,MAAM,iBAAiB;AACvB,MAAM,gBAAgB;AACtB,MAAM,aAAa,EAAE,OAAO,SAAS,KAAK;AAC1C,MAAM,YAAY;AAAA,EAChB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAA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,cAAc,MAAM,QAAQ,WAAW;AAAA,IACvC,aAAa,CAAC,MAAM,WAAW,GAAG,WAAW;AAAA,IAC7C,WAAW,MAAM,UAAU,WAAW;AAAA,IACtC,MAAM;AAAA,KAEL,qBAAM,SAAS,IAAI,UAAU,CAAC,OAAO,UACpC,mDAAC,eAAD;AAAA,IAAe,cAAY;AAAA,IAAO,UAAU;AAAA,KACzC,OACA,QAAQ,MAAM,SAAS,cACtB,mDAAC,cAAD;AAAA,IACE,WAAW,WAAW;AAAA,IACtB,cAAY;AAAA,IACZ,QAAQ,KAAK;AAAA,IACb,eAAe,WAAW,QAAQ;AAAA,IAClC,WAAW,CAAC,MAAM,cAAc,GAAG,OAAO;AAAA,IAC1C,aAAa,CAAC,MACZ,YAAY,GAAG,OAAO,OAAO,WAAW;AAAA,IAE1C,UAAU;AAAA,MAGb,QAAQ,MAAM,SAAS,YACtB,mDAAC,cAAD;AAAA,IACE,WAAW,OAAO;AAAA,IAClB,cAAY;AAAA,IACZ,QAAQ,KAAK;AAAA,IACb,eAAe,OAAO,QAAQ;AAAA,IAC9B,WAAW,CAAC,MAAM,cAAc,GAAG,OAAO;AAAA,IAC1C,aAAa,CAAC,MAAM,YAAY,GAAG,OAAO,MAAM,WAAW;AAAA,IAC3D,UAAU;AAAA,IACV,GAAC;AAAA;AAAA;AASf,mBAAmB,YAAY;AAC/B,mBAAmB,eAAe;AAElC,MAAM,iCAAiC,gCAAS;AAChD,+BAA+B,YAAY;AAG3C,IAAO,oBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/cjs/defaultProps.js
CHANGED
|
@@ -1,10 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
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"));
|
|
5
33
|
const defaultProps = {
|
|
6
34
|
vertical: false,
|
|
7
35
|
horizontal: false
|
|
8
36
|
};
|
|
9
|
-
|
|
10
|
-
|
|
37
|
+
module.exports = __toCommonJS(defaultProps_exports);
|
|
38
|
+
//# sourceMappingURL=defaultProps.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/defaultProps.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export const defaultProps = {\n vertical: false,\n horizontal: false,\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,eAAe;AAAA,EAC1B,UAAU;AAAA,EACV,YAAY;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|