@byeolnaerim/flex-layout 0.0.8 → 0.0.10
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/dist/flex-layout/components/FlexLayout.cjs +1 -76
- package/dist/flex-layout/components/FlexLayout.js +1 -70
- package/dist/flex-layout/components/FlexLayoutContainer.cjs +1 -196
- package/dist/flex-layout/components/FlexLayoutContainer.js +1 -189
- package/dist/flex-layout/components/FlexLayoutIFramePane.cjs +1 -0
- package/dist/flex-layout/components/FlexLayoutIFramePane.d.ts +4 -0
- package/dist/flex-layout/components/FlexLayoutIFramePane.js +1 -0
- package/dist/flex-layout/components/FlexLayoutResizePanel.cjs +1 -192
- package/dist/flex-layout/components/FlexLayoutResizePanel.d.ts +1 -1
- package/dist/flex-layout/components/FlexLayoutResizePanel.js +1 -186
- package/dist/flex-layout/components/FlexLayoutSplitScreen.cjs +1 -1211
- package/dist/flex-layout/components/FlexLayoutSplitScreen.js +1 -1197
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.cjs +1 -339
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.d.ts +1 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.js +1 -333
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.cjs +1 -32
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.js +1 -25
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.cjs +1 -40
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.js +1 -34
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.cjs +1 -30
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.js +1 -24
- package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.cjs +1 -109
- package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.js +1 -103
- package/dist/flex-layout/components/FlexLayoutStickyBox.cjs +1 -226
- package/dist/flex-layout/components/FlexLayoutStickyBox.d.ts +1 -0
- package/dist/flex-layout/components/FlexLayoutStickyBox.js +1 -224
- package/dist/flex-layout/components/index.cjs +1 -52
- package/dist/flex-layout/components/index.js +1 -9
- package/dist/flex-layout/hooks/index.cjs +1 -21
- package/dist/flex-layout/hooks/index.js +1 -4
- package/dist/flex-layout/hooks/useDrag.cjs +1 -232
- package/dist/flex-layout/hooks/useDrag.d.ts +20 -0
- package/dist/flex-layout/hooks/useDrag.js +1 -219
- package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.cjs +1 -118
- package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.js +1 -116
- package/dist/flex-layout/hooks/useListPaging.cjs +1 -179
- package/dist/flex-layout/hooks/useListPaging.js +1 -175
- package/dist/flex-layout/hooks/useSizes.cjs +1 -104
- package/dist/flex-layout/hooks/useSizes.js +1 -101
- package/dist/flex-layout/index.cjs +1 -42
- package/dist/flex-layout/index.js +1 -7
- package/dist/flex-layout/providers/FlexLayoutContext.cjs +1 -26
- package/dist/flex-layout/providers/FlexLayoutContext.js +1 -23
- package/dist/flex-layout/providers/FlexLayoutHooks.cjs +1 -247
- package/dist/flex-layout/providers/FlexLayoutHooks.d.ts +5 -1
- package/dist/flex-layout/providers/FlexLayoutHooks.js +1 -238
- package/dist/flex-layout/providers/index.cjs +1 -14
- package/dist/flex-layout/providers/index.js +1 -3
- package/dist/flex-layout/store/FlexLayoutContainerStore.cjs +1 -203
- package/dist/flex-layout/store/FlexLayoutContainerStore.d.ts +1 -0
- package/dist/flex-layout/store/FlexLayoutContainerStore.js +1 -181
- package/dist/flex-layout/store/index.cjs +1 -14
- package/dist/flex-layout/store/index.js +1 -3
- package/dist/flex-layout/styles/FlexLayout.module.css +473 -416
- package/dist/flex-layout/types/FlexDirectionTypes.cjs +1 -4
- package/dist/flex-layout/types/FlexDirectionTypes.js +0 -3
- package/dist/flex-layout/types/FlexLayoutTypes.cjs +1 -4
- package/dist/flex-layout/types/FlexLayoutTypes.d.ts +1 -3
- package/dist/flex-layout/types/FlexLayoutTypes.js +0 -3
- package/dist/flex-layout/utils/FlexLayoutUtils.cjs +1 -208
- package/dist/flex-layout/utils/FlexLayoutUtils.d.ts +4 -4
- package/dist/flex-layout/utils/FlexLayoutUtils.js +1 -196
- package/dist/flex-layout/utils/index.cjs +1 -14
- package/dist/flex-layout/utils/index.js +1 -3
- package/dist/index.cjs +1 -14
- package/dist/index.js +1 -3
- package/dist/types/css.d.cjs +1 -4
- package/dist/types/css.d.js +0 -3
- package/package.json +116 -109
- package/dist/flex-layout/components/FlexLayout.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayout.js.map +0 -1
- package/dist/flex-layout/components/FlexLayoutContainer.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayoutContainer.js.map +0 -1
- package/dist/flex-layout/components/FlexLayoutResizePanel.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayoutResizePanel.js.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreen.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreen.js.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.js.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.js.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.js.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.js.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.js.map +0 -1
- package/dist/flex-layout/components/FlexLayoutStickyBox.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayoutStickyBox.js.map +0 -1
- package/dist/flex-layout/components/index.cjs.map +0 -1
- package/dist/flex-layout/components/index.js.map +0 -1
- package/dist/flex-layout/hooks/index.cjs.map +0 -1
- package/dist/flex-layout/hooks/index.js.map +0 -1
- package/dist/flex-layout/hooks/useDrag.cjs.map +0 -1
- package/dist/flex-layout/hooks/useDrag.js.map +0 -1
- package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.cjs.map +0 -1
- package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.js.map +0 -1
- package/dist/flex-layout/hooks/useListPaging.cjs.map +0 -1
- package/dist/flex-layout/hooks/useListPaging.js.map +0 -1
- package/dist/flex-layout/hooks/useSizes.cjs.map +0 -1
- package/dist/flex-layout/hooks/useSizes.js.map +0 -1
- package/dist/flex-layout/index.cjs.map +0 -1
- package/dist/flex-layout/index.js.map +0 -1
- package/dist/flex-layout/providers/FlexLayoutContext.cjs.map +0 -1
- package/dist/flex-layout/providers/FlexLayoutContext.js.map +0 -1
- package/dist/flex-layout/providers/FlexLayoutHooks.cjs.map +0 -1
- package/dist/flex-layout/providers/FlexLayoutHooks.js.map +0 -1
- package/dist/flex-layout/providers/index.cjs.map +0 -1
- package/dist/flex-layout/providers/index.js.map +0 -1
- package/dist/flex-layout/store/FlexLayoutContainerStore.cjs.map +0 -1
- package/dist/flex-layout/store/FlexLayoutContainerStore.js.map +0 -1
- package/dist/flex-layout/store/index.cjs.map +0 -1
- package/dist/flex-layout/store/index.js.map +0 -1
- package/dist/flex-layout/types/FlexDirectionTypes.cjs.map +0 -1
- package/dist/flex-layout/types/FlexDirectionTypes.js.map +0 -1
- package/dist/flex-layout/types/FlexLayoutTypes.cjs.map +0 -1
- package/dist/flex-layout/types/FlexLayoutTypes.js.map +0 -1
- package/dist/flex-layout/utils/FlexLayoutUtils.cjs.map +0 -1
- package/dist/flex-layout/utils/FlexLayoutUtils.js.map +0 -1
- package/dist/flex-layout/utils/index.cjs.map +0 -1
- package/dist/flex-layout/utils/index.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types/css.d.cjs.map +0 -1
- package/dist/types/css.d.js.map +0 -1
|
@@ -1,333 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useRef, useEffect } from 'react';
|
|
3
|
-
import { useDragEvents, dragState } from '../hooks/useDrag';
|
|
4
|
-
import styles from '../styles/FlexLayout.module.css';
|
|
5
|
-
import { isDocumentOut } from '../utils/FlexLayoutUtils';
|
|
6
|
-
|
|
7
|
-
const MAX_STEP = 18;
|
|
8
|
-
function edgeVelocity(x, y) {
|
|
9
|
-
const w = window.innerWidth, h = window.innerHeight;
|
|
10
|
-
const mx = w * 0.15, my = h * 0.15;
|
|
11
|
-
let vx = 0;
|
|
12
|
-
if (x < mx)
|
|
13
|
-
vx = -((mx - x) / mx) * MAX_STEP;
|
|
14
|
-
else if (x > w - mx)
|
|
15
|
-
vx = (x - (w - mx)) / mx * MAX_STEP;
|
|
16
|
-
let vy = 0;
|
|
17
|
-
if (y < my)
|
|
18
|
-
vy = -((my - y) / my) * MAX_STEP;
|
|
19
|
-
else if (y > h - my)
|
|
20
|
-
vy = (y - (h - my)) / my * MAX_STEP;
|
|
21
|
-
return { vx, vy };
|
|
22
|
-
}
|
|
23
|
-
function FlexLayoutSplitScreenDragBox({
|
|
24
|
-
onMouseDown,
|
|
25
|
-
onTouchStart,
|
|
26
|
-
dropEndCallback,
|
|
27
|
-
style,
|
|
28
|
-
navigationTitle,
|
|
29
|
-
targetComponent,
|
|
30
|
-
containerName,
|
|
31
|
-
children,
|
|
32
|
-
className,
|
|
33
|
-
dropDocumentOutsideOption,
|
|
34
|
-
screenKey = Array.from(
|
|
35
|
-
window.crypto.getRandomValues(new Uint32Array(16)),
|
|
36
|
-
(e) => e.toString(32).padStart(2, "0")
|
|
37
|
-
).join(""),
|
|
38
|
-
isBlockingActiveInput = false,
|
|
39
|
-
customData = {},
|
|
40
|
-
scrollTargetRef,
|
|
41
|
-
...props
|
|
42
|
-
}) {
|
|
43
|
-
const scrollRAF = useRef(null);
|
|
44
|
-
const velocity = useRef({ vx: 0, vy: 0 });
|
|
45
|
-
const ref = useRef(null);
|
|
46
|
-
const clonedNodeRef = useRef(null);
|
|
47
|
-
const clonedWidth = useRef(null);
|
|
48
|
-
const clonedHeight = useRef(null);
|
|
49
|
-
const hrefUrlRef = useRef("");
|
|
50
|
-
const { handleStart, handleMove, handleEnd } = useDragEvents({
|
|
51
|
-
isBlockingActiveInput
|
|
52
|
-
});
|
|
53
|
-
const handleMoveWrapper = (event) => {
|
|
54
|
-
let x = 0;
|
|
55
|
-
let y = 0;
|
|
56
|
-
if (event.type === "touchmove") {
|
|
57
|
-
const t = event.touches[0];
|
|
58
|
-
x = t.clientX;
|
|
59
|
-
y = t.clientY;
|
|
60
|
-
} else {
|
|
61
|
-
const m = event;
|
|
62
|
-
x = m.clientX;
|
|
63
|
-
y = m.clientY;
|
|
64
|
-
}
|
|
65
|
-
const { vx, vy } = edgeVelocity(x, y);
|
|
66
|
-
const inEdge = vx !== 0 || vy !== 0;
|
|
67
|
-
if (clonedNodeRef.current?.isConnected && !inEdge) {
|
|
68
|
-
event.preventDefault();
|
|
69
|
-
if (scrollRAF.current) {
|
|
70
|
-
cancelAnimationFrame(scrollRAF.current);
|
|
71
|
-
scrollRAF.current = null;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (clonedNodeRef.current?.isConnected && inEdge) {
|
|
75
|
-
event.preventDefault();
|
|
76
|
-
velocity.current = { vx, vy };
|
|
77
|
-
if (!scrollRAF.current) {
|
|
78
|
-
const step = () => {
|
|
79
|
-
const target = scrollTargetRef?.current ?? document.scrollingElement;
|
|
80
|
-
if (target?.scrollBy) {
|
|
81
|
-
target.scrollBy(
|
|
82
|
-
velocity.current.vx,
|
|
83
|
-
velocity.current.vy
|
|
84
|
-
);
|
|
85
|
-
} else {
|
|
86
|
-
window.scrollBy(
|
|
87
|
-
velocity.current.vx,
|
|
88
|
-
velocity.current.vy
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
if (velocity.current.vx === 0 && velocity.current.vy === 0) {
|
|
92
|
-
scrollRAF.current = null;
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
scrollRAF.current = requestAnimationFrame(step);
|
|
96
|
-
};
|
|
97
|
-
scrollRAF.current = requestAnimationFrame(step);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (event.type !== "touchmove") {
|
|
101
|
-
event.preventDefault();
|
|
102
|
-
}
|
|
103
|
-
handleMove({
|
|
104
|
-
event,
|
|
105
|
-
notDragCallback: ({ x: x2, y: y2 }) => {
|
|
106
|
-
if (clonedNodeRef.current) clonedNodeRef.current.remove();
|
|
107
|
-
},
|
|
108
|
-
dragStartCallback: ({ x: x2, y: y2 }) => {
|
|
109
|
-
if (!clonedNodeRef.current) return;
|
|
110
|
-
navigator.vibrate(100);
|
|
111
|
-
clonedNodeRef.current.style.left = `${x2 - (clonedWidth.current || 0) / 2}px`;
|
|
112
|
-
clonedNodeRef.current.style.top = `${y2 - (clonedHeight.current || 0) / 2}px`;
|
|
113
|
-
},
|
|
114
|
-
moveingCallback: ({ x: x2, y: y2 }) => {
|
|
115
|
-
if (clonedNodeRef.current?.isConnected) {
|
|
116
|
-
clonedNodeRef.current.style.left = `${x2 - (clonedWidth.current || 0) / 2}px`;
|
|
117
|
-
clonedNodeRef.current.style.top = `${y2 - (clonedHeight.current || 0) / 2}px`;
|
|
118
|
-
}
|
|
119
|
-
dragState.next({
|
|
120
|
-
isDragging: true,
|
|
121
|
-
isDrop: false,
|
|
122
|
-
navigationTitle,
|
|
123
|
-
children: targetComponent,
|
|
124
|
-
x: x2,
|
|
125
|
-
y: y2,
|
|
126
|
-
containerName,
|
|
127
|
-
dropDocumentOutsideOption,
|
|
128
|
-
customData
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
};
|
|
133
|
-
const handleEndWrapper = (event) => {
|
|
134
|
-
if (scrollRAF.current !== null) {
|
|
135
|
-
cancelAnimationFrame(scrollRAF.current);
|
|
136
|
-
scrollRAF.current = null;
|
|
137
|
-
}
|
|
138
|
-
velocity.current = { vx: 0, vy: 0 };
|
|
139
|
-
handleEnd({
|
|
140
|
-
event,
|
|
141
|
-
dragEndCallback: ({ x, y }) => {
|
|
142
|
-
const href = hrefUrlRef.current;
|
|
143
|
-
if (clonedNodeRef.current) clonedNodeRef.current.remove();
|
|
144
|
-
if (dropDocumentOutsideOption && isDocumentOut({ x, y })) {
|
|
145
|
-
if (dropDocumentOutsideOption.isNewTap || !dropDocumentOutsideOption.widthRatio && !dropDocumentOutsideOption.heightRatio) {
|
|
146
|
-
window.open(href, "_blank");
|
|
147
|
-
} else {
|
|
148
|
-
const width = window.innerWidth * (dropDocumentOutsideOption.widthRatio || 1);
|
|
149
|
-
const height = window.innerHeight * (dropDocumentOutsideOption.heightRatio || 1);
|
|
150
|
-
window.open(
|
|
151
|
-
href,
|
|
152
|
-
"_blank",
|
|
153
|
-
`width=${width},height=${height},left=${window.screenLeft - x * -1 - width},top=${window.screenTop + y}`
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
dragState.next({
|
|
158
|
-
isDragging: false,
|
|
159
|
-
isDrop: true,
|
|
160
|
-
navigationTitle,
|
|
161
|
-
children: targetComponent,
|
|
162
|
-
x,
|
|
163
|
-
y,
|
|
164
|
-
containerName,
|
|
165
|
-
dropDocumentOutsideOption,
|
|
166
|
-
dropEndCallback,
|
|
167
|
-
screenKey,
|
|
168
|
-
customData
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
};
|
|
173
|
-
useEffect(() => {
|
|
174
|
-
if (ref.current) {
|
|
175
|
-
const clone = ref.current.cloneNode(true);
|
|
176
|
-
const originRect = ref.current.getBoundingClientRect();
|
|
177
|
-
clone.style.width = originRect.width + "px";
|
|
178
|
-
clone.style.height = originRect.height + "px";
|
|
179
|
-
clone.style.opacity = "0.3";
|
|
180
|
-
clone.style.backdropFilter = "blur(6px)";
|
|
181
|
-
clonedWidth.current = originRect.width;
|
|
182
|
-
clonedHeight.current = originRect.height;
|
|
183
|
-
if (dropDocumentOutsideOption?.openUrl) {
|
|
184
|
-
hrefUrlRef.current = dropDocumentOutsideOption.openUrl;
|
|
185
|
-
const href = document.createElement("span");
|
|
186
|
-
href.textContent = hrefUrlRef.current;
|
|
187
|
-
clone.prepend(href);
|
|
188
|
-
}
|
|
189
|
-
if (navigationTitle) {
|
|
190
|
-
const title = document.createElement("span");
|
|
191
|
-
title.textContent = navigationTitle;
|
|
192
|
-
clone.prepend(title);
|
|
193
|
-
}
|
|
194
|
-
clone.style.position = "fixed";
|
|
195
|
-
clonedNodeRef.current = clone;
|
|
196
|
-
clonedNodeRef.current.classList.add(
|
|
197
|
-
styles["flex-split-screen-drag-box-clone"]
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
}, []);
|
|
201
|
-
useEffect(() => {
|
|
202
|
-
const moveEvents = [
|
|
203
|
-
"mousemove",
|
|
204
|
-
"touchmove"
|
|
205
|
-
];
|
|
206
|
-
const endEvents = ["mouseup", "touchend"];
|
|
207
|
-
moveEvents.forEach((eventName) => {
|
|
208
|
-
window.addEventListener(eventName, handleMoveWrapper, {
|
|
209
|
-
passive: false
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
endEvents.forEach((eventName) => {
|
|
213
|
-
window.addEventListener(eventName, handleEndWrapper);
|
|
214
|
-
});
|
|
215
|
-
return () => {
|
|
216
|
-
moveEvents.forEach((eventName) => {
|
|
217
|
-
window.removeEventListener(eventName, handleMoveWrapper);
|
|
218
|
-
});
|
|
219
|
-
endEvents.forEach((eventName) => {
|
|
220
|
-
window.removeEventListener(eventName, handleEndWrapper);
|
|
221
|
-
});
|
|
222
|
-
};
|
|
223
|
-
}, [
|
|
224
|
-
customData,
|
|
225
|
-
targetComponent,
|
|
226
|
-
dropDocumentOutsideOption,
|
|
227
|
-
screenKey,
|
|
228
|
-
isBlockingActiveInput,
|
|
229
|
-
containerName,
|
|
230
|
-
navigationTitle,
|
|
231
|
-
dropEndCallback
|
|
232
|
-
]);
|
|
233
|
-
useEffect(() => {
|
|
234
|
-
const el = ref.current;
|
|
235
|
-
if (!el) return;
|
|
236
|
-
const onCtx = (e) => e.preventDefault();
|
|
237
|
-
el.addEventListener("contextmenu", onCtx);
|
|
238
|
-
return () => {
|
|
239
|
-
el.removeEventListener("contextmenu", onCtx);
|
|
240
|
-
};
|
|
241
|
-
}, []);
|
|
242
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
243
|
-
"div",
|
|
244
|
-
{
|
|
245
|
-
className: `${className || ""} ${styles["flex-split-screen-drag-box"]}`,
|
|
246
|
-
ref,
|
|
247
|
-
onContextMenu: (e) => e.preventDefault(),
|
|
248
|
-
onMouseDown: (ev) => {
|
|
249
|
-
if (onMouseDown) {
|
|
250
|
-
Promise.resolve().then(() => onMouseDown(ev));
|
|
251
|
-
}
|
|
252
|
-
handleStart({
|
|
253
|
-
event: ev,
|
|
254
|
-
dragStartCallback: ({ x, y }) => {
|
|
255
|
-
if (clonedNodeRef.current) {
|
|
256
|
-
document.body.appendChild(
|
|
257
|
-
clonedNodeRef.current
|
|
258
|
-
);
|
|
259
|
-
if (ref.current) {
|
|
260
|
-
const originRect = ref.current.getBoundingClientRect();
|
|
261
|
-
clonedNodeRef.current.style.width = originRect.width + "px";
|
|
262
|
-
clonedNodeRef.current.style.height = originRect.height + "px";
|
|
263
|
-
clonedWidth.current = originRect.width;
|
|
264
|
-
clonedHeight.current = originRect.height;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
if (clonedNodeRef.current?.isConnected) {
|
|
268
|
-
navigator.vibrate(100);
|
|
269
|
-
clonedNodeRef.current.style.left = `${x - (clonedWidth.current || 0) / 2}px`;
|
|
270
|
-
clonedNodeRef.current.style.top = `${y - (clonedHeight.current || 0) / 2}px`;
|
|
271
|
-
}
|
|
272
|
-
dragState.next({
|
|
273
|
-
isDragging: true,
|
|
274
|
-
isDrop: false,
|
|
275
|
-
navigationTitle,
|
|
276
|
-
children: targetComponent,
|
|
277
|
-
x,
|
|
278
|
-
y,
|
|
279
|
-
containerName,
|
|
280
|
-
dropDocumentOutsideOption,
|
|
281
|
-
customData
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
},
|
|
286
|
-
onTouchStart: (ev) => {
|
|
287
|
-
if (onTouchStart) {
|
|
288
|
-
Promise.resolve().then(() => onTouchStart(ev));
|
|
289
|
-
}
|
|
290
|
-
handleStart({
|
|
291
|
-
event: ev,
|
|
292
|
-
dragStartCallback: ({ x, y }) => {
|
|
293
|
-
if (clonedNodeRef.current) {
|
|
294
|
-
document.body.appendChild(
|
|
295
|
-
clonedNodeRef.current
|
|
296
|
-
);
|
|
297
|
-
if (ref.current) {
|
|
298
|
-
const originRect = ref.current.getBoundingClientRect();
|
|
299
|
-
clonedNodeRef.current.style.width = originRect.width + "px";
|
|
300
|
-
clonedNodeRef.current.style.height = originRect.height + "px";
|
|
301
|
-
clonedWidth.current = originRect.width;
|
|
302
|
-
clonedHeight.current = originRect.height;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
if (clonedNodeRef.current?.isConnected) {
|
|
306
|
-
navigator.vibrate(100);
|
|
307
|
-
clonedNodeRef.current.style.left = `${x - (clonedWidth.current || 0) / 2}px`;
|
|
308
|
-
clonedNodeRef.current.style.top = `${y - (clonedHeight.current || 0) / 2}px`;
|
|
309
|
-
}
|
|
310
|
-
dragState.next({
|
|
311
|
-
isDragging: true,
|
|
312
|
-
isDrop: false,
|
|
313
|
-
navigationTitle,
|
|
314
|
-
children: targetComponent,
|
|
315
|
-
x,
|
|
316
|
-
y,
|
|
317
|
-
containerName,
|
|
318
|
-
dropDocumentOutsideOption,
|
|
319
|
-
customData
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
},
|
|
324
|
-
style: { ...style },
|
|
325
|
-
...props,
|
|
326
|
-
children
|
|
327
|
-
}
|
|
328
|
-
) });
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
export { FlexLayoutSplitScreenDragBox as default };
|
|
332
|
-
//# sourceMappingURL=FlexLayoutSplitScreenDragBox.js.map
|
|
333
|
-
//# sourceMappingURL=FlexLayoutSplitScreenDragBox.js.map
|
|
1
|
+
"use client";import{Fragment as ce,jsx as W}from"react/jsx-runtime";import{useEffect as S,useRef as m,useState as J}from"react";import{dragStateSubject as Q,useDragEvents as Z}from"../hooks/useDrag";import N from"../styles/FlexLayout.module.css";import{isDocumentOut as O}from"../utils/FlexLayoutUtils";import{FlexLayoutIFramePane as ee}from"./FlexLayoutIFramePane";const F=18;function re(c,s){const d=window.innerWidth,g=window.innerHeight,i=d*.15,o=g*.15;return c<i||c>d-i||s<o||s>g-o}function ne(c,s){const d=window.innerWidth,g=window.innerHeight,i=d*.15,o=g*.15;let a=0;c<i?a=-((i-c)/i)*F:c>d-i&&(a=(c-(d-i))/i*F);let v=0;return s<o?v=-((o-s)/o)*F:s>g-o&&(v=(s-(g-o))/o*F),{vx:a,vy:v}}function pe(c,s,d,g){const i=window.innerWidth,o=window.innerHeight,a=i*.15,v=o*.15,H=d<a?1+(a-d)/a*3:d>i-a?1+(d-(i-a))/a*3:1,r=g<v?1+(v-g)/v*3:g>o-v?1+(g-(o-v))/v*3:1;return{vx:-c*H,vy:-s*r}}function te(){const c=globalThis.crypto;return c?.randomUUID?c.randomUUID():c?.getRandomValues?Array.from(c.getRandomValues(new Uint32Array(16)),s=>s.toString(32).padStart(2,"0")).join(""):`${Date.now().toString(32)}-${Math.random().toString(32).slice(2)}`}function T(c,s){if(c)return c;if(s)return W(ee,{url:s})}function R(c){if(c)try{return new URL(c).hostname}catch{return c}}function le({onMouseDown:c,onTouchStart:s,dropEndCallback:d,style:g,navigationTitle:i,targetComponent:o,containerName:a,children:v,className:H,dropDocumentOutsideOption:r,screenKey:k,isBlockingActiveInput:X=!1,customData:E={},scrollTargetRef:_,...z}){const[K,V]=J();S(()=>{V(k||te())},[k]);const f=m(null),w=m({vx:0,vy:0}),y=m(null),n=m(null),b=m(null),x=m(null),$=m(""),U=m(null),C=m(null),D=m({x:0,y:0}),P=m(!1),L=e=>{C.current=e,U.current==null&&(U.current=requestAnimationFrame(()=>{C.current&&Q.next(C.current),C.current=null,U.current=null}))};S(()=>()=>{U.current!=null&&cancelAnimationFrame(U.current)},[]);const{handleStart:Y,handleMove:G,handleEnd:B}=Z({isBlockingActiveInput:X}),I=e=>{let l=!1,t=0,u=0;if(e.type==="touchmove"){const h=e.touches[0];t=h.clientX,u=h.clientY}else{const h=e;t=h.clientX,u=h.clientY}const{vx:M,vy:A}=ne(t,u),q=M!==0||A!==0;if(l=re(t,u),n.current?.isConnected&&!q&&(e.preventDefault(),f.current&&(cancelAnimationFrame(f.current),f.current=null)),n.current?.isConnected&&q&&(e.preventDefault(),w.current={vx:M,vy:A},!f.current)){const h=()=>{const p=_?.current??document.scrollingElement;if(p?.scrollBy?p.scrollBy(w.current.vx,w.current.vy):window.scrollBy(w.current.vx,w.current.vy),w.current.vx===0&&w.current.vy===0){f.current=null;return}f.current=requestAnimationFrame(h)};f.current=requestAnimationFrame(h)}e.type!=="touchmove"&&e.preventDefault(),G({event:e,notDragCallback:({x:h,y:p})=>{n.current&&n.current.remove()},dragStartCallback:({x:h,y:p})=>{n.current&&(navigator.vibrate(100),n.current.style.transform=`translate3d(${h-(b.current||0)/2}px, ${p-(x.current||0)/2}px, 0)`)},moveingCallback:({x:h,y:p})=>{D.current={x:h,y:p},n.current?.isConnected&&(n.current.style.transform=`translate3d(${h-(b.current||0)/2}px, ${p-(x.current||0)/2}px, 0)`),L({isDragging:!0,isDrop:!1,navigationTitle:i??R(r?.openUrl),children:T(o,r?.openUrl),x:h,y:p,containerName:a,dropDocumentOutsideOption:r,customData:E})}})},j=e=>{f.current!==null&&(cancelAnimationFrame(f.current),f.current=null),w.current={vx:0,vy:0},(e.type==="blur"||e.type==="touchcancel"||e.type==="pointercancel")&&n.current&&n.current.remove(),B({event:e,dragEndCallback:({x:l,y:t})=>{if(P.current){P.current=!1,n.current&&n.current.remove(),L({isDragging:!1,isDrop:!1,navigationTitle:i??R(r?.openUrl),children:T(o,r?.openUrl),x:l,y:t,containerName:a,dropDocumentOutsideOption:r,customData:E});return}const u=$.current;if(n.current&&n.current.remove(),r&&O({x:l,y:t}))if(r.isNewTap||!r.widthRatio&&!r.heightRatio)window.open(u,"_blank");else{const M=window.innerWidth*(r.widthRatio||1),A=window.innerHeight*(r.heightRatio||1);window.open(u,"_blank",`width=${M},height=${A},left=${window.screenLeft-l*-1-M},top=${window.screenTop+t}`)}L({isDragging:!1,isDrop:!0,navigationTitle:i??R(r?.openUrl),children:T(o,r?.openUrl),x:l,y:t,containerName:a,dropDocumentOutsideOption:r,dropEndCallback:d,screenKey:K,customData:E})}})};return S(()=>{if(y.current){const e=y.current.cloneNode(!0),l=y.current.getBoundingClientRect();if(e.style.width=l.width+"px",e.style.height=l.height+"px",e.style.opacity="0.3",e.style.backdropFilter="blur(6px)",b.current=l.width,x.current=l.height,r?.openUrl){$.current=r.openUrl;const u=document.createElement("span");u.textContent=$.current,e.prepend(u)}const t=document.createElement("span");t.textContent=i??R(r?.openUrl)??"",e.prepend(t),e.style.position="fixed",e.style.left="0px",e.style.top="0px",e.style.margin="0px",e.style.willChange="transform",e.style.transform="translate3d(-9999px, -9999px, 0)",e.style.pointerEvents="none",n.current=e,n.current.classList.add(N["flex-split-screen-drag-box-clone"])}},[]),S(()=>{const e=["mousemove","touchmove"],l=["mouseup","touchend","touchcancel","pointerup","pointercancel","blur"];return e.forEach(t=>{window.addEventListener(t,I,{passive:!1})}),l.forEach(t=>{window.addEventListener(t,j)}),()=>{e.forEach(t=>{window.removeEventListener(t,I)}),l.forEach(t=>{window.removeEventListener(t,j)})}},[E,o,r,K,X,a,i,d]),S(()=>{const e=y.current;if(!e)return;const l=t=>t.preventDefault();return e.addEventListener("contextmenu",l),()=>{e.removeEventListener("contextmenu",l)}},[]),S(()=>()=>{f.current!==null&&(cancelAnimationFrame(f.current),f.current=null),w.current={vx:0,vy:0},n.current?.remove()},[]),S(()=>{const e=l=>{if(l.key!=="Escape"||!n.current?.isConnected)return;l.preventDefault(),l.stopPropagation(),P.current=!0,f.current!==null&&(cancelAnimationFrame(f.current),f.current=null),w.current={vx:0,vy:0},n.current?.remove(),B({event:new Event("pointercancel"),dragEndCallback:()=>{}});const{x:t,y:u}=D.current;L({isDragging:!1,isDrop:!1,navigationTitle:i??R(r?.openUrl),children:T(o,r?.openUrl),x:t,y:u,containerName:a,dropDocumentOutsideOption:r,customData:E})};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[B,a,i,r,o,E]),W(ce,{children:W("div",{className:`${H||""} ${N["flex-split-screen-drag-box"]}`,ref:y,onContextMenu:e=>e.preventDefault(),onMouseDown:e=>{c&&Promise.resolve().then(()=>c(e)),Y({event:e,dragStartCallback:({x:l,y:t})=>{if(D.current={x:l,y:t},n.current&&(document.body.appendChild(n.current),y.current)){const u=y.current.getBoundingClientRect();n.current.style.width=u.width+"px",n.current.style.height=u.height+"px",b.current=u.width,x.current=u.height}n.current?.isConnected&&(navigator.vibrate(100),n.current.style.transform=`translate3d(${l-(b.current||0)/2}px, ${t-(x.current||0)/2}px, 0)`),L({isDragging:!0,isDrop:!1,navigationTitle:i??R(r?.openUrl),children:T(o,r?.openUrl),x:l,y:t,containerName:a,dropDocumentOutsideOption:r,customData:E})}})},onTouchStart:e=>{s&&Promise.resolve().then(()=>s(e)),Y({event:e,dragStartCallback:({x:l,y:t})=>{if(n.current&&(document.body.appendChild(n.current),y.current)){const u=y.current.getBoundingClientRect();n.current.style.width=u.width+"px",n.current.style.height=u.height+"px",b.current=u.width,x.current=u.height}n.current?.isConnected&&(navigator.vibrate(100),n.current.style.transform=`translate3d(${l-(b.current||0)/2}px, ${t-(x.current||0)/2}px, 0)`),L({isDragging:!0,isDrop:!1,navigationTitle:i??R(r?.openUrl),children:T(o,r?.openUrl),x:l,y:t,containerName:a,dropDocumentOutsideOption:r,customData:E})}})},style:{...g},...z,children:v})})}export{le as default};
|
|
@@ -1,32 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var styles = require('../styles/FlexLayout.module.css');
|
|
5
|
-
var FlexLayoutSplitScreenScrollBox = require('./FlexLayoutSplitScreenScrollBox');
|
|
6
|
-
|
|
7
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
-
|
|
9
|
-
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
10
|
-
var FlexLayoutSplitScreenScrollBox__default = /*#__PURE__*/_interopDefault(FlexLayoutSplitScreenScrollBox);
|
|
11
|
-
|
|
12
|
-
function FlexLayoutSplitScreenDragBoxContainer({
|
|
13
|
-
className,
|
|
14
|
-
children,
|
|
15
|
-
layoutName,
|
|
16
|
-
...props
|
|
17
|
-
}) {
|
|
18
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19
|
-
FlexLayoutSplitScreenScrollBox__default.default,
|
|
20
|
-
{
|
|
21
|
-
keyName: layoutName,
|
|
22
|
-
className: `${styles__default.default["flex-split-screen-drag-box-title-container"]} ${className && className !== "" && className || ""}`,
|
|
23
|
-
direction: "x",
|
|
24
|
-
...props,
|
|
25
|
-
children
|
|
26
|
-
}
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
module.exports = FlexLayoutSplitScreenDragBoxContainer;
|
|
31
|
-
//# sourceMappingURL=FlexLayoutSplitScreenDragBoxContainer.cjs.map
|
|
32
|
-
//# sourceMappingURL=FlexLayoutSplitScreenDragBoxContainer.cjs.map
|
|
1
|
+
"use strict";"use client";var u=Object.create;var n=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var m=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},l=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of y(t))!f.call(e,o)&&o!==r&&n(e,o,{get:()=>t[o],enumerable:!(i=s(t,o))||i.enumerable});return e};var a=(e,t,r)=>(r=e!=null?u(L(e)):{},l(t||!e||!e.__esModule?n(r,"default",{value:e,enumerable:!0}):r,e)),g=e=>l(n({},"__esModule",{value:!0}),e);var B={};m(B,{default:()=>S});module.exports=g(B);var c=require("react/jsx-runtime"),x=a(require("../styles/FlexLayout.module.css"),1),p=a(require("./FlexLayoutSplitScreenScrollBox"),1);function S({className:e,children:t,layoutName:r,...i}){return(0,c.jsx)(p.default,{keyName:r,className:`${x.default["flex-split-screen-drag-box-title-container"]} ${e&&e!==""&&e||""}`,direction:"x",...i,children:t})}
|
|
@@ -1,25 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import styles from '../styles/FlexLayout.module.css';
|
|
3
|
-
import FlexLayoutSplitScreenScrollBox from './FlexLayoutSplitScreenScrollBox';
|
|
4
|
-
|
|
5
|
-
function FlexLayoutSplitScreenDragBoxContainer({
|
|
6
|
-
className,
|
|
7
|
-
children,
|
|
8
|
-
layoutName,
|
|
9
|
-
...props
|
|
10
|
-
}) {
|
|
11
|
-
return /* @__PURE__ */ jsx(
|
|
12
|
-
FlexLayoutSplitScreenScrollBox,
|
|
13
|
-
{
|
|
14
|
-
keyName: layoutName,
|
|
15
|
-
className: `${styles["flex-split-screen-drag-box-title-container"]} ${className && className !== "" && className || ""}`,
|
|
16
|
-
direction: "x",
|
|
17
|
-
...props,
|
|
18
|
-
children
|
|
19
|
-
}
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export { FlexLayoutSplitScreenDragBoxContainer as default };
|
|
24
|
-
//# sourceMappingURL=FlexLayoutSplitScreenDragBoxContainer.js.map
|
|
25
|
-
//# sourceMappingURL=FlexLayoutSplitScreenDragBoxContainer.js.map
|
|
1
|
+
"use client";import{jsx as a}from"react/jsx-runtime";import i from"../styles/FlexLayout.module.css";import n from"./FlexLayoutSplitScreenScrollBox";function l({className:e,children:t,layoutName:r,...o}){return a(n,{keyName:r,className:`${i["flex-split-screen-drag-box-title-container"]} ${e&&e!==""&&e||""}`,direction:"x",...o,children:t})}export{l as default};
|
|
@@ -1,40 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var react = require('react');
|
|
5
|
-
var useDrag = require('../hooks/useDrag');
|
|
6
|
-
var styles = require('../styles/FlexLayout.module.css');
|
|
7
|
-
|
|
8
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
|
|
10
|
-
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
11
|
-
|
|
12
|
-
function FlexLayoutSplitScreenDragBoxItem({
|
|
13
|
-
children,
|
|
14
|
-
onClose,
|
|
15
|
-
isActive,
|
|
16
|
-
...props
|
|
17
|
-
}) {
|
|
18
|
-
react.useEffect(() => {
|
|
19
|
-
useDrag.allSplitScreenCount.next(useDrag.allSplitScreenCount.value + 1);
|
|
20
|
-
return () => {
|
|
21
|
-
if (useDrag.allSplitScreenCount.value <= 1) return;
|
|
22
|
-
useDrag.allSplitScreenCount.next(useDrag.allSplitScreenCount.value - 1);
|
|
23
|
-
};
|
|
24
|
-
}, []);
|
|
25
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
26
|
-
"div",
|
|
27
|
-
{
|
|
28
|
-
className: `${styles__default.default["flex-split-screen-drag-box-title-item"]} ${isActive ? styles__default.default["active"] : ""}`,
|
|
29
|
-
...props,
|
|
30
|
-
children: [
|
|
31
|
-
children,
|
|
32
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: (ev) => onClose(ev), children: "X" })
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
module.exports = FlexLayoutSplitScreenDragBoxItem;
|
|
39
|
-
//# sourceMappingURL=FlexLayoutSplitScreenDragBoxItem.cjs.map
|
|
40
|
-
//# sourceMappingURL=FlexLayoutSplitScreenDragBoxItem.cjs.map
|
|
1
|
+
"use strict";var x=Object.create;var i=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var y=(e,t)=>{for(var o in t)i(e,o,{get:t[o],enumerable:!0})},p=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of S(t))!v.call(e,r)&&r!==o&&i(e,r,{get:()=>t[r],enumerable:!(n=s(t,r))||n.enumerable});return e};var d=(e,t,o)=>(o=e!=null?x(f(e)):{},p(t||!e||!e.__esModule?i(o,"default",{value:e,enumerable:!0}):o,e)),g=e=>p(i({},"__esModule",{value:!0}),e);var B={};y(B,{default:()=>m});module.exports=g(B);var a=require("react/jsx-runtime"),c=require("react"),l=require("../hooks/useDrag"),u=d(require("../styles/FlexLayout.module.css"),1);function m({children:e,onClose:t,isActive:o,...n}){return(0,c.useEffect)(()=>(l.allSplitScreenCount.next(l.allSplitScreenCount.value+1),()=>{l.allSplitScreenCount.value<=1||l.allSplitScreenCount.next(l.allSplitScreenCount.value-1)}),[]),(0,a.jsxs)("div",{className:`${u.default["flex-split-screen-drag-box-title-item"]} ${o?u.default.active:""}`,...n,children:[e,(0,a.jsx)("button",{type:"button",onClick:r=>t(r),children:"X"})]})}
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useEffect } from 'react';
|
|
3
|
-
import { allSplitScreenCount } from '../hooks/useDrag';
|
|
4
|
-
import styles from '../styles/FlexLayout.module.css';
|
|
5
|
-
|
|
6
|
-
function FlexLayoutSplitScreenDragBoxItem({
|
|
7
|
-
children,
|
|
8
|
-
onClose,
|
|
9
|
-
isActive,
|
|
10
|
-
...props
|
|
11
|
-
}) {
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
allSplitScreenCount.next(allSplitScreenCount.value + 1);
|
|
14
|
-
return () => {
|
|
15
|
-
if (allSplitScreenCount.value <= 1) return;
|
|
16
|
-
allSplitScreenCount.next(allSplitScreenCount.value - 1);
|
|
17
|
-
};
|
|
18
|
-
}, []);
|
|
19
|
-
return /* @__PURE__ */ jsxs(
|
|
20
|
-
"div",
|
|
21
|
-
{
|
|
22
|
-
className: `${styles["flex-split-screen-drag-box-title-item"]} ${isActive ? styles["active"] : ""}`,
|
|
23
|
-
...props,
|
|
24
|
-
children: [
|
|
25
|
-
children,
|
|
26
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: (ev) => onClose(ev), children: "X" })
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { FlexLayoutSplitScreenDragBoxItem as default };
|
|
33
|
-
//# sourceMappingURL=FlexLayoutSplitScreenDragBoxItem.js.map
|
|
34
|
-
//# sourceMappingURL=FlexLayoutSplitScreenDragBoxItem.js.map
|
|
1
|
+
import{jsx as p,jsxs as c}from"react/jsx-runtime";import{useEffect as a}from"react";import{allSplitScreenCount as e}from"../hooks/useDrag";import t from"../styles/FlexLayout.module.css";function u({children:o,onClose:r,isActive:l,...n}){return a(()=>(e.next(e.value+1),()=>{e.value<=1||e.next(e.value-1)}),[]),c("div",{className:`${t["flex-split-screen-drag-box-title-item"]} ${l?t.active:""}`,...n,children:[o,p("button",{type:"button",onClick:i=>r(i),children:"X"})]})}export{u as default};
|
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var styles = require('../styles/FlexLayout.module.css');
|
|
5
|
-
|
|
6
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
-
|
|
8
|
-
var styles__default = /*#__PURE__*/_interopDefault(styles);
|
|
9
|
-
|
|
10
|
-
function FlexLayoutSplitScreenDragBoxTitleMore({
|
|
11
|
-
className,
|
|
12
|
-
...props
|
|
13
|
-
}) {
|
|
14
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15
|
-
"button",
|
|
16
|
-
{
|
|
17
|
-
...props,
|
|
18
|
-
className: `${styles__default.default["flex-split-screen-drag-box-title-more"]} ${className || ""}`,
|
|
19
|
-
children: [
|
|
20
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "." }),
|
|
21
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "." }),
|
|
22
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "." })
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
module.exports = FlexLayoutSplitScreenDragBoxTitleMore;
|
|
29
|
-
//# sourceMappingURL=FlexLayoutSplitScreenDragBoxTitleMore.cjs.map
|
|
30
|
-
//# sourceMappingURL=FlexLayoutSplitScreenDragBoxTitleMore.cjs.map
|
|
1
|
+
"use strict";var u=Object.create;var l=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var L=(t,e)=>{for(var r in e)l(t,r,{get:e[r],enumerable:!0})},p=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of c(e))!f.call(t,n)&&n!==r&&l(t,n,{get:()=>e[n],enumerable:!(a=x(e,n))||a.enumerable});return t};var M=(t,e,r)=>(r=t!=null?u(m(t)):{},p(e||!t||!t.__esModule?l(r,"default",{value:t,enumerable:!0}):r,t)),S=t=>p(l({},"__esModule",{value:!0}),t);var T={};L(T,{default:()=>i});module.exports=S(T);var o=require("react/jsx-runtime"),s=M(require("../styles/FlexLayout.module.css"),1);function i({className:t,...e}){return(0,o.jsxs)("button",{...e,className:`${s.default["flex-split-screen-drag-box-title-more"]} ${t||""}`,children:[(0,o.jsx)("span",{children:"."}),(0,o.jsx)("span",{children:"."}),(0,o.jsx)("span",{children:"."})]})}
|
|
@@ -1,24 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import styles from '../styles/FlexLayout.module.css';
|
|
3
|
-
|
|
4
|
-
function FlexLayoutSplitScreenDragBoxTitleMore({
|
|
5
|
-
className,
|
|
6
|
-
...props
|
|
7
|
-
}) {
|
|
8
|
-
return /* @__PURE__ */ jsxs(
|
|
9
|
-
"button",
|
|
10
|
-
{
|
|
11
|
-
...props,
|
|
12
|
-
className: `${styles["flex-split-screen-drag-box-title-more"]} ${className || ""}`,
|
|
13
|
-
children: [
|
|
14
|
-
/* @__PURE__ */ jsx("span", { children: "." }),
|
|
15
|
-
/* @__PURE__ */ jsx("span", { children: "." }),
|
|
16
|
-
/* @__PURE__ */ jsx("span", { children: "." })
|
|
17
|
-
]
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { FlexLayoutSplitScreenDragBoxTitleMore as default };
|
|
23
|
-
//# sourceMappingURL=FlexLayoutSplitScreenDragBoxTitleMore.js.map
|
|
24
|
-
//# sourceMappingURL=FlexLayoutSplitScreenDragBoxTitleMore.js.map
|
|
1
|
+
import{jsx as t,jsxs as l}from"react/jsx-runtime";import o from"../styles/FlexLayout.module.css";function n({className:e,...r}){return l("button",{...r,className:`${o["flex-split-screen-drag-box-title-more"]} ${e||""}`,children:[t("span",{children:"."}),t("span",{children:"."}),t("span",{children:"."})]})}export{n as default};
|
|
@@ -1,109 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var react = require('react');
|
|
5
|
-
var rxjs = require('rxjs');
|
|
6
|
-
var operators = require('rxjs/operators');
|
|
7
|
-
var FlexLayoutContainerStore = require('../store/FlexLayoutContainerStore');
|
|
8
|
-
var listScroll = require('../styles/listScroll.module.css');
|
|
9
|
-
|
|
10
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
|
|
12
|
-
var listScroll__default = /*#__PURE__*/_interopDefault(listScroll);
|
|
13
|
-
|
|
14
|
-
const FlexLayoutSplitScreenScrollBox = ({
|
|
15
|
-
className,
|
|
16
|
-
children,
|
|
17
|
-
keyName,
|
|
18
|
-
direction,
|
|
19
|
-
isDefaultScrollStyle = false,
|
|
20
|
-
...props
|
|
21
|
-
}) => {
|
|
22
|
-
const scrollRef = react.useRef(null);
|
|
23
|
-
const [isMouseDown, setIsMouseDown] = react.useState(false);
|
|
24
|
-
const scrollEventSubject = react.useRef(new rxjs.Subject());
|
|
25
|
-
react.useEffect(() => {
|
|
26
|
-
const mouseUpSubscribe = rxjs.fromEvent(
|
|
27
|
-
window,
|
|
28
|
-
"mouseup"
|
|
29
|
-
).subscribe(() => {
|
|
30
|
-
setIsMouseDown(false);
|
|
31
|
-
});
|
|
32
|
-
const scrollEventSubscribe = scrollEventSubject.current.pipe(operators.throttleTime(70)).subscribe((position) => {
|
|
33
|
-
FlexLayoutContainerStore.setScrollPosition(keyName, position);
|
|
34
|
-
});
|
|
35
|
-
const scrollSubscribe = FlexLayoutContainerStore.getScrollPosition(keyName).pipe(operators.take(1)).subscribe((position) => {
|
|
36
|
-
if (scrollRef.current && position) {
|
|
37
|
-
scrollRef.current.scrollLeft = position.x;
|
|
38
|
-
scrollRef.current.scrollTop = position.y;
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
return () => {
|
|
42
|
-
FlexLayoutContainerStore.removeScrollPosition(keyName);
|
|
43
|
-
mouseUpSubscribe.unsubscribe();
|
|
44
|
-
scrollSubscribe.unsubscribe();
|
|
45
|
-
scrollEventSubscribe.unsubscribe();
|
|
46
|
-
};
|
|
47
|
-
}, [keyName]);
|
|
48
|
-
react.useEffect(() => {
|
|
49
|
-
if (!scrollRef.current) return;
|
|
50
|
-
let animationFrameId = null;
|
|
51
|
-
const handleWheel = (event) => {
|
|
52
|
-
if (!scrollRef.current || direction !== "x") return;
|
|
53
|
-
if (scrollRef.current.matches(":hover")) {
|
|
54
|
-
event.preventDefault();
|
|
55
|
-
const { deltaY } = event;
|
|
56
|
-
const newScrollLeft = scrollRef.current.scrollLeft + deltaY;
|
|
57
|
-
if (animationFrameId) {
|
|
58
|
-
cancelAnimationFrame(animationFrameId);
|
|
59
|
-
}
|
|
60
|
-
animationFrameId = requestAnimationFrame(() => {
|
|
61
|
-
scrollRef.current.scrollLeft = newScrollLeft;
|
|
62
|
-
scrollEventSubject.current.next({
|
|
63
|
-
x: newScrollLeft,
|
|
64
|
-
y: scrollRef.current.scrollTop
|
|
65
|
-
});
|
|
66
|
-
animationFrameId = null;
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
scrollRef.current.addEventListener("wheel", handleWheel, {
|
|
71
|
-
passive: false
|
|
72
|
-
});
|
|
73
|
-
return () => {
|
|
74
|
-
scrollRef.current?.removeEventListener("wheel", handleWheel);
|
|
75
|
-
};
|
|
76
|
-
}, []);
|
|
77
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
78
|
-
"div",
|
|
79
|
-
{
|
|
80
|
-
ref: scrollRef,
|
|
81
|
-
onMouseUp: () => setIsMouseDown(false),
|
|
82
|
-
onMouseDown: () => setIsMouseDown(true),
|
|
83
|
-
onMouseMove: (event) => {
|
|
84
|
-
if (!scrollRef.current || !isMouseDown || direction !== "x")
|
|
85
|
-
return;
|
|
86
|
-
scrollRef.current.scrollLeft += event.movementX * -1;
|
|
87
|
-
scrollEventSubject.current.next({
|
|
88
|
-
x: scrollRef.current.scrollLeft,
|
|
89
|
-
y: scrollRef.current.scrollTop
|
|
90
|
-
});
|
|
91
|
-
},
|
|
92
|
-
onScroll: () => {
|
|
93
|
-
if (!scrollRef.current) return;
|
|
94
|
-
scrollEventSubject.current.next({
|
|
95
|
-
x: scrollRef.current.scrollLeft,
|
|
96
|
-
y: scrollRef.current.scrollTop
|
|
97
|
-
});
|
|
98
|
-
},
|
|
99
|
-
className: `${className || ""} ${isDefaultScrollStyle ? listScroll__default.default["default-scroll"] : listScroll__default.default["list-scroll"]} ${direction ? listScroll__default.default[direction] : ""}`,
|
|
100
|
-
...props,
|
|
101
|
-
children
|
|
102
|
-
}
|
|
103
|
-
);
|
|
104
|
-
};
|
|
105
|
-
var FlexLayoutSplitScreenScrollBox_default = react.memo(FlexLayoutSplitScreenScrollBox);
|
|
106
|
-
|
|
107
|
-
module.exports = FlexLayoutSplitScreenScrollBox_default;
|
|
108
|
-
//# sourceMappingURL=FlexLayoutSplitScreenScrollBox.cjs.map
|
|
109
|
-
//# sourceMappingURL=FlexLayoutSplitScreenScrollBox.cjs.map
|
|
1
|
+
"use strict";"use client";var F=Object.create;var S=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var D=(r,t)=>{for(var l in t)S(r,l,{get:t[l],enumerable:!0})},M=(r,t,l,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of h(t))!P.call(r,c)&&c!==l&&S(r,c,{get:()=>t[c],enumerable:!(s=T(t,c))||s.enumerable});return r};var A=(r,t,l)=>(l=r!=null?F(y(r)):{},M(t||!r||!r.__esModule?S(l,"default",{value:r,enumerable:!0}):l,r)),B=r=>M(S({},"__esModule",{value:!0}),r);var $={};D($,{default:()=>g});module.exports=B($);var E=require("react/jsx-runtime"),o=require("react"),p=require("rxjs"),x=require("rxjs/operators"),i=require("../store/FlexLayoutContainerStore"),b=A(require("../styles/listScroll.module.css"),1);const H=({className:r,children:t,keyName:l,direction:s,isDefaultScrollStyle:c=!1,...d})=>{const e=(0,o.useRef)(null),[w,v]=(0,o.useState)(!1),f=(0,o.useRef)(new p.Subject);return(0,o.useEffect)(()=>{const n=(0,p.fromEvent)(window,"mouseup").subscribe(()=>{v(!1)}),a=f.current.pipe((0,x.throttleTime)(70)).subscribe(u=>{(0,i.setScrollPosition)(l,u)}),m=(0,i.getScrollPosition)(l).pipe((0,x.take)(1)).subscribe(u=>{e.current&&u&&(e.current.scrollLeft=u.x,e.current.scrollTop=u.y)});return()=>{(0,i.removeScrollPosition)(l),n.unsubscribe(),m.unsubscribe(),a.unsubscribe()}},[l]),(0,o.useEffect)(()=>{if(!e.current)return;let n=null;const a=m=>{if(!(!e.current||s!=="x")&&e.current.matches(":hover")){m.preventDefault();const{deltaY:u}=m,L=e.current.scrollLeft+u;n&&cancelAnimationFrame(n),n=requestAnimationFrame(()=>{e.current.scrollLeft=L,f.current.next({x:L,y:e.current.scrollTop}),n=null})}};return e.current.addEventListener("wheel",a,{passive:!1}),()=>{e.current?.removeEventListener("wheel",a)}},[]),(0,E.jsx)("div",{ref:e,onMouseUp:()=>v(!1),onMouseDown:()=>v(!0),onMouseMove:n=>{!e.current||!w||s!=="x"||(e.current.scrollLeft+=n.movementX*-1,f.current.next({x:e.current.scrollLeft,y:e.current.scrollTop}))},onScroll:()=>{e.current&&f.current.next({x:e.current.scrollLeft,y:e.current.scrollTop})},className:`${r||""} ${c?b.default["default-scroll"]:b.default["list-scroll"]} ${s?b.default[s]:""}`,...d,children:t})};var g=(0,o.memo)(H);
|