@byeolnaerim/flex-layout 0.0.3 → 0.0.4
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/FlexLayoutSplitScreenDragBox-eCtq4kLd.d.cts +31 -0
- package/dist/FlexLayoutSplitScreenDragBox-eCtq4kLd.d.ts +31 -0
- package/dist/chunk-3EDKZTM3.js +3 -0
- package/dist/chunk-3EDKZTM3.js.map +1 -0
- package/dist/chunk-5HWEFTNQ.js +176 -0
- package/dist/chunk-5HWEFTNQ.js.map +1 -0
- package/dist/chunk-7J5JUVZK.js +3 -0
- package/dist/chunk-7J5JUVZK.js.map +1 -0
- package/dist/chunk-CFQQ6ZDC.js +182 -0
- package/dist/chunk-CFQQ6ZDC.js.map +1 -0
- package/dist/chunk-JM3CZ5DU.js +238 -0
- package/dist/chunk-JM3CZ5DU.js.map +1 -0
- package/dist/chunk-PMTZFSP4.js +219 -0
- package/dist/chunk-PMTZFSP4.js.map +1 -0
- package/dist/chunk-UYI4Z27V.js +2432 -0
- package/dist/chunk-UYI4Z27V.js.map +1 -0
- package/dist/chunk-W4CNFJTK.js +197 -0
- package/dist/chunk-W4CNFJTK.js.map +1 -0
- package/dist/chunk-YIHCWXKY.js +3 -0
- package/dist/chunk-YIHCWXKY.js.map +1 -0
- package/dist/components.cjs +3048 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.css +471 -0
- package/dist/components.css.map +1 -0
- package/dist/components.d.cts +122 -0
- package/dist/components.d.ts +122 -0
- package/dist/components.js +7 -0
- package/dist/components.js.map +1 -0
- package/dist/hooks.cjs +425 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.d.cts +37 -0
- package/dist/hooks.d.ts +37 -0
- package/dist/hooks.js +5 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.cts +10 -418
- package/dist/index.d.ts +10 -418
- package/dist/index.js +9 -3403
- package/dist/index.js.map +1 -1
- package/dist/providers.cjs +411 -0
- package/dist/providers.cjs.map +1 -0
- package/dist/providers.d.cts +54 -0
- package/dist/providers.d.ts +54 -0
- package/dist/providers.js +6 -0
- package/dist/providers.js.map +1 -0
- package/dist/store.cjs +204 -0
- package/dist/store.cjs.map +1 -0
- package/dist/store.d.cts +67 -0
- package/dist/store.d.ts +67 -0
- package/dist/store.js +4 -0
- package/dist/store.js.map +1 -0
- package/dist/useDrag-CYQnhUFk.d.cts +108 -0
- package/dist/useDrag-DR01Ob3s.d.ts +108 -0
- package/dist/utils.cjs +209 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +28 -0
- package/dist/utils.d.ts +28 -0
- package/dist/utils.js +4 -0
- package/dist/utils.js.map +1 -0
- package/package.json +25 -5
package/dist/index.js
CHANGED
|
@@ -1,3405 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (!equal(currentValue, newValue)) {
|
|
11
|
-
subject.next(newValue);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
function updateRefStore(store, newState) {
|
|
15
|
-
const prevState = store.getValue();
|
|
16
|
-
if (!equal(prevState, newState)) {
|
|
17
|
-
store.next(newState);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function updateSplitScreenStore(newValue) {
|
|
21
|
-
const prevValue = layoutSplitScreenStore.getValue();
|
|
22
|
-
if (!equal(prevValue, newValue)) {
|
|
23
|
-
layoutSplitScreenStore.next(newValue);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
var scrollPositions = {};
|
|
27
|
-
var scrollPositionsSubject = new BehaviorSubject(scrollPositions);
|
|
28
|
-
var setScrollPosition = (layoutName, position) => {
|
|
29
|
-
const current = scrollPositionsSubject.getValue();
|
|
30
|
-
const prevPos = current[layoutName];
|
|
31
|
-
if (prevPos && prevPos.x === position.x && prevPos.y === position.y) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const newPositions = {
|
|
35
|
-
...current,
|
|
36
|
-
[layoutName]: position
|
|
37
|
-
};
|
|
38
|
-
updateScrollStore(scrollPositionsSubject, newPositions);
|
|
39
|
-
};
|
|
40
|
-
var getScrollPosition = (layoutName) => {
|
|
41
|
-
return scrollPositionsSubject.pipe(
|
|
42
|
-
// 해당 layoutName이 정의되지 않았을 때는 제외
|
|
43
|
-
filter((e) => e[layoutName] !== void 0),
|
|
44
|
-
map((positions) => positions[layoutName]),
|
|
45
|
-
distinctUntilChanged(
|
|
46
|
-
(prev, curr) => prev?.x === curr?.x && prev?.y === curr?.y
|
|
47
|
-
)
|
|
48
|
-
);
|
|
49
|
-
};
|
|
50
|
-
var removeScrollPosition = (layoutName) => {
|
|
51
|
-
const current = scrollPositionsSubject.getValue();
|
|
52
|
-
delete current[layoutName];
|
|
53
|
-
const newPositions = { ...current };
|
|
54
|
-
updateScrollStore(scrollPositionsSubject, newPositions);
|
|
55
|
-
};
|
|
56
|
-
var layoutSplitScreenStore = new BehaviorSubject({});
|
|
57
|
-
var setSplitScreen = (rootName, layoutName, newComponents) => {
|
|
58
|
-
const current = layoutSplitScreenStore.getValue();
|
|
59
|
-
const updatedLayout = { ...current[rootName] || {} };
|
|
60
|
-
updatedLayout[layoutName] = newComponents;
|
|
61
|
-
const newStoreValue = {
|
|
62
|
-
...current,
|
|
63
|
-
[rootName]: updatedLayout
|
|
64
|
-
};
|
|
65
|
-
updateSplitScreenStore(newStoreValue);
|
|
66
|
-
};
|
|
67
|
-
var resetRootSplitScreen = (rootName) => {
|
|
68
|
-
const current = layoutSplitScreenStore.getValue();
|
|
69
|
-
const newStoreValue = {
|
|
70
|
-
...current,
|
|
71
|
-
[rootName]: {}
|
|
72
|
-
};
|
|
73
|
-
updateSplitScreenStore(newStoreValue);
|
|
74
|
-
};
|
|
75
|
-
var removeSplitScreenChild = (rootName, layoutName) => {
|
|
76
|
-
const current = layoutSplitScreenStore.getValue();
|
|
77
|
-
if (!current[rootName]) return;
|
|
78
|
-
const updatedLayout = { ...current[rootName] };
|
|
79
|
-
delete updatedLayout[layoutName];
|
|
80
|
-
const newStoreValue = {
|
|
81
|
-
...current,
|
|
82
|
-
[rootName]: updatedLayout
|
|
83
|
-
};
|
|
84
|
-
updateSplitScreenStore(newStoreValue);
|
|
85
|
-
};
|
|
86
|
-
var getCurrentSplitScreenComponents = (rootName, layoutName) => {
|
|
87
|
-
const current = layoutSplitScreenStore.getValue();
|
|
88
|
-
if (!current[rootName]) return;
|
|
89
|
-
return current[rootName][layoutName];
|
|
90
|
-
};
|
|
91
|
-
var getSplitScreen = (rootName, layoutName) => {
|
|
92
|
-
return layoutSplitScreenStore.pipe(
|
|
93
|
-
map((splitScreen) => splitScreen[rootName][layoutName]),
|
|
94
|
-
distinctUntilChanged((prev, curr) => {
|
|
95
|
-
const filterChildren2 = (obj) => {
|
|
96
|
-
const { children, component, targetComponent, x, y, ...rest } = obj || {};
|
|
97
|
-
return rest;
|
|
98
|
-
};
|
|
99
|
-
return equal(filterChildren2(prev), filterChildren2(curr));
|
|
100
|
-
})
|
|
101
|
-
);
|
|
102
|
-
};
|
|
103
|
-
var flexContainerStore = new BehaviorSubject({});
|
|
104
|
-
var flexResizePanelStore = new BehaviorSubject({});
|
|
105
|
-
var setContainerRef = (layoutName, containerName, ref) => {
|
|
106
|
-
const currentRefs = flexContainerStore.getValue();
|
|
107
|
-
const updatedLayoutRefs = { ...currentRefs[layoutName] || {} };
|
|
108
|
-
if (ref === null) {
|
|
109
|
-
delete updatedLayoutRefs[containerName];
|
|
110
|
-
} else {
|
|
111
|
-
updatedLayoutRefs[containerName] = ref;
|
|
112
|
-
}
|
|
113
|
-
const newRefs = {
|
|
114
|
-
...currentRefs,
|
|
115
|
-
[layoutName]: updatedLayoutRefs
|
|
116
|
-
};
|
|
117
|
-
updateRefStore(flexContainerStore, newRefs);
|
|
118
|
-
};
|
|
119
|
-
var setResizePanelRef = (layoutName, containerName, ref) => {
|
|
120
|
-
const currentRefs = flexResizePanelStore.getValue();
|
|
121
|
-
const updatedLayoutRefs = { ...currentRefs[layoutName] || {} };
|
|
122
|
-
if (ref === null) {
|
|
123
|
-
delete updatedLayoutRefs[containerName];
|
|
124
|
-
} else {
|
|
125
|
-
updatedLayoutRefs[containerName] = ref;
|
|
126
|
-
}
|
|
127
|
-
const newRefs = {
|
|
128
|
-
...currentRefs,
|
|
129
|
-
[layoutName]: updatedLayoutRefs
|
|
130
|
-
};
|
|
131
|
-
updateRefStore(flexResizePanelStore, newRefs);
|
|
132
|
-
};
|
|
133
|
-
var getLayoutInfos = (layoutName) => {
|
|
134
|
-
return combineLatest([flexContainerStore, flexResizePanelStore]).pipe(
|
|
135
|
-
map(([containerRefs, resizePanelRefs]) => {
|
|
136
|
-
const containerData = containerRefs[layoutName] || {};
|
|
137
|
-
const resizePanelData = resizePanelRefs[layoutName] || {};
|
|
138
|
-
return {
|
|
139
|
-
container: containerData,
|
|
140
|
-
resizePanel: resizePanelData
|
|
141
|
-
};
|
|
142
|
-
}),
|
|
143
|
-
filter((result) => result.container !== null)
|
|
144
|
-
// 빈 객체 제외
|
|
145
|
-
);
|
|
146
|
-
};
|
|
147
|
-
var getContainerRef = ({
|
|
148
|
-
containerName,
|
|
149
|
-
layoutName
|
|
150
|
-
}) => {
|
|
151
|
-
return flexContainerStore.pipe(
|
|
152
|
-
map((refs) => {
|
|
153
|
-
if (layoutName) {
|
|
154
|
-
return refs[layoutName]?.[containerName] || null;
|
|
155
|
-
} else {
|
|
156
|
-
return Object.entries(refs).find(
|
|
157
|
-
([key, value]) => refs[key][containerName]
|
|
158
|
-
)?.[1][containerName];
|
|
159
|
-
}
|
|
160
|
-
}),
|
|
161
|
-
filter((ref) => ref !== null)
|
|
162
|
-
);
|
|
163
|
-
};
|
|
164
|
-
var getResizePanelRef = ({
|
|
165
|
-
containerName,
|
|
166
|
-
layoutName
|
|
167
|
-
}) => {
|
|
168
|
-
return flexResizePanelStore.pipe(
|
|
169
|
-
map((refs) => {
|
|
170
|
-
if (layoutName) {
|
|
171
|
-
return refs[layoutName]?.[containerName] || null;
|
|
172
|
-
} else {
|
|
173
|
-
return Object.entries(refs).find(
|
|
174
|
-
([key, value]) => refs[key][containerName]
|
|
175
|
-
)?.[1][containerName];
|
|
176
|
-
}
|
|
177
|
-
}),
|
|
178
|
-
filter((ref) => ref !== null)
|
|
179
|
-
);
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
// src/flex-layout/utils/FlexLayoutUtils.ts
|
|
183
|
-
function isDocumentOut({ x, y }) {
|
|
184
|
-
if (typeof window == "undefined") return;
|
|
185
|
-
const { innerWidth, innerHeight, scrollX, scrollY } = window;
|
|
186
|
-
return x < 0 || y < 0 || x > innerWidth + scrollX || y > innerHeight + scrollY;
|
|
187
|
-
}
|
|
188
|
-
var lastTouchEvent;
|
|
189
|
-
function getClientXy(event) {
|
|
190
|
-
let clientX;
|
|
191
|
-
let clientY;
|
|
192
|
-
if (window.MouseEvent && event instanceof window.MouseEvent) {
|
|
193
|
-
clientX = event.clientX;
|
|
194
|
-
clientY = event.clientY;
|
|
195
|
-
} else if (window.TouchEvent && event instanceof window.TouchEvent) {
|
|
196
|
-
const _event = event.touches.length == 0 ? lastTouchEvent : event;
|
|
197
|
-
clientX = _event.touches[0].clientX;
|
|
198
|
-
clientY = _event.touches[0].clientY;
|
|
199
|
-
lastTouchEvent = event;
|
|
200
|
-
} else {
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
return { clientX, clientY };
|
|
204
|
-
}
|
|
205
|
-
function isOverMove(elementSize, elementMinSize) {
|
|
206
|
-
return Math.floor(elementSize) <= 0 || (isNaN(elementMinSize) ? false : elementMinSize >= Math.floor(elementSize));
|
|
207
|
-
}
|
|
208
|
-
function findNotCloseFlexContent(target, direction) {
|
|
209
|
-
if (!target) return target;
|
|
210
|
-
let _target = target;
|
|
211
|
-
const isCloseCheck = () => {
|
|
212
|
-
let grow = parseFloat(window.getComputedStyle(_target).flex.split(" ")[0]) || 0;
|
|
213
|
-
if (grow == 0) {
|
|
214
|
-
return true;
|
|
215
|
-
} else {
|
|
216
|
-
return false;
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
while (isCloseCheck()) {
|
|
220
|
-
let nextTarget = _target[direction]?.[direction];
|
|
221
|
-
_target = nextTarget;
|
|
222
|
-
if (!_target) {
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
return _target;
|
|
227
|
-
}
|
|
228
|
-
function remain(flexContainerList) {
|
|
229
|
-
return new Promise((resolve) => {
|
|
230
|
-
let notGrowList = [];
|
|
231
|
-
let totalGrow = flexContainerList.reduce((t, e, i) => {
|
|
232
|
-
if (e.hasAttribute("data-grow") == false) {
|
|
233
|
-
notGrowList.push(e);
|
|
234
|
-
return t;
|
|
235
|
-
}
|
|
236
|
-
let grow = parseFloat(e.dataset.grow || "");
|
|
237
|
-
e.style.flex = `${grow} 1 0%`;
|
|
238
|
-
t -= grow;
|
|
239
|
-
return t;
|
|
240
|
-
}, flexContainerList.length);
|
|
241
|
-
if (notGrowList.length != 0) {
|
|
242
|
-
resize(notGrowList, totalGrow);
|
|
243
|
-
}
|
|
244
|
-
resolve(flexContainerList);
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
function resize(list, totalGrow) {
|
|
248
|
-
return new Promise((resolve) => {
|
|
249
|
-
let resizeWeight = totalGrow / list.length;
|
|
250
|
-
list.forEach((e) => {
|
|
251
|
-
e.dataset.grow = resizeWeight.toString();
|
|
252
|
-
e.style.flex = `${resizeWeight} 1 0%`;
|
|
253
|
-
});
|
|
254
|
-
resolve(resizeWeight);
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
function mathWeight(totalCount, totalGrow) {
|
|
258
|
-
return 1 + (totalGrow - totalCount) / totalCount;
|
|
259
|
-
}
|
|
260
|
-
function mathGrow(childSize, parentSize, containerCount) {
|
|
261
|
-
return containerCount * (childSize / parentSize);
|
|
262
|
-
}
|
|
263
|
-
function getGrow(growTarget) {
|
|
264
|
-
const target = growTarget instanceof Element ? growTarget : growTarget;
|
|
265
|
-
return parseFloat(target.style.flex.split(" ")[0]) || parseFloat(target.dataset.grow || "");
|
|
266
|
-
}
|
|
267
|
-
function closeFlex(resizeTarget, containers, {
|
|
268
|
-
isResize = false,
|
|
269
|
-
isDsiabledResizePanel = false,
|
|
270
|
-
sizeName
|
|
271
|
-
}) {
|
|
272
|
-
return new Promise((resolve) => {
|
|
273
|
-
if (!resizeTarget.hasAttribute("data-is_resize_panel")) ; else if (isDsiabledResizePanel) {
|
|
274
|
-
resizeTarget.dataset.is_resize_panel = "false";
|
|
275
|
-
}
|
|
276
|
-
resizeTarget.dataset.prev_grow = getGrow(resizeTarget).toString();
|
|
277
|
-
let notCloseList = containers.filter(
|
|
278
|
-
(e) => e.style.flex != "0 1 0%" && e != resizeTarget
|
|
279
|
-
);
|
|
280
|
-
let notCloseAndOpenTargetList = [...notCloseList, resizeTarget];
|
|
281
|
-
notCloseAndOpenTargetList.forEach((e) => {
|
|
282
|
-
e.style.transition = "flex 0.5s";
|
|
283
|
-
e.ontransitionend = (event) => {
|
|
284
|
-
if (event.propertyName != "flex-grow") {
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
notCloseAndOpenTargetList.forEach(
|
|
288
|
-
(e2) => e2.style.transition = ""
|
|
289
|
-
);
|
|
290
|
-
e.ontransitionend = () => {
|
|
291
|
-
};
|
|
292
|
-
};
|
|
293
|
-
if (e == resizeTarget) {
|
|
294
|
-
e.dataset.grow = "0";
|
|
295
|
-
e.style.flex = `0 1 0%`;
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
|
-
if (isResize) {
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
let percent = getGrow(e) / containers.length;
|
|
302
|
-
if (notCloseList.length == 1) {
|
|
303
|
-
e.dataset.grow = containers.length.toString();
|
|
304
|
-
e.style.flex = `${containers.length} 1 0%`;
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
e.dataset.grow = (containers.length * percent).toString();
|
|
308
|
-
e.style.flex = `${containers.length * percent} 1 0%`;
|
|
309
|
-
});
|
|
310
|
-
if (isResize) {
|
|
311
|
-
resize(notCloseList, containers.length);
|
|
312
|
-
}
|
|
313
|
-
resolve(resizeTarget);
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
function openFlex(resizeTarget, containers, {
|
|
317
|
-
isPrevSizeOpen = false,
|
|
318
|
-
isResize = false,
|
|
319
|
-
openGrowImportant = 0,
|
|
320
|
-
sizeName
|
|
321
|
-
}) {
|
|
322
|
-
return new Promise((resolve) => {
|
|
323
|
-
if (!resizeTarget.hasAttribute("data-is_resize_panel")) ; else if (resizeTarget.hasAttribute("data-is_resize_panel") && resizeTarget.dataset.is_resize_panel == "false") {
|
|
324
|
-
resizeTarget.dataset.is_resize_panel = "true";
|
|
325
|
-
}
|
|
326
|
-
let notCloseList = containers.filter(
|
|
327
|
-
(e) => e.style.flex != "0 1 0%" && e != resizeTarget
|
|
328
|
-
);
|
|
329
|
-
let notCloseAndOpenTargetList = [...notCloseList, resizeTarget];
|
|
330
|
-
let openTargetGrow = 1;
|
|
331
|
-
const sizeStyleName = "client" + sizeName.charAt(0).toUpperCase() + sizeName.substring(1);
|
|
332
|
-
const parentSize = sizeName && resizeTarget.parentElement && resizeTarget.parentElement[sizeStyleName] || 0;
|
|
333
|
-
if (isPrevSizeOpen && resizeTarget.hasAttribute("data-prev_grow")) {
|
|
334
|
-
openTargetGrow = parseFloat(resizeTarget.dataset.prev_grow || "1") || 1;
|
|
335
|
-
} else if (parentSize && parentSize !== 0) {
|
|
336
|
-
openTargetGrow = parentSize / notCloseList.length / (parentSize - 1) * containers.length;
|
|
337
|
-
} else {
|
|
338
|
-
openTargetGrow = 1;
|
|
339
|
-
}
|
|
340
|
-
if (openGrowImportant) {
|
|
341
|
-
openTargetGrow = openGrowImportant;
|
|
342
|
-
}
|
|
343
|
-
openTargetGrow = openTargetGrow === Infinity ? 1 : openTargetGrow;
|
|
344
|
-
notCloseAndOpenTargetList.forEach((e) => {
|
|
345
|
-
e.style.transition = "flex 0.5s";
|
|
346
|
-
e.ontransitionend = (event) => {
|
|
347
|
-
if (event.propertyName != "flex-grow") {
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
notCloseAndOpenTargetList.forEach(
|
|
351
|
-
(e2) => e2.style.transition = ""
|
|
352
|
-
);
|
|
353
|
-
e.ontransitionend = () => {
|
|
354
|
-
};
|
|
355
|
-
};
|
|
356
|
-
if (e == resizeTarget) {
|
|
357
|
-
resizeTarget.dataset.grow = openTargetGrow.toString();
|
|
358
|
-
resizeTarget.style.flex = `${openTargetGrow} 1 0%`;
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
if (isResize) {
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
let grow = parentSize / notCloseList.length / (parentSize - 1) * (containers.length - openTargetGrow);
|
|
365
|
-
grow = grow === Infinity ? 1 : grow;
|
|
366
|
-
e.dataset.grow = grow.toString();
|
|
367
|
-
e.style.flex = `${grow} 1 0%`;
|
|
368
|
-
});
|
|
369
|
-
if (isResize) {
|
|
370
|
-
resize(notCloseAndOpenTargetList, containers.length);
|
|
371
|
-
}
|
|
372
|
-
resolve(openTargetGrow);
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
var g = globalThis;
|
|
376
|
-
g.__FLEX_SUBJECTS__ ?? (g.__FLEX_SUBJECTS__ = { openClose: {}, spread: {} });
|
|
377
|
-
var containerOpenCloseSubjectMap = g.__FLEX_SUBJECTS__.openClose;
|
|
378
|
-
var containerSpreadSubjectMap = g.__FLEX_SUBJECTS__.spread;
|
|
379
|
-
var ContainerOpenCloseProvider = ({
|
|
380
|
-
layoutName,
|
|
381
|
-
containerName,
|
|
382
|
-
sizeName
|
|
383
|
-
}) => {
|
|
384
|
-
if (!containerOpenCloseSubjectMap[containerName]) {
|
|
385
|
-
containerOpenCloseSubjectMap[containerName] = new Subject();
|
|
386
|
-
}
|
|
387
|
-
if (!containerSpreadSubjectMap[containerName]) {
|
|
388
|
-
containerSpreadSubjectMap[containerName] = new Subject();
|
|
389
|
-
}
|
|
390
|
-
const [containers, setContainers] = useState([]);
|
|
391
|
-
const [container, setContainer] = useState();
|
|
392
|
-
useEffect(() => {
|
|
393
|
-
const subscription = getLayoutInfos(layoutName).subscribe(
|
|
394
|
-
(layout) => {
|
|
395
|
-
if (!layout || !layout.container[containerName] || !layout.container[containerName].current)
|
|
396
|
-
return;
|
|
397
|
-
setContainers(
|
|
398
|
-
Object.values(layout.container).filter(
|
|
399
|
-
(e) => e.current !== null
|
|
400
|
-
).map((e) => e.current)
|
|
401
|
-
);
|
|
402
|
-
setContainer(layout.container[containerName].current);
|
|
403
|
-
}
|
|
404
|
-
);
|
|
405
|
-
return () => subscription.unsubscribe();
|
|
406
|
-
}, [containerName, layoutName]);
|
|
407
|
-
useEffect(() => {
|
|
408
|
-
const styleName = `${sizeName.charAt(0).toUpperCase() + sizeName.substring(1)}`;
|
|
409
|
-
const clientSize = "client" + styleName;
|
|
410
|
-
const outerSize = "outer" + styleName;
|
|
411
|
-
const maxSize = "max" + styleName;
|
|
412
|
-
const subscribe = containerOpenCloseSubjectMap[containerName].subscribe(
|
|
413
|
-
({
|
|
414
|
-
mode,
|
|
415
|
-
initOpenState: isOpenState,
|
|
416
|
-
onClose,
|
|
417
|
-
onOpen,
|
|
418
|
-
openOption = {},
|
|
419
|
-
closeOption = {}
|
|
420
|
-
}) => {
|
|
421
|
-
if (!container || containers.length === 0) return;
|
|
422
|
-
const currentGrow = getGrow(container);
|
|
423
|
-
const styleMap = window.getComputedStyle(container);
|
|
424
|
-
const maxSizeGrow = mathGrow(
|
|
425
|
-
parseInt(styleMap[maxSize]),
|
|
426
|
-
container.parentElement && container.parentElement[clientSize] || window[outerSize],
|
|
427
|
-
containers.length
|
|
428
|
-
);
|
|
429
|
-
const open = () => openFlex(container, containers, {
|
|
430
|
-
sizeName,
|
|
431
|
-
...isNaN(maxSizeGrow) ? {} : {
|
|
432
|
-
openGrowImportant: maxSizeGrow
|
|
433
|
-
},
|
|
434
|
-
...openOption
|
|
435
|
-
}).then((openTargetGrow) => {
|
|
436
|
-
if (onOpen) onOpen();
|
|
437
|
-
containerSpreadSubjectMap[containerName].next({
|
|
438
|
-
isOpen: true,
|
|
439
|
-
grow: openTargetGrow,
|
|
440
|
-
targetContainer: container
|
|
441
|
-
});
|
|
442
|
-
});
|
|
443
|
-
const close = () => closeFlex(container, containers, {
|
|
444
|
-
sizeName,
|
|
445
|
-
...closeOption
|
|
446
|
-
}).then(() => {
|
|
447
|
-
if (onClose) onClose();
|
|
448
|
-
containerSpreadSubjectMap[containerName].next({
|
|
449
|
-
isOpen: false,
|
|
450
|
-
grow: 0,
|
|
451
|
-
targetContainer: container
|
|
452
|
-
});
|
|
453
|
-
});
|
|
454
|
-
if (mode === "toggle") {
|
|
455
|
-
if (currentGrow === 0) {
|
|
456
|
-
open();
|
|
457
|
-
} else {
|
|
458
|
-
close();
|
|
459
|
-
}
|
|
460
|
-
} else if (mode === "open") {
|
|
461
|
-
if (currentGrow === 0) {
|
|
462
|
-
open();
|
|
463
|
-
}
|
|
464
|
-
} else if (mode === "close") {
|
|
465
|
-
if (currentGrow !== 0) {
|
|
466
|
-
close();
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
);
|
|
471
|
-
return () => {
|
|
472
|
-
subscribe.unsubscribe();
|
|
473
|
-
};
|
|
474
|
-
}, [containerName, container, containers, sizeName]);
|
|
475
|
-
return null;
|
|
476
|
-
};
|
|
477
|
-
var useContainers = (layoutName) => {
|
|
478
|
-
const [containers, setContainers] = useState([]);
|
|
479
|
-
useEffect(() => {
|
|
480
|
-
const subscription = getLayoutInfos(layoutName).subscribe(
|
|
481
|
-
(layout) => {
|
|
482
|
-
setContainers(
|
|
483
|
-
Object.values(layout.container).filter(
|
|
484
|
-
(e) => e.current !== null
|
|
485
|
-
).map((e) => e.current)
|
|
486
|
-
);
|
|
487
|
-
}
|
|
488
|
-
);
|
|
489
|
-
return () => subscription.unsubscribe();
|
|
490
|
-
}, [layoutName]);
|
|
491
|
-
return containers;
|
|
492
|
-
};
|
|
493
|
-
var useLayoutName = (containerName) => {
|
|
494
|
-
const [layoutName, setLayoutName] = useState();
|
|
495
|
-
useEffect(() => {
|
|
496
|
-
const subscribe = flexContainerStore.pipe(
|
|
497
|
-
map$1(
|
|
498
|
-
(layouts) => Object.entries(layouts).filter(([_, v]) => v[containerName]).map(([k]) => k)[0]
|
|
499
|
-
// 첫 번째 결과 가져오기
|
|
500
|
-
)
|
|
501
|
-
).subscribe(setLayoutName);
|
|
502
|
-
return () => subscribe.unsubscribe();
|
|
503
|
-
}, [containerName]);
|
|
504
|
-
return layoutName;
|
|
505
|
-
};
|
|
506
|
-
var useDecompositionLayout = ({
|
|
507
|
-
layoutName: initialLayoutName,
|
|
508
|
-
containerName
|
|
509
|
-
}) => {
|
|
510
|
-
const derivedLayoutName = useLayoutName(containerName);
|
|
511
|
-
const finalLayoutName = initialLayoutName || derivedLayoutName;
|
|
512
|
-
const [containers, setContainers] = useState([]);
|
|
513
|
-
const [container, setContainer] = useState();
|
|
514
|
-
const [resizePanel, setResizePanel] = useState();
|
|
515
|
-
useEffect(() => {
|
|
516
|
-
if (!finalLayoutName) return;
|
|
517
|
-
const subscription = getLayoutInfos(finalLayoutName).subscribe(
|
|
518
|
-
(layout) => {
|
|
519
|
-
if (!layout) return;
|
|
520
|
-
setContainers(
|
|
521
|
-
Object.values(layout.container).filter(
|
|
522
|
-
(e) => e.current !== null
|
|
523
|
-
).map((e) => e.current)
|
|
524
|
-
);
|
|
525
|
-
if (containerName && layout.container[containerName] && layout.container[containerName].current) {
|
|
526
|
-
setContainer(layout.container[containerName].current);
|
|
527
|
-
if (layout.resizePanel[containerName] && layout.resizePanel[containerName].current) {
|
|
528
|
-
setResizePanel(
|
|
529
|
-
layout.resizePanel[containerName].current
|
|
530
|
-
);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
);
|
|
535
|
-
return () => subscription.unsubscribe();
|
|
536
|
-
}, [containerName, finalLayoutName]);
|
|
537
|
-
return { layout: containers, container, resizePanel };
|
|
538
|
-
};
|
|
539
|
-
var useContainerSize = (containerName) => {
|
|
540
|
-
const { layout, container, resizePanel } = useDecompositionLayout({
|
|
541
|
-
containerName
|
|
542
|
-
});
|
|
543
|
-
const [size, setSize] = useState();
|
|
544
|
-
useEffect(() => {
|
|
545
|
-
if (!container) return;
|
|
546
|
-
const observer = new ResizeObserver((entries) => {
|
|
547
|
-
for (const entry of entries) {
|
|
548
|
-
setSize({
|
|
549
|
-
width: entry.contentRect.width,
|
|
550
|
-
height: entry.contentRect.height
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
observer.observe(container);
|
|
555
|
-
return () => observer.disconnect();
|
|
556
|
-
}, [container]);
|
|
557
|
-
return { size };
|
|
558
|
-
};
|
|
559
|
-
var useDoubleClick = (containerName, opt) => {
|
|
560
|
-
const [isOpen, setIsOpen] = useState();
|
|
561
|
-
const [isDoubleClick, setIsDoubleClick] = useState();
|
|
562
|
-
useEffect(() => {
|
|
563
|
-
const resizePanelClickEvent = getResizePanelRef({
|
|
564
|
-
containerName
|
|
565
|
-
}).pipe(
|
|
566
|
-
filter$1(
|
|
567
|
-
(resizePanelref) => resizePanelref != void 0 && resizePanelref.current != void 0
|
|
568
|
-
),
|
|
569
|
-
//take(1),
|
|
570
|
-
switchMap((resizePanelref) => {
|
|
571
|
-
if (!resizePanelref || !resizePanelref.current) return EMPTY;
|
|
572
|
-
return fromEvent(resizePanelref.current, "click");
|
|
573
|
-
})
|
|
574
|
-
);
|
|
575
|
-
const subscribe = resizePanelClickEvent.pipe(
|
|
576
|
-
buffer(resizePanelClickEvent.pipe(debounceTime(500))),
|
|
577
|
-
filter$1((clickEventArray) => clickEventArray.length >= 2),
|
|
578
|
-
map$1((events) => {
|
|
579
|
-
containerOpenCloseSubjectMap[containerName].next({
|
|
580
|
-
...opt,
|
|
581
|
-
openOption: {
|
|
582
|
-
...opt.openOption,
|
|
583
|
-
isPrevSizeOpen: false
|
|
584
|
-
},
|
|
585
|
-
onClose: () => {
|
|
586
|
-
if (opt.onClose) opt.onClose();
|
|
587
|
-
setIsOpen(false);
|
|
588
|
-
setIsDoubleClick(true);
|
|
589
|
-
},
|
|
590
|
-
onOpen: () => {
|
|
591
|
-
if (opt.onOpen) opt.onOpen();
|
|
592
|
-
setIsOpen(true);
|
|
593
|
-
setIsDoubleClick(true);
|
|
594
|
-
}
|
|
595
|
-
});
|
|
596
|
-
})
|
|
597
|
-
).subscribe();
|
|
598
|
-
return () => {
|
|
599
|
-
subscribe.unsubscribe();
|
|
600
|
-
};
|
|
601
|
-
}, [containerName]);
|
|
602
|
-
return { isOpen, isDoubleClick, setIsDoubleClick };
|
|
603
|
-
};
|
|
604
|
-
|
|
605
|
-
// src/flex-layout/styles/FlexLayout.module.css
|
|
606
|
-
var FlexLayout_default = {};
|
|
607
|
-
var FlexLayoutContext = createContext(null);
|
|
608
|
-
function useFlexLayoutContext() {
|
|
609
|
-
const context = useContext(FlexLayoutContext);
|
|
610
|
-
if (!context) {
|
|
611
|
-
throw new Error(
|
|
612
|
-
"useFlexLayoutContext must be used within FlexLayoutContext.Provider"
|
|
613
|
-
);
|
|
614
|
-
}
|
|
615
|
-
return context;
|
|
616
|
-
}
|
|
617
|
-
function FlexLayoutProvider({
|
|
618
|
-
value,
|
|
619
|
-
children
|
|
620
|
-
}) {
|
|
621
|
-
return /* @__PURE__ */ jsx(FlexLayoutContext.Provider, { value, children });
|
|
622
|
-
}
|
|
623
|
-
var FlexLayout = ({
|
|
624
|
-
layoutName,
|
|
625
|
-
direction,
|
|
626
|
-
children,
|
|
627
|
-
ref,
|
|
628
|
-
className,
|
|
629
|
-
panelClassName,
|
|
630
|
-
panelMovementMode = "divorce",
|
|
631
|
-
...props
|
|
632
|
-
}) => {
|
|
633
|
-
const containerCount = Children.count(children);
|
|
634
|
-
const fitContent = direction === "row" ? "width" : "height";
|
|
635
|
-
const isFragmentElement = (node) => isValidElement(node) && node.type === Fragment$1;
|
|
636
|
-
const nodes = Children.toArray(children).flatMap(
|
|
637
|
-
(node) => isFragmentElement(node) ? Children.toArray(node.props.children) : [node]
|
|
638
|
-
);
|
|
639
|
-
const flattenedChildren = nodes.filter(
|
|
640
|
-
isValidElement
|
|
641
|
-
);
|
|
642
|
-
if (flattenedChildren.length === 0) {
|
|
643
|
-
return null;
|
|
644
|
-
}
|
|
645
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
646
|
-
FlexLayoutProvider,
|
|
647
|
-
{
|
|
648
|
-
value: {
|
|
649
|
-
layoutName,
|
|
650
|
-
direction,
|
|
651
|
-
panelMovementMode,
|
|
652
|
-
panelClassName,
|
|
653
|
-
containerCount,
|
|
654
|
-
fitContent
|
|
655
|
-
},
|
|
656
|
-
children: /* @__PURE__ */ jsx(
|
|
657
|
-
"div",
|
|
658
|
-
{
|
|
659
|
-
className: `${FlexLayout_default["flex-layout"]} ${className && className !== "" ? className : ""}`,
|
|
660
|
-
...ref ? { ref } : {},
|
|
661
|
-
...props,
|
|
662
|
-
"data-layout_name": layoutName,
|
|
663
|
-
"data-direction": direction,
|
|
664
|
-
children: flattenedChildren.map((child, index) => {
|
|
665
|
-
if (!child || !isValidElement(child)) return null;
|
|
666
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
667
|
-
child,
|
|
668
|
-
/* @__PURE__ */ jsx(
|
|
669
|
-
ContainerOpenCloseProvider,
|
|
670
|
-
{
|
|
671
|
-
layoutName,
|
|
672
|
-
containerName: child.props.containerName,
|
|
673
|
-
sizeName: fitContent
|
|
674
|
-
}
|
|
675
|
-
)
|
|
676
|
-
] }, index);
|
|
677
|
-
})
|
|
678
|
-
}
|
|
679
|
-
)
|
|
680
|
-
}
|
|
681
|
-
) });
|
|
682
|
-
};
|
|
683
|
-
var FlexLayout_default2 = FlexLayout;
|
|
684
|
-
var useSize = (sizeName) => {
|
|
685
|
-
const ref = useRef(null);
|
|
686
|
-
const [size, setSize] = useState(void 0);
|
|
687
|
-
useLayoutEffect(() => {
|
|
688
|
-
if (!ref.current) return;
|
|
689
|
-
const handleResize = () => {
|
|
690
|
-
if (ref.current) {
|
|
691
|
-
const newSize = ref.current.getBoundingClientRect()[sizeName];
|
|
692
|
-
setSize(newSize);
|
|
693
|
-
}
|
|
694
|
-
};
|
|
695
|
-
handleResize();
|
|
696
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
697
|
-
handleResize();
|
|
698
|
-
});
|
|
699
|
-
resizeObserver.observe(ref.current);
|
|
700
|
-
window.addEventListener("resize", handleResize);
|
|
701
|
-
return () => {
|
|
702
|
-
resizeObserver.disconnect();
|
|
703
|
-
window.removeEventListener("resize", handleResize);
|
|
704
|
-
};
|
|
705
|
-
}, [sizeName]);
|
|
706
|
-
return { ref, size };
|
|
707
|
-
};
|
|
708
|
-
var flexDirectionModel = {
|
|
709
|
-
row: {
|
|
710
|
-
xy: "x",
|
|
711
|
-
targetDirection: "left",
|
|
712
|
-
nextDirection: "right",
|
|
713
|
-
sizeName: "width",
|
|
714
|
-
resizeCursor: "ew-resize"
|
|
715
|
-
},
|
|
716
|
-
column: {
|
|
717
|
-
xy: "y",
|
|
718
|
-
targetDirection: "top",
|
|
719
|
-
nextDirection: "bottom",
|
|
720
|
-
sizeName: "height",
|
|
721
|
-
resizeCursor: "ns-resize"
|
|
722
|
-
}
|
|
723
|
-
};
|
|
724
|
-
var FlexLayoutResizePanel = ({
|
|
725
|
-
direction,
|
|
726
|
-
containerCount,
|
|
727
|
-
panelMode = "default",
|
|
728
|
-
containerName,
|
|
729
|
-
layoutName,
|
|
730
|
-
panelClassName,
|
|
731
|
-
panelMovementMode
|
|
732
|
-
}) => {
|
|
733
|
-
let isResizePanelClickRef = useRef(false);
|
|
734
|
-
let prevTouchEvent = null;
|
|
735
|
-
let parentSizeRef = useRef(0);
|
|
736
|
-
let totalMovementRef = useRef(0);
|
|
737
|
-
const containerCountRef = useRef(containerCount);
|
|
738
|
-
useEffect(() => {
|
|
739
|
-
return () => {
|
|
740
|
-
document.body.style.cursor = "";
|
|
741
|
-
};
|
|
742
|
-
}, []);
|
|
743
|
-
useEffect(() => {
|
|
744
|
-
containerCountRef.current = containerCount;
|
|
745
|
-
}, [containerCount]);
|
|
746
|
-
const panelRef = useRef(null);
|
|
747
|
-
const panelMouseDownEvent = (event) => {
|
|
748
|
-
if (!panelRef.current || !panelRef.current.parentElement) return;
|
|
749
|
-
isResizePanelClickRef.current = true;
|
|
750
|
-
containerCountRef.current = [
|
|
751
|
-
...panelRef.current.parentElement.children
|
|
752
|
-
].filter((e) => e.hasAttribute("data-container_name")).length;
|
|
753
|
-
const sizeName = flexDirectionModel[direction].sizeName;
|
|
754
|
-
parentSizeRef.current = panelRef.current.parentElement.getBoundingClientRect()[sizeName];
|
|
755
|
-
prevTouchEvent = null;
|
|
756
|
-
totalMovementRef.current = 0;
|
|
757
|
-
if (!parentSizeRef.current) return;
|
|
758
|
-
document.body.style.cursor = flexDirectionModel[direction].resizeCursor;
|
|
759
|
-
};
|
|
760
|
-
const panelMouseUpEvent = () => {
|
|
761
|
-
isResizePanelClickRef.current = false;
|
|
762
|
-
parentSizeRef.current = 0;
|
|
763
|
-
prevTouchEvent = null;
|
|
764
|
-
totalMovementRef.current = 0;
|
|
765
|
-
document.body.style.cursor = "";
|
|
766
|
-
};
|
|
767
|
-
function moveMouseFlex(originTarget, resizePanel, moveEvent) {
|
|
768
|
-
const model = flexDirectionModel[direction];
|
|
769
|
-
const movement = moveEvent["movement" + model.xy.toUpperCase()];
|
|
770
|
-
totalMovementRef.current += movement;
|
|
771
|
-
const minSizeName = "min-" + model.sizeName;
|
|
772
|
-
const maxSizeName = "max-" + model.sizeName;
|
|
773
|
-
let targetElement = findNotCloseFlexContent(
|
|
774
|
-
originTarget,
|
|
775
|
-
"previousElementSibling"
|
|
776
|
-
);
|
|
777
|
-
if (panelMovementMode === "divorce" && totalMovementRef.current > 0 || panelMovementMode === "bulldozer" && movement > 0 || !targetElement)
|
|
778
|
-
targetElement = originTarget;
|
|
779
|
-
let nextElement = findNotCloseFlexContent(
|
|
780
|
-
resizePanel.nextElementSibling,
|
|
781
|
-
"nextElementSibling"
|
|
782
|
-
);
|
|
783
|
-
if (panelMovementMode === "divorce" && totalMovementRef.current < 0 || panelMovementMode === "bulldozer" && movement < 0 || !nextElement)
|
|
784
|
-
nextElement = resizePanel.nextElementSibling;
|
|
785
|
-
if (!targetElement || !nextElement) return;
|
|
786
|
-
const targetRect = targetElement.getBoundingClientRect();
|
|
787
|
-
const targetStyle = window.getComputedStyle(targetElement);
|
|
788
|
-
const targetMinSize = parseFloat(targetStyle.getPropertyValue(minSizeName)) || 0;
|
|
789
|
-
const targetMaxSize = parseFloat(targetStyle.getPropertyValue(maxSizeName)) || 0;
|
|
790
|
-
const nextRect = nextElement.getBoundingClientRect();
|
|
791
|
-
const nextStyle = window.getComputedStyle(nextElement);
|
|
792
|
-
const nextMinSize = parseFloat(nextStyle.getPropertyValue(minSizeName)) || 0;
|
|
793
|
-
const nextMaxSize = parseFloat(nextStyle.getPropertyValue(maxSizeName)) || 0;
|
|
794
|
-
let targetSize = targetRect[model.sizeName] + movement;
|
|
795
|
-
let nextElementSize = nextRect[model.sizeName] - movement;
|
|
796
|
-
if (targetMaxSize > 0 && targetSize > targetMaxSize) {
|
|
797
|
-
return;
|
|
798
|
-
}
|
|
799
|
-
if (nextMaxSize > 0 && nextElementSize > nextMaxSize) {
|
|
800
|
-
return;
|
|
801
|
-
}
|
|
802
|
-
if (isOverMove(targetSize, targetMinSize)) {
|
|
803
|
-
targetSize = 0;
|
|
804
|
-
nextElementSize = nextRect[model.sizeName];
|
|
805
|
-
} else if (isOverMove(nextElementSize, nextMinSize)) {
|
|
806
|
-
nextElementSize = 0;
|
|
807
|
-
targetSize = targetRect[model.sizeName];
|
|
808
|
-
}
|
|
809
|
-
const targetFlexGrow = targetSize / (parentSizeRef.current - 1) * containerCountRef.current;
|
|
810
|
-
const nextElementFlexGrow = nextElementSize / (parentSizeRef.current - 1) * containerCountRef.current;
|
|
811
|
-
targetElement.style.flex = `${targetFlexGrow} 1 0%`;
|
|
812
|
-
nextElement.style.flex = `${nextElementFlexGrow} 1 0%`;
|
|
813
|
-
}
|
|
814
|
-
useEffect(() => {
|
|
815
|
-
const addGlobalMoveEvent = (event) => {
|
|
816
|
-
if (!isResizePanelClickRef.current || !panelRef.current) {
|
|
817
|
-
return;
|
|
818
|
-
}
|
|
819
|
-
event.preventDefault();
|
|
820
|
-
const targetElement = panelRef.current.previousElementSibling;
|
|
821
|
-
const targetPanel = panelRef.current;
|
|
822
|
-
if (!targetElement || !targetPanel) return;
|
|
823
|
-
let move = { movementX: 0, movementY: 0 };
|
|
824
|
-
if (window.TouchEvent && event instanceof window.TouchEvent) {
|
|
825
|
-
if (!prevTouchEvent) {
|
|
826
|
-
prevTouchEvent = event;
|
|
827
|
-
return;
|
|
828
|
-
}
|
|
829
|
-
move.movementX = (prevTouchEvent.touches[0].pageX - event.touches[0].pageX) * -2;
|
|
830
|
-
move.movementY = (prevTouchEvent.touches[0].pageY - event.touches[0].pageY) * -2;
|
|
831
|
-
prevTouchEvent = event;
|
|
832
|
-
} else {
|
|
833
|
-
move.movementX = event.movementX;
|
|
834
|
-
move.movementY = event.movementY;
|
|
835
|
-
}
|
|
836
|
-
moveMouseFlex(targetElement, targetPanel, move);
|
|
837
|
-
};
|
|
838
|
-
["mousemove", "touchmove"].forEach((eventName) => {
|
|
839
|
-
window.addEventListener(eventName, addGlobalMoveEvent, {
|
|
840
|
-
passive: false
|
|
841
|
-
});
|
|
842
|
-
});
|
|
843
|
-
["mouseup", "touchend"].forEach((eventName) => {
|
|
844
|
-
window.addEventListener(eventName, panelMouseUpEvent);
|
|
845
|
-
});
|
|
846
|
-
return () => {
|
|
847
|
-
["mousemove", "touchmove"].forEach((eventName) => {
|
|
848
|
-
window.removeEventListener(eventName, addGlobalMoveEvent);
|
|
849
|
-
});
|
|
850
|
-
["mouseup", "touchend"].forEach((eventName) => {
|
|
851
|
-
window.removeEventListener(eventName, panelMouseUpEvent);
|
|
852
|
-
});
|
|
853
|
-
};
|
|
854
|
-
}, []);
|
|
855
|
-
useEffect(() => {
|
|
856
|
-
if (!panelRef.current) return;
|
|
857
|
-
setResizePanelRef(layoutName, containerName, panelRef);
|
|
858
|
-
}, [containerName, layoutName]);
|
|
859
|
-
return /* @__PURE__ */ jsx(
|
|
860
|
-
"div",
|
|
861
|
-
{
|
|
862
|
-
id: containerName + "_resize_panel",
|
|
863
|
-
className: `${FlexLayout_default["flex-resize-panel"]} ${FlexLayout_default[panelMode]} ${panelClassName && panelClassName !== "" ? panelClassName : ""}`,
|
|
864
|
-
ref: panelRef,
|
|
865
|
-
onMouseDown: panelMouseDownEvent,
|
|
866
|
-
onTouchStart: panelMouseDownEvent,
|
|
867
|
-
children: /* @__PURE__ */ jsx("div", { className: FlexLayout_default.hover })
|
|
868
|
-
}
|
|
869
|
-
);
|
|
870
|
-
};
|
|
871
|
-
var FlexLayoutResizePanel_default = FlexLayoutResizePanel;
|
|
872
|
-
var FlexLayoutContainer = ({
|
|
873
|
-
isFitContent,
|
|
874
|
-
isFitResize,
|
|
875
|
-
// fitContent,
|
|
876
|
-
// containerCount,
|
|
877
|
-
// layoutName,
|
|
878
|
-
containerName,
|
|
879
|
-
grow: initialGrow,
|
|
880
|
-
prevGrow: initialPrevGrow,
|
|
881
|
-
isInitialResizable,
|
|
882
|
-
isResizePanel,
|
|
883
|
-
children,
|
|
884
|
-
className,
|
|
885
|
-
panelMode
|
|
886
|
-
}) => {
|
|
887
|
-
const {
|
|
888
|
-
direction,
|
|
889
|
-
panelMovementMode,
|
|
890
|
-
panelClassName,
|
|
891
|
-
layoutName,
|
|
892
|
-
fitContent,
|
|
893
|
-
containerCount
|
|
894
|
-
} = useFlexLayoutContext();
|
|
895
|
-
const { ref, size } = (
|
|
896
|
-
// isFitContent && fitContent
|
|
897
|
-
//?
|
|
898
|
-
useSize(fitContent)
|
|
899
|
-
);
|
|
900
|
-
const flexContainerNodeRef = useRef(null);
|
|
901
|
-
const flexContainerRef = useCallback(
|
|
902
|
-
(node) => {
|
|
903
|
-
flexContainerNodeRef.current = node;
|
|
904
|
-
if (node !== null) {
|
|
905
|
-
setContainerRef(layoutName, containerName, { current: node });
|
|
906
|
-
}
|
|
907
|
-
},
|
|
908
|
-
[layoutName, containerName]
|
|
909
|
-
);
|
|
910
|
-
const [growState, setGrowState] = useState(initialGrow);
|
|
911
|
-
useEffect(() => {
|
|
912
|
-
setGrowState(initialGrow);
|
|
913
|
-
}, [initialGrow]);
|
|
914
|
-
const [prevGrowState, setPrevGrowState] = useState(
|
|
915
|
-
initialPrevGrow
|
|
916
|
-
);
|
|
917
|
-
const [isFirstLoad, setIsFirstLoad] = useState(true);
|
|
918
|
-
useEffect(() => {
|
|
919
|
-
if (!flexContainerNodeRef.current) return;
|
|
920
|
-
setContainerRef(layoutName, containerName, flexContainerNodeRef);
|
|
921
|
-
return () => {
|
|
922
|
-
setContainerRef(layoutName, containerName, {
|
|
923
|
-
current: null
|
|
924
|
-
});
|
|
925
|
-
};
|
|
926
|
-
}, [containerName, layoutName]);
|
|
927
|
-
useEffect(() => {
|
|
928
|
-
if (typeof window == "undefined" || flexContainerNodeRef.current === null)
|
|
929
|
-
return;
|
|
930
|
-
const storedGrow = sessionStorage.getItem(containerName);
|
|
931
|
-
if (storedGrow !== null) {
|
|
932
|
-
const parsed = parseFloat(storedGrow);
|
|
933
|
-
if (!isNaN(parsed)) {
|
|
934
|
-
flexContainerNodeRef.current.style.flex = `${parsed} 1 0%`;
|
|
935
|
-
setGrowState(parsed);
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
}, [containerName]);
|
|
939
|
-
useEffect(() => {
|
|
940
|
-
if (!flexContainerNodeRef.current) return;
|
|
941
|
-
const targetNode = flexContainerNodeRef.current;
|
|
942
|
-
const observer = new MutationObserver((mutations) => {
|
|
943
|
-
for (const mutation of mutations) {
|
|
944
|
-
if (mutation.type === "attributes" && mutation.attributeName === "style" && targetNode.style.flex) {
|
|
945
|
-
const flexValue = targetNode.style.flex;
|
|
946
|
-
const parsedGrow = parseFloat(flexValue.split(" ")[0]);
|
|
947
|
-
if (!isNaN(parsedGrow)) {
|
|
948
|
-
setGrowState(parsedGrow);
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
});
|
|
953
|
-
observer.observe(targetNode, {
|
|
954
|
-
attributes: true,
|
|
955
|
-
attributeFilter: ["style"],
|
|
956
|
-
attributeOldValue: true
|
|
957
|
-
});
|
|
958
|
-
return () => {
|
|
959
|
-
observer.disconnect();
|
|
960
|
-
};
|
|
961
|
-
}, [containerName]);
|
|
962
|
-
useEffect(() => {
|
|
963
|
-
if (!flexContainerNodeRef.current || !ref || !ref.current || !size || !fitContent)
|
|
964
|
-
return;
|
|
965
|
-
requestAnimationFrame(() => {
|
|
966
|
-
if (!flexContainerNodeRef.current) return;
|
|
967
|
-
const sizeName = `${fitContent.charAt(0).toUpperCase() + fitContent.substring(1)}`;
|
|
968
|
-
const parentSize = flexContainerNodeRef.current.parentElement && flexContainerNodeRef.current.parentElement["client" + sizeName] || 0;
|
|
969
|
-
if (isFitContent) {
|
|
970
|
-
flexContainerNodeRef.current.style["max" + sizeName] = size + "px";
|
|
971
|
-
}
|
|
972
|
-
if (!isFitResize && isFirstLoad) {
|
|
973
|
-
setIsFirstLoad(false);
|
|
974
|
-
return;
|
|
975
|
-
}
|
|
976
|
-
if (getGrow(flexContainerNodeRef.current) != 0 && isFitResize) {
|
|
977
|
-
const newGrow = mathGrow(size, parentSize, containerCount);
|
|
978
|
-
setPrevGrowState(growState);
|
|
979
|
-
setGrowState(newGrow);
|
|
980
|
-
}
|
|
981
|
-
});
|
|
982
|
-
}, [size, containerCount, isFitResize, children]);
|
|
983
|
-
useEffect(() => {
|
|
984
|
-
if (!flexContainerNodeRef.current) return;
|
|
985
|
-
let notGrowList = [];
|
|
986
|
-
let containerList = [
|
|
987
|
-
...flexContainerNodeRef.current.parentElement?.children || []
|
|
988
|
-
].filter((e) => e.hasAttribute("data-container_name"));
|
|
989
|
-
let remainingGrow = containerList.reduce((t, e, i) => {
|
|
990
|
-
let item = e;
|
|
991
|
-
if (item.classList.contains(FlexLayout_default["flex-resize-panel"])) return t;
|
|
992
|
-
if (e.hasAttribute("data-grow") == false || e.getAttribute("data-is_resize") === "true") {
|
|
993
|
-
notGrowList.push(item);
|
|
994
|
-
return t;
|
|
995
|
-
}
|
|
996
|
-
let grow = parseFloat(item.dataset.grow || "");
|
|
997
|
-
item.style.flex = `${grow} 1 0%`;
|
|
998
|
-
t -= grow;
|
|
999
|
-
return t;
|
|
1000
|
-
}, containerList.length);
|
|
1001
|
-
if (notGrowList.length != 0) {
|
|
1002
|
-
let resizeWeight = mathWeight(notGrowList.length, remainingGrow);
|
|
1003
|
-
notGrowList.forEach((e) => {
|
|
1004
|
-
e.dataset.grow = resizeWeight.toString();
|
|
1005
|
-
e.style.flex = `${resizeWeight} 1 0%`;
|
|
1006
|
-
});
|
|
1007
|
-
}
|
|
1008
|
-
}, []);
|
|
1009
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1010
|
-
/* @__PURE__ */ jsx(
|
|
1011
|
-
"div",
|
|
1012
|
-
{
|
|
1013
|
-
id: containerName,
|
|
1014
|
-
"data-container_name": containerName,
|
|
1015
|
-
ref: flexContainerRef,
|
|
1016
|
-
className: `${FlexLayout_default["flex-container"]} ${className && className !== "" ? className : ""}`,
|
|
1017
|
-
...growState !== void 0 ? { ["data-grow"]: growState } : {},
|
|
1018
|
-
...prevGrowState != void 0 ? { ["data-prev_grow"]: prevGrowState } : {},
|
|
1019
|
-
"data-is_resize": isInitialResizable,
|
|
1020
|
-
"data-is_resize_panel": isResizePanel,
|
|
1021
|
-
style: growState !== void 0 && {
|
|
1022
|
-
flex: `${growState} 1 0%`
|
|
1023
|
-
} || {},
|
|
1024
|
-
children: isFitContent && /* @__PURE__ */ jsx(
|
|
1025
|
-
"div",
|
|
1026
|
-
{
|
|
1027
|
-
className: `${FlexLayout_default["flex-content-fit-wrapper"]}`,
|
|
1028
|
-
ref,
|
|
1029
|
-
children
|
|
1030
|
-
}
|
|
1031
|
-
) || children
|
|
1032
|
-
}
|
|
1033
|
-
),
|
|
1034
|
-
isResizePanel && /* @__PURE__ */ jsx(
|
|
1035
|
-
FlexLayoutResizePanel_default,
|
|
1036
|
-
{
|
|
1037
|
-
containerName,
|
|
1038
|
-
layoutName,
|
|
1039
|
-
direction,
|
|
1040
|
-
containerCount,
|
|
1041
|
-
panelMode,
|
|
1042
|
-
panelClassName,
|
|
1043
|
-
panelMovementMode
|
|
1044
|
-
}
|
|
1045
|
-
)
|
|
1046
|
-
] });
|
|
1047
|
-
};
|
|
1048
|
-
var FlexLayoutContainer_default = FlexLayoutContainer;
|
|
1049
|
-
var dragState = new Subject();
|
|
1050
|
-
var filterChildren = (obj) => {
|
|
1051
|
-
const { children, ...rest } = obj || {};
|
|
1052
|
-
return rest;
|
|
1053
|
-
};
|
|
1054
|
-
var useDragCapture = (targetRef) => {
|
|
1055
|
-
const stateRef = useRef(null);
|
|
1056
|
-
const forceUpdate = useRef(0);
|
|
1057
|
-
useEffect(() => {
|
|
1058
|
-
const subscription = dragState.pipe(
|
|
1059
|
-
map$1((value) => {
|
|
1060
|
-
if (!targetRef || !targetRef.current) return null;
|
|
1061
|
-
const { x, y } = value;
|
|
1062
|
-
const rect = targetRef.current.getBoundingClientRect();
|
|
1063
|
-
const {
|
|
1064
|
-
width,
|
|
1065
|
-
height,
|
|
1066
|
-
x: rectX,
|
|
1067
|
-
y: rectY,
|
|
1068
|
-
right,
|
|
1069
|
-
bottom
|
|
1070
|
-
} = rect;
|
|
1071
|
-
let isOver = false;
|
|
1072
|
-
if (x < rectX || x > right || y < rectY || y > bottom) {
|
|
1073
|
-
isOver = true;
|
|
1074
|
-
}
|
|
1075
|
-
const leftBoundary = rectX + width * 0.2;
|
|
1076
|
-
const rightBoundary = right - width * 0.2;
|
|
1077
|
-
const topBoundary = rectY + height * 0.2;
|
|
1078
|
-
const bottomBoundary = bottom - height * 0.2;
|
|
1079
|
-
let position = "centerBoundary";
|
|
1080
|
-
if (x < leftBoundary) {
|
|
1081
|
-
position = "leftBoundary";
|
|
1082
|
-
} else if (x > rightBoundary) {
|
|
1083
|
-
position = "rightBoundary";
|
|
1084
|
-
} else if (y < topBoundary) {
|
|
1085
|
-
position = "topBoundary";
|
|
1086
|
-
} else if (y > bottomBoundary) {
|
|
1087
|
-
position = "bottomBoundary";
|
|
1088
|
-
}
|
|
1089
|
-
return {
|
|
1090
|
-
positionName: position,
|
|
1091
|
-
isOver,
|
|
1092
|
-
...value
|
|
1093
|
-
};
|
|
1094
|
-
}),
|
|
1095
|
-
distinctUntilChanged$1(
|
|
1096
|
-
(prev, curr) => equal(filterChildren(prev), filterChildren(curr))
|
|
1097
|
-
)
|
|
1098
|
-
).subscribe({
|
|
1099
|
-
next: (value) => {
|
|
1100
|
-
if (value && !equal(
|
|
1101
|
-
filterChildren(stateRef.current),
|
|
1102
|
-
filterChildren(value)
|
|
1103
|
-
)) {
|
|
1104
|
-
stateRef.current = value;
|
|
1105
|
-
forceUpdate.current++;
|
|
1106
|
-
}
|
|
1107
|
-
},
|
|
1108
|
-
error: (err) => console.error(err)
|
|
1109
|
-
});
|
|
1110
|
-
return () => subscription.unsubscribe();
|
|
1111
|
-
}, [targetRef]);
|
|
1112
|
-
const [, rerender] = useState({});
|
|
1113
|
-
useEffect(() => {
|
|
1114
|
-
const interval = setInterval(() => {
|
|
1115
|
-
rerender({});
|
|
1116
|
-
}, 50);
|
|
1117
|
-
return () => clearInterval(interval);
|
|
1118
|
-
}, []);
|
|
1119
|
-
return stateRef.current;
|
|
1120
|
-
};
|
|
1121
|
-
var dropMovementEventSubject = new Subject();
|
|
1122
|
-
var allSplitScreenCount = new BehaviorSubject(0);
|
|
1123
|
-
var useDragEvents = ({
|
|
1124
|
-
isBlockingActiveInput = false
|
|
1125
|
-
}) => {
|
|
1126
|
-
const dragResumeTimer = useRef(null);
|
|
1127
|
-
const scrollThreshold = 10;
|
|
1128
|
-
const isScrolling = useRef(false);
|
|
1129
|
-
const isPending = useRef(false);
|
|
1130
|
-
const isMouseDown = useRef(false);
|
|
1131
|
-
const isDragging = useRef(false);
|
|
1132
|
-
const touchStartX = useRef(0);
|
|
1133
|
-
const touchStartY = useRef(0);
|
|
1134
|
-
const handleStart = useCallback(
|
|
1135
|
-
({
|
|
1136
|
-
event: _event,
|
|
1137
|
-
dragStartCallback
|
|
1138
|
-
}) => {
|
|
1139
|
-
const event = _event instanceof Event ? _event : _event.nativeEvent;
|
|
1140
|
-
if (dragResumeTimer.current) {
|
|
1141
|
-
clearTimeout(dragResumeTimer.current);
|
|
1142
|
-
dragResumeTimer.current = null;
|
|
1143
|
-
}
|
|
1144
|
-
if (event.target.contentEditable === "true" || isBlockingActiveInput && document.activeElement === event.target) {
|
|
1145
|
-
return;
|
|
1146
|
-
}
|
|
1147
|
-
if (event.cancelable) {
|
|
1148
|
-
event.preventDefault();
|
|
1149
|
-
}
|
|
1150
|
-
isPending.current = true;
|
|
1151
|
-
isMouseDown.current = true;
|
|
1152
|
-
if (event instanceof globalThis.TouchEvent) {
|
|
1153
|
-
const touch = event.touches[0];
|
|
1154
|
-
touchStartX.current = touch.clientX;
|
|
1155
|
-
touchStartY.current = touch.clientY;
|
|
1156
|
-
} else if (event instanceof globalThis.MouseEvent) {
|
|
1157
|
-
touchStartX.current = event.clientX;
|
|
1158
|
-
touchStartY.current = event.clientY;
|
|
1159
|
-
}
|
|
1160
|
-
setTimeout(() => {
|
|
1161
|
-
if (!isPending.current || isScrolling.current) return;
|
|
1162
|
-
isPending.current = false;
|
|
1163
|
-
isDragging.current = true;
|
|
1164
|
-
const xy = getClientXy(event);
|
|
1165
|
-
if (!xy) return;
|
|
1166
|
-
const { clientX, clientY } = xy;
|
|
1167
|
-
dragStartCallback({ x: clientX, y: clientY });
|
|
1168
|
-
}, 300);
|
|
1169
|
-
},
|
|
1170
|
-
[isBlockingActiveInput]
|
|
1171
|
-
);
|
|
1172
|
-
const handleMove = useCallback(
|
|
1173
|
-
({
|
|
1174
|
-
event: _event,
|
|
1175
|
-
notDragCallback,
|
|
1176
|
-
dragStartCallback,
|
|
1177
|
-
moveingCallback
|
|
1178
|
-
}) => {
|
|
1179
|
-
if (!isMouseDown.current) return;
|
|
1180
|
-
const event = _event instanceof Event ? _event : _event.nativeEvent;
|
|
1181
|
-
const xy = getClientXy(event);
|
|
1182
|
-
if (!xy) return;
|
|
1183
|
-
const { clientX, clientY } = xy;
|
|
1184
|
-
const deltaX = Math.abs(clientX - touchStartX.current);
|
|
1185
|
-
const deltaY = Math.abs(clientY - touchStartY.current);
|
|
1186
|
-
if (isPending.current && (deltaX > scrollThreshold || deltaY > scrollThreshold)) {
|
|
1187
|
-
isScrolling.current = true;
|
|
1188
|
-
isPending.current = false;
|
|
1189
|
-
isDragging.current = false;
|
|
1190
|
-
if (notDragCallback)
|
|
1191
|
-
notDragCallback({ x: clientX, y: clientY });
|
|
1192
|
-
if (dragResumeTimer.current) {
|
|
1193
|
-
clearTimeout(dragResumeTimer.current);
|
|
1194
|
-
dragResumeTimer.current = null;
|
|
1195
|
-
}
|
|
1196
|
-
dragResumeTimer.current = setTimeout(() => {
|
|
1197
|
-
if (!isMouseDown.current) return;
|
|
1198
|
-
if (dragStartCallback)
|
|
1199
|
-
dragStartCallback({ x: clientX, y: clientY });
|
|
1200
|
-
isPending.current = true;
|
|
1201
|
-
isScrolling.current = false;
|
|
1202
|
-
handleStart({ event: _event, dragStartCallback });
|
|
1203
|
-
}, 400);
|
|
1204
|
-
return;
|
|
1205
|
-
}
|
|
1206
|
-
if (!isDragging.current || isPending.current) return;
|
|
1207
|
-
moveingCallback({ x: clientX, y: clientY });
|
|
1208
|
-
},
|
|
1209
|
-
[isBlockingActiveInput]
|
|
1210
|
-
);
|
|
1211
|
-
const handleEnd = useCallback(
|
|
1212
|
-
({
|
|
1213
|
-
event: _event,
|
|
1214
|
-
dragEndCallback
|
|
1215
|
-
}) => {
|
|
1216
|
-
isScrolling.current = false;
|
|
1217
|
-
isMouseDown.current = false;
|
|
1218
|
-
if (isPending.current) {
|
|
1219
|
-
isPending.current = false;
|
|
1220
|
-
return;
|
|
1221
|
-
}
|
|
1222
|
-
const event = _event instanceof Event ? _event : _event.nativeEvent;
|
|
1223
|
-
if (!isDragging.current) return;
|
|
1224
|
-
isDragging.current = false;
|
|
1225
|
-
const xy = getClientXy(event);
|
|
1226
|
-
if (!xy) return;
|
|
1227
|
-
const { clientX, clientY } = xy;
|
|
1228
|
-
dragEndCallback({ x: clientX, y: clientY });
|
|
1229
|
-
},
|
|
1230
|
-
[isBlockingActiveInput]
|
|
1231
|
-
);
|
|
1232
|
-
return {
|
|
1233
|
-
handleStart,
|
|
1234
|
-
handleMove,
|
|
1235
|
-
handleEnd
|
|
1236
|
-
};
|
|
1237
|
-
};
|
|
1238
|
-
var folderEventSubject = new Subject();
|
|
1239
|
-
var setFolderEvent = (newValue) => {
|
|
1240
|
-
folderEventSubject.next(newValue);
|
|
1241
|
-
};
|
|
1242
|
-
var useFolderEvent = () => {
|
|
1243
|
-
const [folderEvent, setFolderEvent2] = useState(
|
|
1244
|
-
null
|
|
1245
|
-
);
|
|
1246
|
-
useEffect(() => {
|
|
1247
|
-
const subscription = folderEventSubject.subscribe((e) => {
|
|
1248
|
-
if (!e) return;
|
|
1249
|
-
setFolderEvent2(e);
|
|
1250
|
-
});
|
|
1251
|
-
return () => {
|
|
1252
|
-
if (subscription) {
|
|
1253
|
-
subscription.unsubscribe();
|
|
1254
|
-
}
|
|
1255
|
-
};
|
|
1256
|
-
}, []);
|
|
1257
|
-
return { folderEvent };
|
|
1258
|
-
};
|
|
1259
|
-
function useFlexLayoutSplitScreen({
|
|
1260
|
-
isSplitInitial = false,
|
|
1261
|
-
parentDirection,
|
|
1262
|
-
directionInitial = "row",
|
|
1263
|
-
selfContainerName,
|
|
1264
|
-
parentLayoutName,
|
|
1265
|
-
layoutName
|
|
1266
|
-
}) {
|
|
1267
|
-
const [direction, setDirection] = useState(
|
|
1268
|
-
directionInitial
|
|
1269
|
-
);
|
|
1270
|
-
const [isSplit, setIsSplit] = useState(isSplitInitial);
|
|
1271
|
-
const [boundaryContainerSize, setBoundaryContainerSize] = useState(null);
|
|
1272
|
-
const [centerDropTargetComponent, setCenterDropTargetComponent] = useState([]);
|
|
1273
|
-
const [afterDropTargetComponent, setAfterDropTargetComponent] = useState([]);
|
|
1274
|
-
const [beforeDropTargetComponent, setBeforeDropTargetComponent] = useState([]);
|
|
1275
|
-
const layoutRef = useRef(null);
|
|
1276
|
-
const dragState2 = useDragCapture(layoutRef);
|
|
1277
|
-
useEffect(() => {
|
|
1278
|
-
if (!dragState2) {
|
|
1279
|
-
setBoundaryContainerSize(null);
|
|
1280
|
-
return;
|
|
1281
|
-
}
|
|
1282
|
-
const {
|
|
1283
|
-
isDrop,
|
|
1284
|
-
isDragging,
|
|
1285
|
-
positionName,
|
|
1286
|
-
containerName,
|
|
1287
|
-
children: dropComponent,
|
|
1288
|
-
isOver,
|
|
1289
|
-
navigationTitle,
|
|
1290
|
-
dropEndCallback,
|
|
1291
|
-
x,
|
|
1292
|
-
y,
|
|
1293
|
-
screenKey
|
|
1294
|
-
} = dragState2;
|
|
1295
|
-
const orderName = positionName === "leftBoundary" || positionName === "topBoundary" ? "before" : positionName === "rightBoundary" || positionName === "bottomBoundary" ? "after" : "center";
|
|
1296
|
-
if ((isOver || isDrop) && boundaryContainerSize) {
|
|
1297
|
-
setBoundaryContainerSize(null);
|
|
1298
|
-
}
|
|
1299
|
-
if (selfContainerName.startsWith(containerName)) {
|
|
1300
|
-
return;
|
|
1301
|
-
}
|
|
1302
|
-
if (isDrop && screenKey) {
|
|
1303
|
-
const dropDirection = positionName === "leftBoundary" || positionName === "rightBoundary" ? "row" : "column";
|
|
1304
|
-
if (!isSplit && !isOver) {
|
|
1305
|
-
if (positionName !== "centerBoundary" && dropDirection !== parentDirection) {
|
|
1306
|
-
setIsSplit(true);
|
|
1307
|
-
setDirection(dropDirection);
|
|
1308
|
-
}
|
|
1309
|
-
dropMovementEventSubject.next({
|
|
1310
|
-
state: "append",
|
|
1311
|
-
targetContainerName: containerName,
|
|
1312
|
-
targetParentLayoutName: parentLayoutName,
|
|
1313
|
-
targetLayoutName: layoutName,
|
|
1314
|
-
targetComponent: dropComponent,
|
|
1315
|
-
orderName,
|
|
1316
|
-
x,
|
|
1317
|
-
y,
|
|
1318
|
-
dropEndCallback,
|
|
1319
|
-
dropTargetComponentEvent: {
|
|
1320
|
-
navigationTitle,
|
|
1321
|
-
dropDocumentOutsideOption: dragState2?.dropDocumentOutsideOption,
|
|
1322
|
-
direction: dropDirection,
|
|
1323
|
-
screenKey
|
|
1324
|
-
}
|
|
1325
|
-
});
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
if (isDragging && !isSplit && !isOver) {
|
|
1329
|
-
const newSize = {
|
|
1330
|
-
left: positionName === "rightBoundary" ? "50%" : "0",
|
|
1331
|
-
top: positionName === "bottomBoundary" ? "50%" : "0",
|
|
1332
|
-
width: positionName === "leftBoundary" || positionName === "rightBoundary" ? "50%" : "100%",
|
|
1333
|
-
height: positionName === "topBoundary" || positionName === "bottomBoundary" ? "50%" : "100%"
|
|
1334
|
-
};
|
|
1335
|
-
if (JSON.stringify(boundaryContainerSize) !== JSON.stringify(newSize)) {
|
|
1336
|
-
setBoundaryContainerSize(newSize);
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
}, [
|
|
1340
|
-
dragState2,
|
|
1341
|
-
isSplit,
|
|
1342
|
-
boundaryContainerSize,
|
|
1343
|
-
parentLayoutName,
|
|
1344
|
-
layoutName,
|
|
1345
|
-
selfContainerName,
|
|
1346
|
-
direction
|
|
1347
|
-
]);
|
|
1348
|
-
return {
|
|
1349
|
-
direction,
|
|
1350
|
-
setDirection,
|
|
1351
|
-
isSplit,
|
|
1352
|
-
setIsSplit,
|
|
1353
|
-
boundaryContainerSize,
|
|
1354
|
-
//setBoundaryContainerSize,
|
|
1355
|
-
centerDropTargetComponent,
|
|
1356
|
-
afterDropTargetComponent,
|
|
1357
|
-
beforeDropTargetComponent,
|
|
1358
|
-
setAfterDropTargetComponent,
|
|
1359
|
-
setBeforeDropTargetComponent,
|
|
1360
|
-
setCenterDropTargetComponent,
|
|
1361
|
-
//dropTargetComponent,
|
|
1362
|
-
//setDropTargetComponent,
|
|
1363
|
-
//setDropPosition,
|
|
1364
|
-
isOver: dragState2?.isOver,
|
|
1365
|
-
layoutRef
|
|
1366
|
-
};
|
|
1367
|
-
}
|
|
1368
|
-
var MAX_STEP = 18;
|
|
1369
|
-
function edgeVelocity(x, y) {
|
|
1370
|
-
const w = window.innerWidth, h = window.innerHeight;
|
|
1371
|
-
const mx = w * 0.15, my = h * 0.15;
|
|
1372
|
-
let vx = 0;
|
|
1373
|
-
if (x < mx)
|
|
1374
|
-
vx = -((mx - x) / mx) * MAX_STEP;
|
|
1375
|
-
else if (x > w - mx)
|
|
1376
|
-
vx = (x - (w - mx)) / mx * MAX_STEP;
|
|
1377
|
-
let vy = 0;
|
|
1378
|
-
if (y < my)
|
|
1379
|
-
vy = -((my - y) / my) * MAX_STEP;
|
|
1380
|
-
else if (y > h - my)
|
|
1381
|
-
vy = (y - (h - my)) / my * MAX_STEP;
|
|
1382
|
-
return { vx, vy };
|
|
1383
|
-
}
|
|
1384
|
-
function FlexLayoutSplitScreenDragBox({
|
|
1385
|
-
onMouseDown,
|
|
1386
|
-
onTouchStart,
|
|
1387
|
-
dropEndCallback,
|
|
1388
|
-
style,
|
|
1389
|
-
navigationTitle,
|
|
1390
|
-
targetComponent,
|
|
1391
|
-
containerName,
|
|
1392
|
-
children,
|
|
1393
|
-
className,
|
|
1394
|
-
dropDocumentOutsideOption,
|
|
1395
|
-
screenKey = Array.from(
|
|
1396
|
-
window.crypto.getRandomValues(new Uint32Array(16)),
|
|
1397
|
-
(e) => e.toString(32).padStart(2, "0")
|
|
1398
|
-
).join(""),
|
|
1399
|
-
isBlockingActiveInput = false,
|
|
1400
|
-
customData = {},
|
|
1401
|
-
scrollTargetRef,
|
|
1402
|
-
...props
|
|
1403
|
-
}) {
|
|
1404
|
-
const scrollRAF = useRef(null);
|
|
1405
|
-
const velocity = useRef({ vx: 0, vy: 0 });
|
|
1406
|
-
const ref = useRef(null);
|
|
1407
|
-
const clonedNodeRef = useRef(null);
|
|
1408
|
-
const clonedWidth = useRef(null);
|
|
1409
|
-
const clonedHeight = useRef(null);
|
|
1410
|
-
const hrefUrlRef = useRef("");
|
|
1411
|
-
const { handleStart, handleMove, handleEnd } = useDragEvents({
|
|
1412
|
-
isBlockingActiveInput
|
|
1413
|
-
});
|
|
1414
|
-
const handleMoveWrapper = (event) => {
|
|
1415
|
-
let x = 0;
|
|
1416
|
-
let y = 0;
|
|
1417
|
-
if (event.type === "touchmove") {
|
|
1418
|
-
const t = event.touches[0];
|
|
1419
|
-
x = t.clientX;
|
|
1420
|
-
y = t.clientY;
|
|
1421
|
-
} else {
|
|
1422
|
-
const m = event;
|
|
1423
|
-
x = m.clientX;
|
|
1424
|
-
y = m.clientY;
|
|
1425
|
-
}
|
|
1426
|
-
const { vx, vy } = edgeVelocity(x, y);
|
|
1427
|
-
const inEdge = vx !== 0 || vy !== 0;
|
|
1428
|
-
if (clonedNodeRef.current?.isConnected && !inEdge) {
|
|
1429
|
-
event.preventDefault();
|
|
1430
|
-
if (scrollRAF.current) {
|
|
1431
|
-
cancelAnimationFrame(scrollRAF.current);
|
|
1432
|
-
scrollRAF.current = null;
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
if (clonedNodeRef.current?.isConnected && inEdge) {
|
|
1436
|
-
event.preventDefault();
|
|
1437
|
-
velocity.current = { vx, vy };
|
|
1438
|
-
if (!scrollRAF.current) {
|
|
1439
|
-
const step = () => {
|
|
1440
|
-
scrollTargetRef?.current?.scrollBy(
|
|
1441
|
-
velocity.current.vx,
|
|
1442
|
-
velocity.current.vy
|
|
1443
|
-
);
|
|
1444
|
-
if (velocity.current.vx === 0 && velocity.current.vy === 0) {
|
|
1445
|
-
scrollRAF.current = null;
|
|
1446
|
-
return;
|
|
1447
|
-
}
|
|
1448
|
-
scrollRAF.current = requestAnimationFrame(step);
|
|
1449
|
-
};
|
|
1450
|
-
scrollRAF.current = requestAnimationFrame(step);
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
if (event.type !== "touchmove") {
|
|
1454
|
-
event.preventDefault();
|
|
1455
|
-
}
|
|
1456
|
-
handleMove({
|
|
1457
|
-
event,
|
|
1458
|
-
notDragCallback: ({ x: x2, y: y2 }) => {
|
|
1459
|
-
if (clonedNodeRef.current) clonedNodeRef.current.remove();
|
|
1460
|
-
},
|
|
1461
|
-
dragStartCallback: ({ x: x2, y: y2 }) => {
|
|
1462
|
-
if (!clonedNodeRef.current) return;
|
|
1463
|
-
navigator.vibrate(100);
|
|
1464
|
-
clonedNodeRef.current.style.left = `${x2 - (clonedWidth.current || 0) / 2}px`;
|
|
1465
|
-
clonedNodeRef.current.style.top = `${y2 - (clonedHeight.current || 0) / 2}px`;
|
|
1466
|
-
},
|
|
1467
|
-
moveingCallback: ({ x: x2, y: y2 }) => {
|
|
1468
|
-
if (clonedNodeRef.current?.isConnected) {
|
|
1469
|
-
clonedNodeRef.current.style.left = `${x2 - (clonedWidth.current || 0) / 2}px`;
|
|
1470
|
-
clonedNodeRef.current.style.top = `${y2 - (clonedHeight.current || 0) / 2}px`;
|
|
1471
|
-
}
|
|
1472
|
-
dragState.next({
|
|
1473
|
-
isDragging: true,
|
|
1474
|
-
isDrop: false,
|
|
1475
|
-
navigationTitle,
|
|
1476
|
-
children: targetComponent,
|
|
1477
|
-
x: x2,
|
|
1478
|
-
y: y2,
|
|
1479
|
-
containerName,
|
|
1480
|
-
dropDocumentOutsideOption,
|
|
1481
|
-
customData
|
|
1482
|
-
});
|
|
1483
|
-
}
|
|
1484
|
-
});
|
|
1485
|
-
};
|
|
1486
|
-
const handleEndWrapper = (event) => {
|
|
1487
|
-
if (scrollRAF.current !== null) {
|
|
1488
|
-
cancelAnimationFrame(scrollRAF.current);
|
|
1489
|
-
scrollRAF.current = null;
|
|
1490
|
-
}
|
|
1491
|
-
velocity.current = { vx: 0, vy: 0 };
|
|
1492
|
-
handleEnd({
|
|
1493
|
-
event,
|
|
1494
|
-
dragEndCallback: ({ x, y }) => {
|
|
1495
|
-
const href = hrefUrlRef.current;
|
|
1496
|
-
if (clonedNodeRef.current) clonedNodeRef.current.remove();
|
|
1497
|
-
if (dropDocumentOutsideOption && isDocumentOut({ x, y })) {
|
|
1498
|
-
if (dropDocumentOutsideOption.isNewTap || !dropDocumentOutsideOption.widthRatio && !dropDocumentOutsideOption.heightRatio) {
|
|
1499
|
-
window.open(href, "_blank");
|
|
1500
|
-
} else {
|
|
1501
|
-
const width = window.innerWidth * (dropDocumentOutsideOption.widthRatio || 1);
|
|
1502
|
-
const height = window.innerHeight * (dropDocumentOutsideOption.heightRatio || 1);
|
|
1503
|
-
window.open(
|
|
1504
|
-
href,
|
|
1505
|
-
"_blank",
|
|
1506
|
-
`width=${width},height=${height},left=${window.screenLeft - x * -1 - width},top=${window.screenTop + y}`
|
|
1507
|
-
);
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
dragState.next({
|
|
1511
|
-
isDragging: false,
|
|
1512
|
-
isDrop: true,
|
|
1513
|
-
navigationTitle,
|
|
1514
|
-
children: targetComponent,
|
|
1515
|
-
x,
|
|
1516
|
-
y,
|
|
1517
|
-
containerName,
|
|
1518
|
-
dropDocumentOutsideOption,
|
|
1519
|
-
dropEndCallback,
|
|
1520
|
-
screenKey,
|
|
1521
|
-
customData
|
|
1522
|
-
});
|
|
1523
|
-
}
|
|
1524
|
-
});
|
|
1525
|
-
};
|
|
1526
|
-
useEffect(() => {
|
|
1527
|
-
if (ref.current) {
|
|
1528
|
-
const clone = ref.current.cloneNode(true);
|
|
1529
|
-
const originRect = ref.current.getBoundingClientRect();
|
|
1530
|
-
clone.style.width = originRect.width + "px";
|
|
1531
|
-
clone.style.height = originRect.height + "px";
|
|
1532
|
-
clone.style.opacity = "0.3";
|
|
1533
|
-
clone.style.backdropFilter = "blur(6px)";
|
|
1534
|
-
clonedWidth.current = originRect.width;
|
|
1535
|
-
clonedHeight.current = originRect.height;
|
|
1536
|
-
if (dropDocumentOutsideOption?.openUrl) {
|
|
1537
|
-
hrefUrlRef.current = dropDocumentOutsideOption.openUrl;
|
|
1538
|
-
const href = document.createElement("span");
|
|
1539
|
-
href.textContent = hrefUrlRef.current;
|
|
1540
|
-
clone.prepend(href);
|
|
1541
|
-
}
|
|
1542
|
-
if (navigationTitle) {
|
|
1543
|
-
const title = document.createElement("span");
|
|
1544
|
-
title.textContent = navigationTitle;
|
|
1545
|
-
clone.prepend(title);
|
|
1546
|
-
}
|
|
1547
|
-
clone.style.position = "fixed";
|
|
1548
|
-
clonedNodeRef.current = clone;
|
|
1549
|
-
clonedNodeRef.current.classList.add(
|
|
1550
|
-
FlexLayout_default["flex-split-screen-drag-box-clone"]
|
|
1551
|
-
);
|
|
1552
|
-
}
|
|
1553
|
-
}, []);
|
|
1554
|
-
useEffect(() => {
|
|
1555
|
-
const moveEvents = [
|
|
1556
|
-
"mousemove",
|
|
1557
|
-
"touchmove"
|
|
1558
|
-
];
|
|
1559
|
-
const endEvents = ["mouseup", "touchend"];
|
|
1560
|
-
moveEvents.forEach((eventName) => {
|
|
1561
|
-
window.addEventListener(eventName, handleMoveWrapper, {
|
|
1562
|
-
passive: false
|
|
1563
|
-
});
|
|
1564
|
-
});
|
|
1565
|
-
endEvents.forEach((eventName) => {
|
|
1566
|
-
window.addEventListener(eventName, handleEndWrapper);
|
|
1567
|
-
});
|
|
1568
|
-
return () => {
|
|
1569
|
-
moveEvents.forEach((eventName) => {
|
|
1570
|
-
window.removeEventListener(eventName, handleMoveWrapper);
|
|
1571
|
-
});
|
|
1572
|
-
endEvents.forEach((eventName) => {
|
|
1573
|
-
window.removeEventListener(eventName, handleEndWrapper);
|
|
1574
|
-
});
|
|
1575
|
-
};
|
|
1576
|
-
}, [
|
|
1577
|
-
customData,
|
|
1578
|
-
targetComponent,
|
|
1579
|
-
dropDocumentOutsideOption,
|
|
1580
|
-
screenKey,
|
|
1581
|
-
isBlockingActiveInput,
|
|
1582
|
-
containerName,
|
|
1583
|
-
navigationTitle,
|
|
1584
|
-
dropEndCallback
|
|
1585
|
-
]);
|
|
1586
|
-
useEffect(() => {
|
|
1587
|
-
const el = ref.current;
|
|
1588
|
-
if (!el) return;
|
|
1589
|
-
const onCtx = (e) => e.preventDefault();
|
|
1590
|
-
el.addEventListener("contextmenu", onCtx);
|
|
1591
|
-
return () => {
|
|
1592
|
-
el.removeEventListener("contextmenu", onCtx);
|
|
1593
|
-
};
|
|
1594
|
-
}, []);
|
|
1595
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1596
|
-
"div",
|
|
1597
|
-
{
|
|
1598
|
-
className: `${className || ""} ${FlexLayout_default["flex-split-screen-drag-box"]}`,
|
|
1599
|
-
ref,
|
|
1600
|
-
onContextMenu: (e) => e.preventDefault(),
|
|
1601
|
-
onMouseDown: (ev) => {
|
|
1602
|
-
if (onMouseDown) {
|
|
1603
|
-
Promise.resolve().then(() => onMouseDown(ev));
|
|
1604
|
-
}
|
|
1605
|
-
handleStart({
|
|
1606
|
-
event: ev,
|
|
1607
|
-
dragStartCallback: ({ x, y }) => {
|
|
1608
|
-
if (clonedNodeRef.current) {
|
|
1609
|
-
document.body.appendChild(
|
|
1610
|
-
clonedNodeRef.current
|
|
1611
|
-
);
|
|
1612
|
-
if (ref.current) {
|
|
1613
|
-
const originRect = ref.current.getBoundingClientRect();
|
|
1614
|
-
clonedNodeRef.current.style.width = originRect.width + "px";
|
|
1615
|
-
clonedNodeRef.current.style.height = originRect.height + "px";
|
|
1616
|
-
clonedWidth.current = originRect.width;
|
|
1617
|
-
clonedHeight.current = originRect.height;
|
|
1618
|
-
}
|
|
1619
|
-
}
|
|
1620
|
-
if (clonedNodeRef.current?.isConnected) {
|
|
1621
|
-
navigator.vibrate(100);
|
|
1622
|
-
clonedNodeRef.current.style.left = `${x - (clonedWidth.current || 0) / 2}px`;
|
|
1623
|
-
clonedNodeRef.current.style.top = `${y - (clonedHeight.current || 0) / 2}px`;
|
|
1624
|
-
}
|
|
1625
|
-
dragState.next({
|
|
1626
|
-
isDragging: true,
|
|
1627
|
-
isDrop: false,
|
|
1628
|
-
navigationTitle,
|
|
1629
|
-
children: targetComponent,
|
|
1630
|
-
x,
|
|
1631
|
-
y,
|
|
1632
|
-
containerName,
|
|
1633
|
-
dropDocumentOutsideOption,
|
|
1634
|
-
customData
|
|
1635
|
-
});
|
|
1636
|
-
}
|
|
1637
|
-
});
|
|
1638
|
-
},
|
|
1639
|
-
onTouchStart: (ev) => {
|
|
1640
|
-
if (onTouchStart) {
|
|
1641
|
-
Promise.resolve().then(() => onTouchStart(ev));
|
|
1642
|
-
}
|
|
1643
|
-
handleStart({
|
|
1644
|
-
event: ev,
|
|
1645
|
-
dragStartCallback: ({ x, y }) => {
|
|
1646
|
-
if (clonedNodeRef.current) {
|
|
1647
|
-
document.body.appendChild(
|
|
1648
|
-
clonedNodeRef.current
|
|
1649
|
-
);
|
|
1650
|
-
if (ref.current) {
|
|
1651
|
-
const originRect = ref.current.getBoundingClientRect();
|
|
1652
|
-
clonedNodeRef.current.style.width = originRect.width + "px";
|
|
1653
|
-
clonedNodeRef.current.style.height = originRect.height + "px";
|
|
1654
|
-
clonedWidth.current = originRect.width;
|
|
1655
|
-
clonedHeight.current = originRect.height;
|
|
1656
|
-
}
|
|
1657
|
-
}
|
|
1658
|
-
if (clonedNodeRef.current?.isConnected) {
|
|
1659
|
-
navigator.vibrate(100);
|
|
1660
|
-
clonedNodeRef.current.style.left = `${x - (clonedWidth.current || 0) / 2}px`;
|
|
1661
|
-
clonedNodeRef.current.style.top = `${y - (clonedHeight.current || 0) / 2}px`;
|
|
1662
|
-
}
|
|
1663
|
-
dragState.next({
|
|
1664
|
-
isDragging: true,
|
|
1665
|
-
isDrop: false,
|
|
1666
|
-
navigationTitle,
|
|
1667
|
-
children: targetComponent,
|
|
1668
|
-
x,
|
|
1669
|
-
y,
|
|
1670
|
-
containerName,
|
|
1671
|
-
dropDocumentOutsideOption,
|
|
1672
|
-
customData
|
|
1673
|
-
});
|
|
1674
|
-
}
|
|
1675
|
-
});
|
|
1676
|
-
},
|
|
1677
|
-
style: { ...style },
|
|
1678
|
-
...props,
|
|
1679
|
-
children
|
|
1680
|
-
}
|
|
1681
|
-
) });
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1684
|
-
// src/flex-layout/styles/listScroll.module.css
|
|
1685
|
-
var listScroll_default = {};
|
|
1686
|
-
var FlexLayoutSplitScreenScrollBox = ({
|
|
1687
|
-
className,
|
|
1688
|
-
children,
|
|
1689
|
-
keyName,
|
|
1690
|
-
direction,
|
|
1691
|
-
isDefaultScrollStyle = false,
|
|
1692
|
-
...props
|
|
1693
|
-
}) => {
|
|
1694
|
-
const scrollRef = useRef(null);
|
|
1695
|
-
const [isMouseDown, setIsMouseDown] = useState(false);
|
|
1696
|
-
const scrollEventSubject = useRef(new Subject());
|
|
1697
|
-
useEffect(() => {
|
|
1698
|
-
const mouseUpSubscribe = fromEvent(
|
|
1699
|
-
window,
|
|
1700
|
-
"mouseup"
|
|
1701
|
-
).subscribe(() => {
|
|
1702
|
-
setIsMouseDown(false);
|
|
1703
|
-
});
|
|
1704
|
-
const scrollEventSubscribe = scrollEventSubject.current.pipe(throttleTime(70)).subscribe((position) => {
|
|
1705
|
-
setScrollPosition(keyName, position);
|
|
1706
|
-
});
|
|
1707
|
-
const scrollSubscribe = getScrollPosition(keyName).pipe(take(1)).subscribe((position) => {
|
|
1708
|
-
if (scrollRef.current && position) {
|
|
1709
|
-
scrollRef.current.scrollLeft = position.x;
|
|
1710
|
-
scrollRef.current.scrollTop = position.y;
|
|
1711
|
-
}
|
|
1712
|
-
});
|
|
1713
|
-
return () => {
|
|
1714
|
-
removeScrollPosition(keyName);
|
|
1715
|
-
mouseUpSubscribe.unsubscribe();
|
|
1716
|
-
scrollSubscribe.unsubscribe();
|
|
1717
|
-
scrollEventSubscribe.unsubscribe();
|
|
1718
|
-
};
|
|
1719
|
-
}, [keyName]);
|
|
1720
|
-
useEffect(() => {
|
|
1721
|
-
if (!scrollRef.current) return;
|
|
1722
|
-
let animationFrameId = null;
|
|
1723
|
-
const handleWheel = (event) => {
|
|
1724
|
-
if (!scrollRef.current || direction !== "x") return;
|
|
1725
|
-
if (scrollRef.current.matches(":hover")) {
|
|
1726
|
-
event.preventDefault();
|
|
1727
|
-
const { deltaY } = event;
|
|
1728
|
-
const newScrollLeft = scrollRef.current.scrollLeft + deltaY;
|
|
1729
|
-
if (animationFrameId) {
|
|
1730
|
-
cancelAnimationFrame(animationFrameId);
|
|
1731
|
-
}
|
|
1732
|
-
animationFrameId = requestAnimationFrame(() => {
|
|
1733
|
-
scrollRef.current.scrollLeft = newScrollLeft;
|
|
1734
|
-
scrollEventSubject.current.next({
|
|
1735
|
-
x: newScrollLeft,
|
|
1736
|
-
y: scrollRef.current.scrollTop
|
|
1737
|
-
});
|
|
1738
|
-
animationFrameId = null;
|
|
1739
|
-
});
|
|
1740
|
-
}
|
|
1741
|
-
};
|
|
1742
|
-
scrollRef.current.addEventListener("wheel", handleWheel, {
|
|
1743
|
-
passive: false
|
|
1744
|
-
});
|
|
1745
|
-
return () => {
|
|
1746
|
-
scrollRef.current?.removeEventListener("wheel", handleWheel);
|
|
1747
|
-
};
|
|
1748
|
-
}, []);
|
|
1749
|
-
return /* @__PURE__ */ jsx(
|
|
1750
|
-
"div",
|
|
1751
|
-
{
|
|
1752
|
-
ref: scrollRef,
|
|
1753
|
-
onMouseUp: () => setIsMouseDown(false),
|
|
1754
|
-
onMouseDown: () => setIsMouseDown(true),
|
|
1755
|
-
onMouseMove: (event) => {
|
|
1756
|
-
if (!scrollRef.current || !isMouseDown || direction !== "x")
|
|
1757
|
-
return;
|
|
1758
|
-
scrollRef.current.scrollLeft += event.movementX * -1;
|
|
1759
|
-
scrollEventSubject.current.next({
|
|
1760
|
-
x: scrollRef.current.scrollLeft,
|
|
1761
|
-
y: scrollRef.current.scrollTop
|
|
1762
|
-
});
|
|
1763
|
-
},
|
|
1764
|
-
onScroll: () => {
|
|
1765
|
-
if (!scrollRef.current) return;
|
|
1766
|
-
scrollEventSubject.current.next({
|
|
1767
|
-
x: scrollRef.current.scrollLeft,
|
|
1768
|
-
y: scrollRef.current.scrollTop
|
|
1769
|
-
});
|
|
1770
|
-
},
|
|
1771
|
-
className: `${className || ""} ${isDefaultScrollStyle ? listScroll_default["default-scroll"] : listScroll_default["list-scroll"]} ${direction ? listScroll_default[direction] : ""}`,
|
|
1772
|
-
...props,
|
|
1773
|
-
children
|
|
1774
|
-
}
|
|
1775
|
-
);
|
|
1776
|
-
};
|
|
1777
|
-
var FlexLayoutSplitScreenScrollBox_default = memo(FlexLayoutSplitScreenScrollBox);
|
|
1778
|
-
function FlexLayoutSplitScreenDragBoxContainer({
|
|
1779
|
-
className,
|
|
1780
|
-
children,
|
|
1781
|
-
layoutName,
|
|
1782
|
-
...props
|
|
1783
|
-
}) {
|
|
1784
|
-
return /* @__PURE__ */ jsx(
|
|
1785
|
-
FlexLayoutSplitScreenScrollBox_default,
|
|
1786
|
-
{
|
|
1787
|
-
keyName: layoutName,
|
|
1788
|
-
className: `${FlexLayout_default["flex-split-screen-drag-box-title-container"]} ${className && className !== "" && className || ""}`,
|
|
1789
|
-
direction: "x",
|
|
1790
|
-
...props,
|
|
1791
|
-
children
|
|
1792
|
-
}
|
|
1793
|
-
);
|
|
1794
|
-
}
|
|
1795
|
-
function FlexLayoutSplitScreenDragBoxItem({
|
|
1796
|
-
children,
|
|
1797
|
-
onClose,
|
|
1798
|
-
isActive,
|
|
1799
|
-
...props
|
|
1800
|
-
}) {
|
|
1801
|
-
useEffect(() => {
|
|
1802
|
-
allSplitScreenCount.next(allSplitScreenCount.value + 1);
|
|
1803
|
-
return () => {
|
|
1804
|
-
if (allSplitScreenCount.value <= 1) return;
|
|
1805
|
-
allSplitScreenCount.next(allSplitScreenCount.value - 1);
|
|
1806
|
-
};
|
|
1807
|
-
}, []);
|
|
1808
|
-
return /* @__PURE__ */ jsxs(
|
|
1809
|
-
"div",
|
|
1810
|
-
{
|
|
1811
|
-
className: `${FlexLayout_default["flex-split-screen-drag-box-title-item"]} ${isActive ? FlexLayout_default["active"] : ""}`,
|
|
1812
|
-
...props,
|
|
1813
|
-
children: [
|
|
1814
|
-
children,
|
|
1815
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: (ev) => onClose(ev), children: "X" })
|
|
1816
|
-
]
|
|
1817
|
-
}
|
|
1818
|
-
);
|
|
1819
|
-
}
|
|
1820
|
-
function FlexLayoutSplitScreenDragBoxTitleMore({
|
|
1821
|
-
className,
|
|
1822
|
-
...props
|
|
1823
|
-
}) {
|
|
1824
|
-
return /* @__PURE__ */ jsxs(
|
|
1825
|
-
"button",
|
|
1826
|
-
{
|
|
1827
|
-
...props,
|
|
1828
|
-
className: `${FlexLayout_default["flex-split-screen-drag-box-title-more"]} ${className || ""}`,
|
|
1829
|
-
children: [
|
|
1830
|
-
/* @__PURE__ */ jsx("span", { children: "." }),
|
|
1831
|
-
/* @__PURE__ */ jsx("span", { children: "." }),
|
|
1832
|
-
/* @__PURE__ */ jsx("span", { children: "." })
|
|
1833
|
-
]
|
|
1834
|
-
}
|
|
1835
|
-
);
|
|
1836
|
-
}
|
|
1837
|
-
function isOverDrop({
|
|
1838
|
-
x,
|
|
1839
|
-
y,
|
|
1840
|
-
element
|
|
1841
|
-
}) {
|
|
1842
|
-
const {
|
|
1843
|
-
x: elementX,
|
|
1844
|
-
y: elementY,
|
|
1845
|
-
right: elementRight,
|
|
1846
|
-
bottom: elementBottom
|
|
1847
|
-
} = element.getBoundingClientRect();
|
|
1848
|
-
const isElementOver = x < elementX || x > elementRight || y < elementY || y > elementBottom;
|
|
1849
|
-
return isElementOver;
|
|
1850
|
-
}
|
|
1851
|
-
function isInnerDrop({
|
|
1852
|
-
x,
|
|
1853
|
-
y,
|
|
1854
|
-
element
|
|
1855
|
-
}) {
|
|
1856
|
-
const {
|
|
1857
|
-
x: elementX,
|
|
1858
|
-
y: elementY,
|
|
1859
|
-
right: elementRight,
|
|
1860
|
-
bottom: elementBottom
|
|
1861
|
-
} = element.getBoundingClientRect();
|
|
1862
|
-
const isElementInner = x >= elementX && x <= elementRight && y >= elementY && y <= elementBottom;
|
|
1863
|
-
return isElementInner;
|
|
1864
|
-
}
|
|
1865
|
-
var handleUpdateDropTargetComponents = ({
|
|
1866
|
-
orderName,
|
|
1867
|
-
parentOrderName,
|
|
1868
|
-
containerName,
|
|
1869
|
-
parentLayoutName,
|
|
1870
|
-
layoutName,
|
|
1871
|
-
dropComponent,
|
|
1872
|
-
navigationTitle,
|
|
1873
|
-
nextContainerName,
|
|
1874
|
-
isUsePrefix = true,
|
|
1875
|
-
beforeDropTargetComponent,
|
|
1876
|
-
afterDropTargetComponent,
|
|
1877
|
-
centerDropTargetComponent,
|
|
1878
|
-
dropDocumentOutsideOption,
|
|
1879
|
-
screenKey = Array.from(
|
|
1880
|
-
window.crypto.getRandomValues(new Uint32Array(16)),
|
|
1881
|
-
(e) => e.toString(32).padStart(2, "0")
|
|
1882
|
-
).join("")
|
|
1883
|
-
}) => {
|
|
1884
|
-
const nextContainerNameOrderName = parentOrderName ? parentOrderName : orderName;
|
|
1885
|
-
let listMap;
|
|
1886
|
-
let list;
|
|
1887
|
-
let key;
|
|
1888
|
-
if (nextContainerNameOrderName === orderName || nextContainerNameOrderName === "center") {
|
|
1889
|
-
listMap = orderName === "before" ? { beforeDropTargetComponent } : orderName === "after" ? { afterDropTargetComponent } : {
|
|
1890
|
-
centerDropTargetComponent: centerDropTargetComponent.filter(
|
|
1891
|
-
(e) => !e.containerName.split("_").at(0).startsWith(
|
|
1892
|
-
containerName.split("_").at(0)
|
|
1893
|
-
)
|
|
1894
|
-
)
|
|
1895
|
-
};
|
|
1896
|
-
} else {
|
|
1897
|
-
listMap = nextContainerNameOrderName === "before" ? { beforeDropTargetComponent } : { afterDropTargetComponent };
|
|
1898
|
-
}
|
|
1899
|
-
const entries = Object.entries(listMap)[0];
|
|
1900
|
-
key = entries[0];
|
|
1901
|
-
list = entries[1];
|
|
1902
|
-
const newComponent = {
|
|
1903
|
-
containerName: `${containerName + "_" + layoutName}${isUsePrefix ? "_" + orderName + "-" + list.length : ""}`,
|
|
1904
|
-
component: cloneElement(
|
|
1905
|
-
dropComponent,
|
|
1906
|
-
{ key: screenKey, screenKey }
|
|
1907
|
-
),
|
|
1908
|
-
navigationTitle,
|
|
1909
|
-
dropDocumentOutsideOption,
|
|
1910
|
-
screenKey: screenKey || Array.from(
|
|
1911
|
-
window.crypto.getRandomValues(new Uint32Array(16)),
|
|
1912
|
-
(e) => e.toString(32).padStart(2, "0")
|
|
1913
|
-
).join("")
|
|
1914
|
-
};
|
|
1915
|
-
let allComponents;
|
|
1916
|
-
if (nextContainerName) {
|
|
1917
|
-
const index = list.findIndex(
|
|
1918
|
-
(item) => item.containerName === nextContainerName
|
|
1919
|
-
);
|
|
1920
|
-
if (index !== -1) {
|
|
1921
|
-
if (nextContainerNameOrderName === orderName) {
|
|
1922
|
-
if (orderName === "before") {
|
|
1923
|
-
allComponents = [
|
|
1924
|
-
...list.slice(0, index),
|
|
1925
|
-
newComponent,
|
|
1926
|
-
...list.slice(index)
|
|
1927
|
-
];
|
|
1928
|
-
} else {
|
|
1929
|
-
allComponents = [
|
|
1930
|
-
...list.slice(0, index + 1),
|
|
1931
|
-
newComponent,
|
|
1932
|
-
...list.slice(index + 1)
|
|
1933
|
-
];
|
|
1934
|
-
}
|
|
1935
|
-
} else {
|
|
1936
|
-
if (nextContainerNameOrderName === "after" && orderName === "before") {
|
|
1937
|
-
allComponents = [
|
|
1938
|
-
...list.slice(0, index),
|
|
1939
|
-
newComponent,
|
|
1940
|
-
...list.slice(index)
|
|
1941
|
-
];
|
|
1942
|
-
} else if (nextContainerNameOrderName === "before" && orderName === "after") {
|
|
1943
|
-
allComponents = [
|
|
1944
|
-
...list.slice(0, index + 1),
|
|
1945
|
-
newComponent,
|
|
1946
|
-
...list.slice(index + 1)
|
|
1947
|
-
];
|
|
1948
|
-
} else {
|
|
1949
|
-
if (orderName === "before") {
|
|
1950
|
-
allComponents = [
|
|
1951
|
-
...list.slice(0, index),
|
|
1952
|
-
newComponent,
|
|
1953
|
-
...list.slice(index)
|
|
1954
|
-
];
|
|
1955
|
-
} else {
|
|
1956
|
-
allComponents = [
|
|
1957
|
-
...list.slice(0, index + 1),
|
|
1958
|
-
newComponent,
|
|
1959
|
-
...list.slice(index + 1)
|
|
1960
|
-
];
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
}
|
|
1964
|
-
} else {
|
|
1965
|
-
if (nextContainerNameOrderName === "center" && orderName === "after") {
|
|
1966
|
-
allComponents = [newComponent, ...list];
|
|
1967
|
-
} else if (nextContainerNameOrderName === "center" && orderName === "before") {
|
|
1968
|
-
allComponents = [...list, newComponent];
|
|
1969
|
-
} else {
|
|
1970
|
-
allComponents = orderName === "before" ? [newComponent, ...list] : [...list, newComponent];
|
|
1971
|
-
}
|
|
1972
|
-
}
|
|
1973
|
-
} else {
|
|
1974
|
-
allComponents = orderName === "before" ? [newComponent, ...list] : [...list, newComponent];
|
|
1975
|
-
}
|
|
1976
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1977
|
-
const result = allComponents.filter((item) => {
|
|
1978
|
-
if (seen.has(item.containerName)) {
|
|
1979
|
-
return false;
|
|
1980
|
-
}
|
|
1981
|
-
seen.add(item.containerName);
|
|
1982
|
-
return true;
|
|
1983
|
-
});
|
|
1984
|
-
dropMovementEventSubject.next({
|
|
1985
|
-
state: "append",
|
|
1986
|
-
targetParentLayoutName: parentLayoutName,
|
|
1987
|
-
targetLayoutName: layoutName,
|
|
1988
|
-
targetContainerName: containerName,
|
|
1989
|
-
orderName
|
|
1990
|
-
});
|
|
1991
|
-
return { [key]: result };
|
|
1992
|
-
};
|
|
1993
|
-
var handleRemove = (list, targetContainerName, orderNameSetter) => {
|
|
1994
|
-
const result = list.filter((e) => e.containerName !== targetContainerName);
|
|
1995
|
-
if (result.length != list.length)
|
|
1996
|
-
orderNameSetter(list.length - result.length);
|
|
1997
|
-
return result;
|
|
1998
|
-
};
|
|
1999
|
-
function getAdjacentItem(items, currentIndex) {
|
|
2000
|
-
if (currentIndex + 1 < items.length) {
|
|
2001
|
-
return {
|
|
2002
|
-
adjacentItem: items[currentIndex + 1],
|
|
2003
|
-
adjacentIndex: currentIndex + 1
|
|
2004
|
-
};
|
|
2005
|
-
} else if (currentIndex - 1 >= 0) {
|
|
2006
|
-
return {
|
|
2007
|
-
adjacentItem: items[currentIndex - 1],
|
|
2008
|
-
adjacentIndex: currentIndex - 1
|
|
2009
|
-
};
|
|
2010
|
-
}
|
|
2011
|
-
return { adjacentItem: null, adjacentIndex: currentIndex };
|
|
2012
|
-
}
|
|
2013
|
-
var getSelfOrderName = (containerName) => {
|
|
2014
|
-
const result = containerName.split("_").at(-1)?.split("-").at(0)?.split("=").at(0);
|
|
2015
|
-
if (["before", "center", "after"].some((e) => e === result)) {
|
|
2016
|
-
return result;
|
|
2017
|
-
} else {
|
|
2018
|
-
return;
|
|
2019
|
-
}
|
|
2020
|
-
};
|
|
2021
|
-
function FlexLayoutSplitScreen({
|
|
2022
|
-
children,
|
|
2023
|
-
containerName,
|
|
2024
|
-
layoutName,
|
|
2025
|
-
navigationTitle,
|
|
2026
|
-
dropDocumentOutsideOption,
|
|
2027
|
-
screenKey
|
|
2028
|
-
}) {
|
|
2029
|
-
const {
|
|
2030
|
-
direction,
|
|
2031
|
-
isSplit,
|
|
2032
|
-
boundaryContainerSize,
|
|
2033
|
-
afterDropTargetComponent,
|
|
2034
|
-
beforeDropTargetComponent,
|
|
2035
|
-
centerDropTargetComponent,
|
|
2036
|
-
setAfterDropTargetComponent,
|
|
2037
|
-
setBeforeDropTargetComponent,
|
|
2038
|
-
setCenterDropTargetComponent,
|
|
2039
|
-
layoutRef,
|
|
2040
|
-
setIsSplit,
|
|
2041
|
-
setDirection
|
|
2042
|
-
} = useFlexLayoutSplitScreen({
|
|
2043
|
-
isSplitInitial: false,
|
|
2044
|
-
directionInitial: "row",
|
|
2045
|
-
selfContainerName: containerName,
|
|
2046
|
-
parentLayoutName: "",
|
|
2047
|
-
layoutName
|
|
2048
|
-
});
|
|
2049
|
-
useEffect(() => {
|
|
2050
|
-
resetRootSplitScreen(layoutName);
|
|
2051
|
-
const subscribe = getSplitScreen(layoutName, layoutName).subscribe((layoutInfo) => {
|
|
2052
|
-
if (layoutInfo) {
|
|
2053
|
-
setBeforeDropTargetComponent([
|
|
2054
|
-
...layoutInfo.beforeDropTargetComponent
|
|
2055
|
-
]);
|
|
2056
|
-
setAfterDropTargetComponent([
|
|
2057
|
-
...layoutInfo.afterDropTargetComponent
|
|
2058
|
-
]);
|
|
2059
|
-
setCenterDropTargetComponent([
|
|
2060
|
-
...layoutInfo.centerDropTargetComponent
|
|
2061
|
-
]);
|
|
2062
|
-
setDirection(layoutInfo.direction);
|
|
2063
|
-
if (layoutInfo.beforeDropTargetComponent.length !== 0 || layoutInfo.afterDropTargetComponent.length !== 0) {
|
|
2064
|
-
setIsSplit(true);
|
|
2065
|
-
}
|
|
2066
|
-
} else {
|
|
2067
|
-
setSplitScreen(layoutName, layoutName, {
|
|
2068
|
-
afterDropTargetComponent: [],
|
|
2069
|
-
beforeDropTargetComponent: [],
|
|
2070
|
-
centerDropTargetComponent: [
|
|
2071
|
-
{
|
|
2072
|
-
containerName,
|
|
2073
|
-
component: children,
|
|
2074
|
-
navigationTitle,
|
|
2075
|
-
dropDocumentOutsideOption,
|
|
2076
|
-
screenKey: screenKey ? screenKey : Array.from(
|
|
2077
|
-
window.crypto.getRandomValues(
|
|
2078
|
-
new Uint32Array(16)
|
|
2079
|
-
),
|
|
2080
|
-
(e) => e.toString(32).padStart(2, "0")
|
|
2081
|
-
).join("")
|
|
2082
|
-
}
|
|
2083
|
-
],
|
|
2084
|
-
direction
|
|
2085
|
-
});
|
|
2086
|
-
}
|
|
2087
|
-
});
|
|
2088
|
-
return () => {
|
|
2089
|
-
subscribe.unsubscribe();
|
|
2090
|
-
resetRootSplitScreen(layoutName);
|
|
2091
|
-
};
|
|
2092
|
-
}, [layoutName]);
|
|
2093
|
-
useEffect(() => {
|
|
2094
|
-
const subscribe = dropMovementEventSubject.pipe(
|
|
2095
|
-
distinctUntilChanged$1((prev, curr) => {
|
|
2096
|
-
const filterChildren2 = (obj) => {
|
|
2097
|
-
const {
|
|
2098
|
-
children: children2,
|
|
2099
|
-
component,
|
|
2100
|
-
targetComponent,
|
|
2101
|
-
x,
|
|
2102
|
-
y,
|
|
2103
|
-
...rest
|
|
2104
|
-
} = obj || {};
|
|
2105
|
-
return rest;
|
|
2106
|
-
};
|
|
2107
|
-
return equal(filterChildren2(prev), filterChildren2(curr));
|
|
2108
|
-
})
|
|
2109
|
-
).subscribe((event) => {
|
|
2110
|
-
if (event.state === "remove") {
|
|
2111
|
-
if (event.targetParentLayoutName === layoutName || event.targetParentLayoutName === "" && event.targetLayoutName === layoutName) {
|
|
2112
|
-
requestAnimationFrame(() => {
|
|
2113
|
-
let removeCallback = (removeOrderName) => {
|
|
2114
|
-
if (event.nextContainerName && event.dropTargetComponentEvent && event.targetComponent) {
|
|
2115
|
-
const targetComponentsMap = handleUpdateDropTargetComponents({
|
|
2116
|
-
orderName: removeOrderName,
|
|
2117
|
-
containerName: event.nextContainerName,
|
|
2118
|
-
parentLayoutName: "",
|
|
2119
|
-
layoutName,
|
|
2120
|
-
dropComponent: event.targetComponent,
|
|
2121
|
-
navigationTitle: event.dropTargetComponentEvent.navigationTitle,
|
|
2122
|
-
isUsePrefix: true,
|
|
2123
|
-
afterDropTargetComponent,
|
|
2124
|
-
beforeDropTargetComponent,
|
|
2125
|
-
centerDropTargetComponent,
|
|
2126
|
-
dropDocumentOutsideOption,
|
|
2127
|
-
screenKey: event.dropTargetComponentEvent.screenKey
|
|
2128
|
-
});
|
|
2129
|
-
setSplitScreen(layoutName, layoutName, {
|
|
2130
|
-
...getCurrentSplitScreenComponents(
|
|
2131
|
-
layoutName,
|
|
2132
|
-
layoutName
|
|
2133
|
-
) || {
|
|
2134
|
-
afterDropTargetComponent,
|
|
2135
|
-
beforeDropTargetComponent,
|
|
2136
|
-
centerDropTargetComponent,
|
|
2137
|
-
direction
|
|
2138
|
-
},
|
|
2139
|
-
...targetComponentsMap
|
|
2140
|
-
});
|
|
2141
|
-
Promise.resolve().then(
|
|
2142
|
-
() => event.dropEndCallback && event.dropEndCallback({
|
|
2143
|
-
x: event.x,
|
|
2144
|
-
y: event.y,
|
|
2145
|
-
containerName
|
|
2146
|
-
})
|
|
2147
|
-
);
|
|
2148
|
-
}
|
|
2149
|
-
};
|
|
2150
|
-
const currentComponents = getCurrentSplitScreenComponents(
|
|
2151
|
-
layoutName,
|
|
2152
|
-
layoutName
|
|
2153
|
-
);
|
|
2154
|
-
const afterList = handleRemove(
|
|
2155
|
-
currentComponents?.afterDropTargetComponent || afterDropTargetComponent,
|
|
2156
|
-
event.targetContainerName,
|
|
2157
|
-
() => removeCallback("after")
|
|
2158
|
-
);
|
|
2159
|
-
const beforList = handleRemove(
|
|
2160
|
-
currentComponents?.beforeDropTargetComponent || beforeDropTargetComponent,
|
|
2161
|
-
event.targetContainerName,
|
|
2162
|
-
() => removeCallback("before")
|
|
2163
|
-
);
|
|
2164
|
-
const centerList = handleRemove(
|
|
2165
|
-
currentComponents?.centerDropTargetComponent || centerDropTargetComponent,
|
|
2166
|
-
event.targetContainerName,
|
|
2167
|
-
() => removeCallback("center")
|
|
2168
|
-
);
|
|
2169
|
-
setSplitScreen(layoutName, layoutName, {
|
|
2170
|
-
afterDropTargetComponent: afterList,
|
|
2171
|
-
beforeDropTargetComponent: beforList,
|
|
2172
|
-
centerDropTargetComponent: centerList,
|
|
2173
|
-
direction
|
|
2174
|
-
});
|
|
2175
|
-
});
|
|
2176
|
-
}
|
|
2177
|
-
} else if (event.state === "append") {
|
|
2178
|
-
const {
|
|
2179
|
-
x,
|
|
2180
|
-
y,
|
|
2181
|
-
dropEndCallback,
|
|
2182
|
-
dropTargetComponentEvent,
|
|
2183
|
-
orderName,
|
|
2184
|
-
parentOrderName,
|
|
2185
|
-
targetLayoutName,
|
|
2186
|
-
targetParentLayoutName,
|
|
2187
|
-
targetContainerName,
|
|
2188
|
-
targetComponent,
|
|
2189
|
-
nextContainerName
|
|
2190
|
-
} = event;
|
|
2191
|
-
if (layoutRef.current && orderName && x && y && targetComponent && dropTargetComponentEvent && targetLayoutName === layoutName && isInnerDrop({ x, y, element: layoutRef.current })) {
|
|
2192
|
-
const {
|
|
2193
|
-
direction: dropDirection,
|
|
2194
|
-
navigationTitle: navigationTitle2,
|
|
2195
|
-
dropDocumentOutsideOption: dropDocumentOutsideOption2
|
|
2196
|
-
} = dropTargetComponentEvent;
|
|
2197
|
-
const isOrderNameNotCenter = orderName !== "center";
|
|
2198
|
-
const isOrderNameCenterAndFirstScreen = orderName === "center" && centerDropTargetComponent.length <= 1;
|
|
2199
|
-
if (isOrderNameNotCenter || isOrderNameCenterAndFirstScreen) {
|
|
2200
|
-
setIsSplit(true);
|
|
2201
|
-
if (isOrderNameNotCenter) {
|
|
2202
|
-
setDirection(dropDirection);
|
|
2203
|
-
const targetComponentsMap = handleUpdateDropTargetComponents({
|
|
2204
|
-
orderName,
|
|
2205
|
-
parentOrderName,
|
|
2206
|
-
containerName: targetContainerName,
|
|
2207
|
-
nextContainerName,
|
|
2208
|
-
dropComponent: targetComponent,
|
|
2209
|
-
parentLayoutName: "",
|
|
2210
|
-
layoutName,
|
|
2211
|
-
navigationTitle: navigationTitle2,
|
|
2212
|
-
isUsePrefix: true,
|
|
2213
|
-
afterDropTargetComponent,
|
|
2214
|
-
beforeDropTargetComponent,
|
|
2215
|
-
centerDropTargetComponent,
|
|
2216
|
-
dropDocumentOutsideOption: dropDocumentOutsideOption2
|
|
2217
|
-
});
|
|
2218
|
-
setSplitScreen(layoutName, layoutName, {
|
|
2219
|
-
...{
|
|
2220
|
-
afterDropTargetComponent,
|
|
2221
|
-
beforeDropTargetComponent,
|
|
2222
|
-
centerDropTargetComponent,
|
|
2223
|
-
direction: dropDirection
|
|
2224
|
-
},
|
|
2225
|
-
...targetComponentsMap,
|
|
2226
|
-
...{ direction: dropDirection }
|
|
2227
|
-
});
|
|
2228
|
-
Promise.resolve().then(
|
|
2229
|
-
() => dropEndCallback && dropEndCallback({
|
|
2230
|
-
x: event.x,
|
|
2231
|
-
y: event.y,
|
|
2232
|
-
containerName
|
|
2233
|
-
})
|
|
2234
|
-
);
|
|
2235
|
-
} else {
|
|
2236
|
-
const childScreenInfo = getCurrentSplitScreenComponents(
|
|
2237
|
-
layoutName,
|
|
2238
|
-
`${layoutName}_center=${centerDropTargetComponent[0].screenKey}`
|
|
2239
|
-
) || {
|
|
2240
|
-
afterDropTargetComponent: [],
|
|
2241
|
-
beforeDropTargetComponent: [],
|
|
2242
|
-
centerDropTargetComponent: [],
|
|
2243
|
-
direction
|
|
2244
|
-
};
|
|
2245
|
-
setSplitScreen(
|
|
2246
|
-
layoutName,
|
|
2247
|
-
`${layoutName}_center=${centerDropTargetComponent[0].screenKey}`,
|
|
2248
|
-
{
|
|
2249
|
-
...childScreenInfo,
|
|
2250
|
-
...{
|
|
2251
|
-
centerDropTargetComponent: [
|
|
2252
|
-
centerDropTargetComponent[0],
|
|
2253
|
-
{
|
|
2254
|
-
containerName: `${targetContainerName}_${layoutName}_${orderName}`,
|
|
2255
|
-
component: targetComponent,
|
|
2256
|
-
dropDocumentOutsideOption: dropDocumentOutsideOption2,
|
|
2257
|
-
screenKey: centerDropTargetComponent[0].screenKey,
|
|
2258
|
-
navigationTitle: navigationTitle2
|
|
2259
|
-
}
|
|
2260
|
-
]
|
|
2261
|
-
}
|
|
2262
|
-
}
|
|
2263
|
-
);
|
|
2264
|
-
}
|
|
2265
|
-
}
|
|
2266
|
-
}
|
|
2267
|
-
}
|
|
2268
|
-
});
|
|
2269
|
-
return () => {
|
|
2270
|
-
subscribe.unsubscribe();
|
|
2271
|
-
};
|
|
2272
|
-
}, [
|
|
2273
|
-
direction,
|
|
2274
|
-
layoutName,
|
|
2275
|
-
isSplit,
|
|
2276
|
-
beforeDropTargetComponent,
|
|
2277
|
-
afterDropTargetComponent,
|
|
2278
|
-
centerDropTargetComponent
|
|
2279
|
-
]);
|
|
2280
|
-
return /* @__PURE__ */ jsxs("div", { className: `${FlexLayout_default["flex-split-screen"]}`, ref: layoutRef, children: [
|
|
2281
|
-
/* @__PURE__ */ jsxs(
|
|
2282
|
-
FlexLayout_default2,
|
|
2283
|
-
{
|
|
2284
|
-
direction,
|
|
2285
|
-
layoutName,
|
|
2286
|
-
"data-is_split": isSplit,
|
|
2287
|
-
panelMovementMode: "bulldozer",
|
|
2288
|
-
children: [
|
|
2289
|
-
beforeDropTargetComponent.length != 0 ? /* @__PURE__ */ jsx(Fragment, { children: beforeDropTargetComponent.map(
|
|
2290
|
-
({
|
|
2291
|
-
containerName: cName,
|
|
2292
|
-
component,
|
|
2293
|
-
navigationTitle: navigationTitle2,
|
|
2294
|
-
dropDocumentOutsideOption: dropDocumentOutsideOption2,
|
|
2295
|
-
screenKey: screenKey2
|
|
2296
|
-
}, i) => /* @__PURE__ */ jsx(
|
|
2297
|
-
FlexLayoutContainer_default,
|
|
2298
|
-
{
|
|
2299
|
-
containerName: cName,
|
|
2300
|
-
isInitialResizable: true,
|
|
2301
|
-
isResizePanel: true,
|
|
2302
|
-
children: /* @__PURE__ */ jsx(
|
|
2303
|
-
FlexLayoutSplitScreenChild,
|
|
2304
|
-
{
|
|
2305
|
-
parentDirection: direction,
|
|
2306
|
-
layoutName: `${layoutName}_before`,
|
|
2307
|
-
parentLayoutName: layoutName,
|
|
2308
|
-
containerName: cName,
|
|
2309
|
-
depth: 1,
|
|
2310
|
-
rootRef: layoutRef,
|
|
2311
|
-
screenKey: screenKey2,
|
|
2312
|
-
initialCenterComponents: [
|
|
2313
|
-
{
|
|
2314
|
-
navigationTitle: navigationTitle2,
|
|
2315
|
-
component,
|
|
2316
|
-
containerName: cName,
|
|
2317
|
-
dropDocumentOutsideOption: dropDocumentOutsideOption2,
|
|
2318
|
-
screenKey: screenKey2
|
|
2319
|
-
}
|
|
2320
|
-
],
|
|
2321
|
-
rootName: layoutName
|
|
2322
|
-
}
|
|
2323
|
-
)
|
|
2324
|
-
},
|
|
2325
|
-
cName
|
|
2326
|
-
)
|
|
2327
|
-
) }) : /* @__PURE__ */ jsx("div", {}),
|
|
2328
|
-
centerDropTargetComponent.length === 0 ? /* @__PURE__ */ jsx("div", {}) : /* @__PURE__ */ jsx(
|
|
2329
|
-
FlexLayoutContainer_default,
|
|
2330
|
-
{
|
|
2331
|
-
containerName: `${centerDropTargetComponent[0].containerName}`,
|
|
2332
|
-
isInitialResizable: true,
|
|
2333
|
-
isResizePanel: isSplit,
|
|
2334
|
-
children: isSplit ? /* @__PURE__ */ jsx(
|
|
2335
|
-
FlexLayoutSplitScreenChild,
|
|
2336
|
-
{
|
|
2337
|
-
parentDirection: direction,
|
|
2338
|
-
layoutName: `${layoutName}_center`,
|
|
2339
|
-
parentLayoutName: layoutName,
|
|
2340
|
-
containerName: `${centerDropTargetComponent[0].containerName}`,
|
|
2341
|
-
depth: 0,
|
|
2342
|
-
rootRef: layoutRef,
|
|
2343
|
-
screenKey: centerDropTargetComponent[0].screenKey,
|
|
2344
|
-
initialCenterComponents: [
|
|
2345
|
-
{
|
|
2346
|
-
navigationTitle: centerDropTargetComponent[0].navigationTitle,
|
|
2347
|
-
component: centerDropTargetComponent[0].component,
|
|
2348
|
-
containerName: centerDropTargetComponent[0].containerName,
|
|
2349
|
-
dropDocumentOutsideOption: centerDropTargetComponent[0].dropDocumentOutsideOption,
|
|
2350
|
-
screenKey: centerDropTargetComponent[0].screenKey
|
|
2351
|
-
}
|
|
2352
|
-
],
|
|
2353
|
-
rootName: layoutName
|
|
2354
|
-
}
|
|
2355
|
-
) : /* @__PURE__ */ jsx(
|
|
2356
|
-
FlexLayoutSplitScreenScrollBox_default,
|
|
2357
|
-
{
|
|
2358
|
-
keyName: centerDropTargetComponent[0].containerName,
|
|
2359
|
-
isDefaultScrollStyle: true,
|
|
2360
|
-
children: centerDropTargetComponent[0].component
|
|
2361
|
-
}
|
|
2362
|
-
)
|
|
2363
|
-
}
|
|
2364
|
-
),
|
|
2365
|
-
afterDropTargetComponent.length != 0 ? /* @__PURE__ */ jsx(Fragment, { children: afterDropTargetComponent.map(
|
|
2366
|
-
({
|
|
2367
|
-
containerName: cName,
|
|
2368
|
-
component,
|
|
2369
|
-
navigationTitle: navigationTitle2,
|
|
2370
|
-
dropDocumentOutsideOption: dropDocumentOutsideOption2,
|
|
2371
|
-
screenKey: screenKey2
|
|
2372
|
-
}, i) => /* @__PURE__ */ jsx(
|
|
2373
|
-
FlexLayoutContainer_default,
|
|
2374
|
-
{
|
|
2375
|
-
containerName: cName,
|
|
2376
|
-
isInitialResizable: true,
|
|
2377
|
-
isResizePanel: afterDropTargetComponent.length - 1 !== i,
|
|
2378
|
-
children: /* @__PURE__ */ jsx(
|
|
2379
|
-
FlexLayoutSplitScreenChild,
|
|
2380
|
-
{
|
|
2381
|
-
parentDirection: direction,
|
|
2382
|
-
layoutName: `${layoutName}_after`,
|
|
2383
|
-
parentLayoutName: layoutName,
|
|
2384
|
-
containerName: cName,
|
|
2385
|
-
depth: 1,
|
|
2386
|
-
rootRef: layoutRef,
|
|
2387
|
-
screenKey: screenKey2,
|
|
2388
|
-
initialCenterComponents: [
|
|
2389
|
-
{
|
|
2390
|
-
navigationTitle: navigationTitle2,
|
|
2391
|
-
component,
|
|
2392
|
-
containerName: cName,
|
|
2393
|
-
dropDocumentOutsideOption: dropDocumentOutsideOption2,
|
|
2394
|
-
screenKey: screenKey2
|
|
2395
|
-
}
|
|
2396
|
-
],
|
|
2397
|
-
rootName: layoutName
|
|
2398
|
-
}
|
|
2399
|
-
)
|
|
2400
|
-
},
|
|
2401
|
-
cName
|
|
2402
|
-
)
|
|
2403
|
-
) }) : /* @__PURE__ */ jsx("div", {})
|
|
2404
|
-
]
|
|
2405
|
-
}
|
|
2406
|
-
),
|
|
2407
|
-
boundaryContainerSize && /* @__PURE__ */ jsx(
|
|
2408
|
-
"div",
|
|
2409
|
-
{
|
|
2410
|
-
className: `${FlexLayout_default["flex-split-screen-boundary-container"]}`,
|
|
2411
|
-
style: { ...boundaryContainerSize },
|
|
2412
|
-
children: "\u2B07\uFE0F\uB4DC\uB86D\uD558\uBA74 \uD654\uBA74\uC774 \uBD84\uD560\uB429\uB2C8\uB2E4."
|
|
2413
|
-
}
|
|
2414
|
-
)
|
|
2415
|
-
] });
|
|
2416
|
-
}
|
|
2417
|
-
function FlexLayoutSplitScreenChild({
|
|
2418
|
-
containerName,
|
|
2419
|
-
layoutName,
|
|
2420
|
-
parentLayoutName,
|
|
2421
|
-
parentDirection,
|
|
2422
|
-
depth,
|
|
2423
|
-
//isSplit: isSplitInitial,
|
|
2424
|
-
rootRef,
|
|
2425
|
-
rootName,
|
|
2426
|
-
initialCenterComponents,
|
|
2427
|
-
screenKey
|
|
2428
|
-
}) {
|
|
2429
|
-
const {
|
|
2430
|
-
direction,
|
|
2431
|
-
isSplit,
|
|
2432
|
-
boundaryContainerSize,
|
|
2433
|
-
afterDropTargetComponent,
|
|
2434
|
-
beforeDropTargetComponent,
|
|
2435
|
-
centerDropTargetComponent,
|
|
2436
|
-
setAfterDropTargetComponent,
|
|
2437
|
-
setBeforeDropTargetComponent,
|
|
2438
|
-
setCenterDropTargetComponent,
|
|
2439
|
-
layoutRef,
|
|
2440
|
-
setIsSplit,
|
|
2441
|
-
setDirection
|
|
2442
|
-
} = useFlexLayoutSplitScreen({
|
|
2443
|
-
isSplitInitial: false,
|
|
2444
|
-
directionInitial: "row",
|
|
2445
|
-
parentDirection,
|
|
2446
|
-
selfContainerName: containerName,
|
|
2447
|
-
parentLayoutName,
|
|
2448
|
-
layoutName
|
|
2449
|
-
});
|
|
2450
|
-
const [isEmptyContent, setIsEmptyContent] = useState(false);
|
|
2451
|
-
const [activeIndex, setActiveIndex] = useState(0);
|
|
2452
|
-
const centerDropTargetComponentRef = useRef(centerDropTargetComponent);
|
|
2453
|
-
const activeIndexRef = useRef(activeIndex);
|
|
2454
|
-
useEffect(() => {
|
|
2455
|
-
const subscribe = getSplitScreen(rootName, `${layoutName}=${screenKey}`).pipe(take$1(1)).subscribe((layoutInfo) => {
|
|
2456
|
-
setSplitScreen(rootName, `${layoutName}=${screenKey}`, {
|
|
2457
|
-
afterDropTargetComponent: layoutInfo?.afterDropTargetComponent || [],
|
|
2458
|
-
beforeDropTargetComponent: layoutInfo?.beforeDropTargetComponent || [],
|
|
2459
|
-
centerDropTargetComponent: layoutInfo?.centerDropTargetComponent || initialCenterComponents || [],
|
|
2460
|
-
direction: layoutInfo?.direction || direction
|
|
2461
|
-
});
|
|
2462
|
-
});
|
|
2463
|
-
return () => {
|
|
2464
|
-
removeSplitScreenChild(rootName, layoutName);
|
|
2465
|
-
subscribe.unsubscribe();
|
|
2466
|
-
};
|
|
2467
|
-
}, [rootName, layoutName, initialCenterComponents]);
|
|
2468
|
-
useEffect(() => {
|
|
2469
|
-
const subscribe = getSplitScreen(rootName, `${layoutName}=${screenKey}`).subscribe((layoutInfo) => {
|
|
2470
|
-
if (layoutInfo) {
|
|
2471
|
-
setBeforeDropTargetComponent([
|
|
2472
|
-
...layoutInfo.beforeDropTargetComponent
|
|
2473
|
-
]);
|
|
2474
|
-
setAfterDropTargetComponent([
|
|
2475
|
-
...layoutInfo.afterDropTargetComponent
|
|
2476
|
-
]);
|
|
2477
|
-
setCenterDropTargetComponent([
|
|
2478
|
-
...layoutInfo.centerDropTargetComponent
|
|
2479
|
-
]);
|
|
2480
|
-
setDirection(layoutInfo.direction);
|
|
2481
|
-
if (layoutInfo.beforeDropTargetComponent.length !== 0 || layoutInfo.afterDropTargetComponent.length !== 0) {
|
|
2482
|
-
setIsSplit(true);
|
|
2483
|
-
} else if (layoutInfo.beforeDropTargetComponent.length === 0 && layoutInfo.centerDropTargetComponent.length === 0 && layoutInfo.afterDropTargetComponent.length === 0) {
|
|
2484
|
-
dropMovementEventSubject.next({
|
|
2485
|
-
state: "remove",
|
|
2486
|
-
targetContainerName: containerName,
|
|
2487
|
-
targetParentLayoutName: "",
|
|
2488
|
-
targetLayoutName: parentLayoutName
|
|
2489
|
-
});
|
|
2490
|
-
setIsEmptyContent(true);
|
|
2491
|
-
}
|
|
2492
|
-
}
|
|
2493
|
-
});
|
|
2494
|
-
return () => {
|
|
2495
|
-
subscribe.unsubscribe();
|
|
2496
|
-
};
|
|
2497
|
-
}, [rootName, layoutName]);
|
|
2498
|
-
useEffect(() => {
|
|
2499
|
-
const subscribe = dropMovementEventSubject.pipe(
|
|
2500
|
-
distinctUntilChanged$1((prev, curr) => {
|
|
2501
|
-
const filterChildren2 = (obj) => {
|
|
2502
|
-
const {
|
|
2503
|
-
children,
|
|
2504
|
-
component,
|
|
2505
|
-
targetComponent,
|
|
2506
|
-
x,
|
|
2507
|
-
y,
|
|
2508
|
-
...rest
|
|
2509
|
-
} = obj || {};
|
|
2510
|
-
return rest;
|
|
2511
|
-
};
|
|
2512
|
-
return equal(filterChildren2(prev), filterChildren2(curr));
|
|
2513
|
-
})
|
|
2514
|
-
).subscribe((event) => {
|
|
2515
|
-
if (event.state === "remove") {
|
|
2516
|
-
if (event.targetParentLayoutName === layoutName || event.targetParentLayoutName === "" && event.targetLayoutName === layoutName) {
|
|
2517
|
-
requestAnimationFrame(() => {
|
|
2518
|
-
let removeCallback = (removeOrderName) => {
|
|
2519
|
-
if (event.nextContainerName && event.dropTargetComponentEvent && event.targetComponent) {
|
|
2520
|
-
const targetComponentsMap = handleUpdateDropTargetComponents({
|
|
2521
|
-
orderName: removeOrderName,
|
|
2522
|
-
containerName: event.nextContainerName,
|
|
2523
|
-
parentLayoutName,
|
|
2524
|
-
layoutName,
|
|
2525
|
-
dropComponent: event.targetComponent,
|
|
2526
|
-
navigationTitle: event.dropTargetComponentEvent.navigationTitle,
|
|
2527
|
-
isUsePrefix: true,
|
|
2528
|
-
afterDropTargetComponent,
|
|
2529
|
-
beforeDropTargetComponent,
|
|
2530
|
-
centerDropTargetComponent,
|
|
2531
|
-
dropDocumentOutsideOption: event.dropTargetComponentEvent?.dropDocumentOutsideOption,
|
|
2532
|
-
screenKey: event.dropTargetComponentEvent.screenKey
|
|
2533
|
-
});
|
|
2534
|
-
setSplitScreen(
|
|
2535
|
-
rootName,
|
|
2536
|
-
`${layoutName}=${screenKey}`,
|
|
2537
|
-
{
|
|
2538
|
-
...getCurrentSplitScreenComponents(
|
|
2539
|
-
rootName,
|
|
2540
|
-
`${layoutName}=${screenKey}`
|
|
2541
|
-
) || {
|
|
2542
|
-
afterDropTargetComponent,
|
|
2543
|
-
beforeDropTargetComponent,
|
|
2544
|
-
centerDropTargetComponent,
|
|
2545
|
-
direction
|
|
2546
|
-
},
|
|
2547
|
-
...targetComponentsMap
|
|
2548
|
-
}
|
|
2549
|
-
);
|
|
2550
|
-
Promise.resolve().then(
|
|
2551
|
-
() => event.dropEndCallback && event.dropEndCallback({
|
|
2552
|
-
x: event.x,
|
|
2553
|
-
y: event.y,
|
|
2554
|
-
containerName
|
|
2555
|
-
})
|
|
2556
|
-
);
|
|
2557
|
-
}
|
|
2558
|
-
};
|
|
2559
|
-
const currentComponents = getCurrentSplitScreenComponents(
|
|
2560
|
-
rootName,
|
|
2561
|
-
`${layoutName}=${screenKey}`
|
|
2562
|
-
);
|
|
2563
|
-
const afterList = handleRemove(
|
|
2564
|
-
currentComponents?.afterDropTargetComponent || afterDropTargetComponent,
|
|
2565
|
-
event.targetContainerName,
|
|
2566
|
-
() => removeCallback("after")
|
|
2567
|
-
);
|
|
2568
|
-
const beforList = handleRemove(
|
|
2569
|
-
currentComponents?.beforeDropTargetComponent || beforeDropTargetComponent,
|
|
2570
|
-
event.targetContainerName,
|
|
2571
|
-
() => removeCallback("before")
|
|
2572
|
-
);
|
|
2573
|
-
const centerList = handleRemove(
|
|
2574
|
-
currentComponents?.centerDropTargetComponent || centerDropTargetComponent,
|
|
2575
|
-
event.targetContainerName,
|
|
2576
|
-
() => removeCallback("center")
|
|
2577
|
-
);
|
|
2578
|
-
setSplitScreen(
|
|
2579
|
-
rootName,
|
|
2580
|
-
`${layoutName}=${screenKey}`,
|
|
2581
|
-
{
|
|
2582
|
-
afterDropTargetComponent: afterList,
|
|
2583
|
-
beforeDropTargetComponent: beforList,
|
|
2584
|
-
centerDropTargetComponent: centerList,
|
|
2585
|
-
direction
|
|
2586
|
-
}
|
|
2587
|
-
);
|
|
2588
|
-
});
|
|
2589
|
-
}
|
|
2590
|
-
} else if (event.state === "append") {
|
|
2591
|
-
const {
|
|
2592
|
-
x,
|
|
2593
|
-
y,
|
|
2594
|
-
dropEndCallback,
|
|
2595
|
-
dropTargetComponentEvent,
|
|
2596
|
-
orderName,
|
|
2597
|
-
targetLayoutName,
|
|
2598
|
-
targetParentLayoutName,
|
|
2599
|
-
targetContainerName,
|
|
2600
|
-
targetComponent,
|
|
2601
|
-
nextContainerName,
|
|
2602
|
-
parentOrderName
|
|
2603
|
-
} = event;
|
|
2604
|
-
if (layoutRef.current && orderName && x && y && dropTargetComponentEvent && isInnerDrop({ x, y, element: layoutRef.current })) {
|
|
2605
|
-
const {
|
|
2606
|
-
direction: dropDirection,
|
|
2607
|
-
navigationTitle,
|
|
2608
|
-
dropDocumentOutsideOption,
|
|
2609
|
-
screenKey: containerScreenKey
|
|
2610
|
-
} = dropTargetComponentEvent;
|
|
2611
|
-
if (
|
|
2612
|
-
//orderName !== 'center' &&
|
|
2613
|
-
targetLayoutName === layoutName && targetComponent
|
|
2614
|
-
) {
|
|
2615
|
-
if (dropDirection === parentDirection && orderName !== "center") {
|
|
2616
|
-
dropMovementEventSubject.next({
|
|
2617
|
-
state: "append",
|
|
2618
|
-
targetContainerName,
|
|
2619
|
-
targetParentLayoutName: "",
|
|
2620
|
-
targetLayoutName: parentLayoutName,
|
|
2621
|
-
targetComponent,
|
|
2622
|
-
nextContainerName: containerName,
|
|
2623
|
-
parentOrderName: getSelfOrderName(layoutName) || orderName,
|
|
2624
|
-
orderName,
|
|
2625
|
-
x,
|
|
2626
|
-
y,
|
|
2627
|
-
dropEndCallback,
|
|
2628
|
-
dropTargetComponentEvent: {
|
|
2629
|
-
navigationTitle,
|
|
2630
|
-
dropDocumentOutsideOption,
|
|
2631
|
-
direction: parentDirection,
|
|
2632
|
-
screenKey
|
|
2633
|
-
}
|
|
2634
|
-
});
|
|
2635
|
-
} else {
|
|
2636
|
-
if (orderName !== "center") {
|
|
2637
|
-
setDirection(dropDirection);
|
|
2638
|
-
setIsSplit(true);
|
|
2639
|
-
}
|
|
2640
|
-
const targetComponentsMap = handleUpdateDropTargetComponents({
|
|
2641
|
-
orderName,
|
|
2642
|
-
parentOrderName,
|
|
2643
|
-
containerName: targetContainerName,
|
|
2644
|
-
nextContainerName,
|
|
2645
|
-
parentLayoutName,
|
|
2646
|
-
layoutName,
|
|
2647
|
-
dropComponent: targetComponent,
|
|
2648
|
-
navigationTitle,
|
|
2649
|
-
isUsePrefix: orderName !== "center",
|
|
2650
|
-
afterDropTargetComponent,
|
|
2651
|
-
beforeDropTargetComponent,
|
|
2652
|
-
centerDropTargetComponent,
|
|
2653
|
-
dropDocumentOutsideOption
|
|
2654
|
-
});
|
|
2655
|
-
setSplitScreen(
|
|
2656
|
-
rootName,
|
|
2657
|
-
`${layoutName}=${screenKey}`,
|
|
2658
|
-
{
|
|
2659
|
-
...getCurrentSplitScreenComponents(
|
|
2660
|
-
rootName,
|
|
2661
|
-
`${layoutName}=${screenKey}`
|
|
2662
|
-
) || {
|
|
2663
|
-
afterDropTargetComponent,
|
|
2664
|
-
beforeDropTargetComponent,
|
|
2665
|
-
centerDropTargetComponent,
|
|
2666
|
-
direction
|
|
2667
|
-
},
|
|
2668
|
-
...targetComponentsMap,
|
|
2669
|
-
...{ direction: dropDirection }
|
|
2670
|
-
}
|
|
2671
|
-
);
|
|
2672
|
-
Promise.resolve().then(
|
|
2673
|
-
() => event.dropEndCallback && event.dropEndCallback({
|
|
2674
|
-
x: event.x,
|
|
2675
|
-
y: event.y,
|
|
2676
|
-
containerName
|
|
2677
|
-
})
|
|
2678
|
-
);
|
|
2679
|
-
}
|
|
2680
|
-
}
|
|
2681
|
-
}
|
|
2682
|
-
}
|
|
2683
|
-
});
|
|
2684
|
-
return () => {
|
|
2685
|
-
subscribe.unsubscribe();
|
|
2686
|
-
};
|
|
2687
|
-
}, [
|
|
2688
|
-
direction,
|
|
2689
|
-
parentDirection,
|
|
2690
|
-
parentLayoutName,
|
|
2691
|
-
layoutName,
|
|
2692
|
-
beforeDropTargetComponent,
|
|
2693
|
-
afterDropTargetComponent,
|
|
2694
|
-
centerDropTargetComponent
|
|
2695
|
-
]);
|
|
2696
|
-
useEffect(() => {
|
|
2697
|
-
centerDropTargetComponentRef.current = centerDropTargetComponent;
|
|
2698
|
-
}, [centerDropTargetComponent]);
|
|
2699
|
-
useEffect(() => {
|
|
2700
|
-
activeIndexRef.current = activeIndex;
|
|
2701
|
-
}, [activeIndex]);
|
|
2702
|
-
const [isOnlyOneScreen, setIsOnlyOneScreen] = useState(false);
|
|
2703
|
-
return /* @__PURE__ */ jsx(Fragment, { children: !isEmptyContent && /* @__PURE__ */ jsxs(
|
|
2704
|
-
"div",
|
|
2705
|
-
{
|
|
2706
|
-
className: `${FlexLayout_default["flex-split-screen"]}`,
|
|
2707
|
-
ref: layoutRef,
|
|
2708
|
-
children: [
|
|
2709
|
-
/* @__PURE__ */ jsxs(
|
|
2710
|
-
FlexLayout_default2,
|
|
2711
|
-
{
|
|
2712
|
-
direction,
|
|
2713
|
-
layoutName: `${layoutName}`,
|
|
2714
|
-
panelMovementMode: "bulldozer",
|
|
2715
|
-
children: [
|
|
2716
|
-
beforeDropTargetComponent.length != 0 ? /* @__PURE__ */ jsx(Fragment, { children: beforeDropTargetComponent.map(
|
|
2717
|
-
({
|
|
2718
|
-
containerName: cName,
|
|
2719
|
-
component,
|
|
2720
|
-
navigationTitle,
|
|
2721
|
-
dropDocumentOutsideOption,
|
|
2722
|
-
screenKey: screenKey2
|
|
2723
|
-
}, i) => /* @__PURE__ */ jsx(
|
|
2724
|
-
FlexLayoutContainer_default,
|
|
2725
|
-
{
|
|
2726
|
-
containerName: cName,
|
|
2727
|
-
isInitialResizable: true,
|
|
2728
|
-
isResizePanel: true,
|
|
2729
|
-
children: /* @__PURE__ */ jsx(
|
|
2730
|
-
FlexLayoutSplitScreenChild,
|
|
2731
|
-
{
|
|
2732
|
-
parentDirection: direction,
|
|
2733
|
-
layoutName: `${layoutName}_before-${depth}`,
|
|
2734
|
-
parentLayoutName: layoutName,
|
|
2735
|
-
containerName: cName,
|
|
2736
|
-
depth: depth + 1,
|
|
2737
|
-
rootRef,
|
|
2738
|
-
screenKey: screenKey2,
|
|
2739
|
-
initialCenterComponents: [
|
|
2740
|
-
{
|
|
2741
|
-
navigationTitle,
|
|
2742
|
-
component,
|
|
2743
|
-
containerName: cName,
|
|
2744
|
-
dropDocumentOutsideOption,
|
|
2745
|
-
screenKey: screenKey2
|
|
2746
|
-
}
|
|
2747
|
-
],
|
|
2748
|
-
rootName
|
|
2749
|
-
}
|
|
2750
|
-
)
|
|
2751
|
-
},
|
|
2752
|
-
cName
|
|
2753
|
-
)
|
|
2754
|
-
) }) : /* @__PURE__ */ jsx("div", {}),
|
|
2755
|
-
centerDropTargetComponent.length != 0 ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
2756
|
-
FlexLayoutContainer_default,
|
|
2757
|
-
{
|
|
2758
|
-
containerName: `${(centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName}`,
|
|
2759
|
-
isInitialResizable: true,
|
|
2760
|
-
isResizePanel: isSplit,
|
|
2761
|
-
children: isSplit ? /* @__PURE__ */ jsx("div", { "data-key": screenKey, children: /* @__PURE__ */ jsx(
|
|
2762
|
-
FlexLayoutSplitScreenChild,
|
|
2763
|
-
{
|
|
2764
|
-
parentDirection: direction,
|
|
2765
|
-
layoutName: `${layoutName}_center-${depth}`,
|
|
2766
|
-
parentLayoutName: layoutName,
|
|
2767
|
-
containerName: `${(centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName}`,
|
|
2768
|
-
depth: depth + 1,
|
|
2769
|
-
rootRef,
|
|
2770
|
-
initialCenterComponents: centerDropTargetComponent.map(
|
|
2771
|
-
({
|
|
2772
|
-
navigationTitle,
|
|
2773
|
-
component,
|
|
2774
|
-
containerName: cName,
|
|
2775
|
-
dropDocumentOutsideOption,
|
|
2776
|
-
screenKey: centerScreenKey
|
|
2777
|
-
}) => ({
|
|
2778
|
-
navigationTitle,
|
|
2779
|
-
component,
|
|
2780
|
-
containerName: cName,
|
|
2781
|
-
dropDocumentOutsideOption,
|
|
2782
|
-
screenKey: centerScreenKey
|
|
2783
|
-
})
|
|
2784
|
-
),
|
|
2785
|
-
screenKey,
|
|
2786
|
-
rootName
|
|
2787
|
-
}
|
|
2788
|
-
) }) : /* @__PURE__ */ jsxs(
|
|
2789
|
-
FlexLayoutSplitScreenScrollBox_default,
|
|
2790
|
-
{
|
|
2791
|
-
keyName: (centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName,
|
|
2792
|
-
isDefaultScrollStyle: true,
|
|
2793
|
-
children: [
|
|
2794
|
-
!isOnlyOneScreen && /* @__PURE__ */ jsx(
|
|
2795
|
-
"div",
|
|
2796
|
-
{
|
|
2797
|
-
className: `${FlexLayout_default["flex-split-screen-drag-box-title-wrapper-sticky"]}`,
|
|
2798
|
-
children: /* @__PURE__ */ jsxs(
|
|
2799
|
-
"div",
|
|
2800
|
-
{
|
|
2801
|
-
"data-is_split": isSplit,
|
|
2802
|
-
"data-layout_name": layoutName,
|
|
2803
|
-
"data-parent_layout_name": parentLayoutName,
|
|
2804
|
-
"data-container_name": `${(centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName}`,
|
|
2805
|
-
className: `${FlexLayout_default["flex-split-screen-drag-box-title-wrapper"]}`,
|
|
2806
|
-
children: [
|
|
2807
|
-
/* @__PURE__ */ jsx(
|
|
2808
|
-
FlexLayoutSplitScreenDragBoxContainer,
|
|
2809
|
-
{
|
|
2810
|
-
"data-layout_name": layoutName,
|
|
2811
|
-
layoutName,
|
|
2812
|
-
children: centerDropTargetComponent.map(
|
|
2813
|
-
(item, index) => /* @__PURE__ */ jsx(
|
|
2814
|
-
FlexLayoutSplitScreenDragBoxItem,
|
|
2815
|
-
{
|
|
2816
|
-
onClose: (ev) => {
|
|
2817
|
-
if (activeIndexRef.current === index && centerDropTargetComponent.length === 1) {
|
|
2818
|
-
dropMovementEventSubject.next(
|
|
2819
|
-
{
|
|
2820
|
-
state: "remove",
|
|
2821
|
-
targetContainerName: containerName,
|
|
2822
|
-
targetParentLayoutName: parentLayoutName,
|
|
2823
|
-
targetLayoutName: layoutName
|
|
2824
|
-
}
|
|
2825
|
-
);
|
|
2826
|
-
} else {
|
|
2827
|
-
if (centerDropTargetComponent.length === activeIndexRef.current + 1) {
|
|
2828
|
-
setActiveIndex(
|
|
2829
|
-
activeIndexRef.current - 1
|
|
2830
|
-
);
|
|
2831
|
-
}
|
|
2832
|
-
setCenterDropTargetComponent(
|
|
2833
|
-
(prev) => {
|
|
2834
|
-
const result = handleRemove(
|
|
2835
|
-
prev,
|
|
2836
|
-
item.containerName,
|
|
2837
|
-
() => {
|
|
2838
|
-
}
|
|
2839
|
-
);
|
|
2840
|
-
return result;
|
|
2841
|
-
}
|
|
2842
|
-
);
|
|
2843
|
-
}
|
|
2844
|
-
},
|
|
2845
|
-
isActive: activeIndex === index,
|
|
2846
|
-
children: /* @__PURE__ */ jsx(
|
|
2847
|
-
FlexLayoutSplitScreenDragBox,
|
|
2848
|
-
{
|
|
2849
|
-
onClick: () => {
|
|
2850
|
-
setActiveIndex(
|
|
2851
|
-
index
|
|
2852
|
-
);
|
|
2853
|
-
},
|
|
2854
|
-
containerName: item.containerName,
|
|
2855
|
-
dropDocumentOutsideOption: item.dropDocumentOutsideOption,
|
|
2856
|
-
targetComponent: item.component,
|
|
2857
|
-
navigationTitle: item.navigationTitle,
|
|
2858
|
-
"data-container-name": item.containerName,
|
|
2859
|
-
"data-layout-name": layoutName,
|
|
2860
|
-
"data-parent-layout-name": parentLayoutName,
|
|
2861
|
-
dropEndCallback: ({
|
|
2862
|
-
x,
|
|
2863
|
-
y,
|
|
2864
|
-
containerName: appendContainerName
|
|
2865
|
-
}) => {
|
|
2866
|
-
if (!rootRef.current || !layoutRef.current)
|
|
2867
|
-
return;
|
|
2868
|
-
const isRootOver = isOverDrop(
|
|
2869
|
-
{
|
|
2870
|
-
x,
|
|
2871
|
-
y,
|
|
2872
|
-
element: rootRef.current
|
|
2873
|
-
}
|
|
2874
|
-
);
|
|
2875
|
-
const isLayoutInner = isInnerDrop(
|
|
2876
|
-
{
|
|
2877
|
-
x,
|
|
2878
|
-
y,
|
|
2879
|
-
element: layoutRef.current
|
|
2880
|
-
}
|
|
2881
|
-
);
|
|
2882
|
-
if (!isRootOver && !isLayoutInner || !isRootOver && isLayoutInner && centerDropTargetComponentRef.current.length > 1) {
|
|
2883
|
-
const option = {};
|
|
2884
|
-
if (centerDropTargetComponentRef.current.length > 1) {
|
|
2885
|
-
const {
|
|
2886
|
-
adjacentItem,
|
|
2887
|
-
adjacentIndex
|
|
2888
|
-
} = getAdjacentItem(
|
|
2889
|
-
centerDropTargetComponentRef.current,
|
|
2890
|
-
activeIndexRef.current
|
|
2891
|
-
);
|
|
2892
|
-
if (adjacentItem && activeIndexRef.current === index) {
|
|
2893
|
-
Object.assign(
|
|
2894
|
-
option,
|
|
2895
|
-
{
|
|
2896
|
-
x,
|
|
2897
|
-
y,
|
|
2898
|
-
targetComponent: adjacentItem.component,
|
|
2899
|
-
nextContainerName: adjacentItem.containerName,
|
|
2900
|
-
orderName: "center",
|
|
2901
|
-
dropTargetComponentEvent: {
|
|
2902
|
-
navigationTitle: adjacentItem.navigationTitle,
|
|
2903
|
-
dropDocumentOutsideOption: adjacentItem.dropDocumentOutsideOption,
|
|
2904
|
-
direction,
|
|
2905
|
-
screenKey
|
|
2906
|
-
}
|
|
2907
|
-
}
|
|
2908
|
-
);
|
|
2909
|
-
}
|
|
2910
|
-
}
|
|
2911
|
-
if (index === 0) {
|
|
2912
|
-
dropMovementEventSubject.next(
|
|
2913
|
-
{
|
|
2914
|
-
state: "remove",
|
|
2915
|
-
targetContainerName: item.containerName,
|
|
2916
|
-
targetParentLayoutName: parentLayoutName,
|
|
2917
|
-
targetLayoutName: layoutName,
|
|
2918
|
-
...option
|
|
2919
|
-
}
|
|
2920
|
-
);
|
|
2921
|
-
} else {
|
|
2922
|
-
dropMovementEventSubject.next(
|
|
2923
|
-
{
|
|
2924
|
-
state: "remove",
|
|
2925
|
-
targetContainerName: item.containerName,
|
|
2926
|
-
targetParentLayoutName: "",
|
|
2927
|
-
targetLayoutName: layoutName,
|
|
2928
|
-
...option
|
|
2929
|
-
}
|
|
2930
|
-
);
|
|
2931
|
-
}
|
|
2932
|
-
}
|
|
2933
|
-
},
|
|
2934
|
-
children: item.navigationTitle
|
|
2935
|
-
}
|
|
2936
|
-
)
|
|
2937
|
-
},
|
|
2938
|
-
item.navigationTitle + layoutName + item.containerName
|
|
2939
|
-
)
|
|
2940
|
-
)
|
|
2941
|
-
},
|
|
2942
|
-
layoutName
|
|
2943
|
-
),
|
|
2944
|
-
/* @__PURE__ */ jsx(FlexLayoutSplitScreenDragBoxTitleMore, {})
|
|
2945
|
-
]
|
|
2946
|
-
}
|
|
2947
|
-
)
|
|
2948
|
-
}
|
|
2949
|
-
),
|
|
2950
|
-
(() => {
|
|
2951
|
-
const target = centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0];
|
|
2952
|
-
return target.component;
|
|
2953
|
-
})()
|
|
2954
|
-
]
|
|
2955
|
-
}
|
|
2956
|
-
)
|
|
2957
|
-
},
|
|
2958
|
-
(centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName
|
|
2959
|
-
) }) : /* @__PURE__ */ jsx("div", {}),
|
|
2960
|
-
afterDropTargetComponent.length != 0 ? /* @__PURE__ */ jsx(Fragment, { children: afterDropTargetComponent.map(
|
|
2961
|
-
({
|
|
2962
|
-
containerName: cName,
|
|
2963
|
-
component,
|
|
2964
|
-
navigationTitle,
|
|
2965
|
-
dropDocumentOutsideOption,
|
|
2966
|
-
screenKey: screenKey2
|
|
2967
|
-
}, i) => /* @__PURE__ */ jsx(
|
|
2968
|
-
FlexLayoutContainer_default,
|
|
2969
|
-
{
|
|
2970
|
-
containerName: cName,
|
|
2971
|
-
isInitialResizable: true,
|
|
2972
|
-
isResizePanel: i !== afterDropTargetComponent.length - 1,
|
|
2973
|
-
children: /* @__PURE__ */ jsx(
|
|
2974
|
-
FlexLayoutSplitScreenChild,
|
|
2975
|
-
{
|
|
2976
|
-
parentDirection: direction,
|
|
2977
|
-
layoutName: `${layoutName}_after-${depth}`,
|
|
2978
|
-
parentLayoutName: layoutName,
|
|
2979
|
-
containerName: cName,
|
|
2980
|
-
depth: depth + 1,
|
|
2981
|
-
rootRef,
|
|
2982
|
-
screenKey: screenKey2,
|
|
2983
|
-
initialCenterComponents: [
|
|
2984
|
-
{
|
|
2985
|
-
navigationTitle,
|
|
2986
|
-
component,
|
|
2987
|
-
containerName: cName,
|
|
2988
|
-
dropDocumentOutsideOption,
|
|
2989
|
-
screenKey: screenKey2
|
|
2990
|
-
}
|
|
2991
|
-
],
|
|
2992
|
-
rootName
|
|
2993
|
-
}
|
|
2994
|
-
)
|
|
2995
|
-
},
|
|
2996
|
-
cName
|
|
2997
|
-
)
|
|
2998
|
-
) }) : /* @__PURE__ */ jsx("div", {})
|
|
2999
|
-
]
|
|
3000
|
-
}
|
|
3001
|
-
),
|
|
3002
|
-
boundaryContainerSize && /* @__PURE__ */ jsx(
|
|
3003
|
-
"div",
|
|
3004
|
-
{
|
|
3005
|
-
className: `${FlexLayout_default["flex-split-screen-boundary-container"]}`,
|
|
3006
|
-
style: { ...boundaryContainerSize },
|
|
3007
|
-
children: "\u2B07\uFE0F\uB4DC\uB86D\uD558\uBA74 \uD654\uBA74\uC774 \uBD84\uD560\uB429\uB2C8\uB2E4."
|
|
3008
|
-
}
|
|
3009
|
-
)
|
|
3010
|
-
]
|
|
3011
|
-
}
|
|
3012
|
-
) });
|
|
3013
|
-
}
|
|
3014
|
-
FlexLayoutSplitScreen.displayName = "FlexLayoutSplitScreen";
|
|
3015
|
-
var FlexLayoutSplitScreen_default = FlexLayoutSplitScreen;
|
|
3016
|
-
function clamp(n, min, max) {
|
|
3017
|
-
return Math.max(min, Math.min(max, n));
|
|
3018
|
-
}
|
|
3019
|
-
function pickDefaultScrollRoot() {
|
|
3020
|
-
if (typeof document === "undefined") return null;
|
|
3021
|
-
let el = document.body;
|
|
3022
|
-
while (el && el !== document.documentElement && el !== document.body) {
|
|
3023
|
-
const style = getComputedStyle(el);
|
|
3024
|
-
const oy = style.overflowY;
|
|
3025
|
-
const ox = style.overflowX;
|
|
3026
|
-
const scrollable = oy === "auto" || oy === "scroll" || ox === "auto" || ox === "scroll";
|
|
3027
|
-
if (scrollable) return el;
|
|
3028
|
-
el = el.parentElement;
|
|
3029
|
-
}
|
|
3030
|
-
return null;
|
|
3031
|
-
}
|
|
3032
|
-
function isVerticalScroll(root) {
|
|
3033
|
-
if (typeof window == "undefined") return true;
|
|
3034
|
-
if (!root) {
|
|
3035
|
-
return document.documentElement.scrollHeight > window.innerHeight + 1;
|
|
3036
|
-
}
|
|
3037
|
-
const el = root;
|
|
3038
|
-
return el.scrollHeight > el.clientHeight + 1;
|
|
3039
|
-
}
|
|
3040
|
-
var dpr = typeof window != "undefined" ? window.devicePixelRatio || 1 : 1;
|
|
3041
|
-
function quantizeToDevicePixel(n) {
|
|
3042
|
-
return Math.round(n * dpr) / dpr;
|
|
3043
|
-
}
|
|
3044
|
-
var FlexLayoutStickyBox = ({
|
|
3045
|
-
edge = "auto",
|
|
3046
|
-
offset = 16,
|
|
3047
|
-
scrollRoot = null,
|
|
3048
|
-
debug = false,
|
|
3049
|
-
children,
|
|
3050
|
-
style,
|
|
3051
|
-
className,
|
|
3052
|
-
onTranslateChange = () => {
|
|
3053
|
-
},
|
|
3054
|
-
...rest
|
|
3055
|
-
}) => {
|
|
3056
|
-
const offsetRef = useRef(offset);
|
|
3057
|
-
const rootRef = useRef(null);
|
|
3058
|
-
const contentRef = useRef(null);
|
|
3059
|
-
const mutatingRef = useRef(false);
|
|
3060
|
-
const lastOffsetRef = useRef(0);
|
|
3061
|
-
const [resolvedEdge, setResolvedEdge] = useState("top");
|
|
3062
|
-
const rafId = useRef(null);
|
|
3063
|
-
const [contentDynamicStyle, setContentDynamicStyle] = useState({});
|
|
3064
|
-
useEffect(() => {
|
|
3065
|
-
setContentDynamicStyle({
|
|
3066
|
-
willChange: "transform",
|
|
3067
|
-
transition: "transform 50ms linear"
|
|
3068
|
-
});
|
|
3069
|
-
}, []);
|
|
3070
|
-
useEffect(() => {
|
|
3071
|
-
offsetRef.current = offset;
|
|
3072
|
-
scheduleUpdate();
|
|
3073
|
-
}, [offset]);
|
|
3074
|
-
const [ioRoot, setIoRoot] = useState(null);
|
|
3075
|
-
useEffect(() => {
|
|
3076
|
-
const root = scrollRoot ?? pickDefaultScrollRoot();
|
|
3077
|
-
setResolvedEdge(
|
|
3078
|
-
edge === "auto" ? isVerticalScroll(root) ? "top" : "left" : edge
|
|
3079
|
-
);
|
|
3080
|
-
setIoRoot(root);
|
|
3081
|
-
}, [edge, scrollRoot]);
|
|
3082
|
-
useEffect(() => {
|
|
3083
|
-
if (edge !== "auto") {
|
|
3084
|
-
setResolvedEdge(edge);
|
|
3085
|
-
return;
|
|
3086
|
-
}
|
|
3087
|
-
const vertical = isVerticalScroll(ioRoot);
|
|
3088
|
-
setResolvedEdge(vertical ? "top" : "left");
|
|
3089
|
-
}, [edge, ioRoot]);
|
|
3090
|
-
useEffect(() => {
|
|
3091
|
-
}, []);
|
|
3092
|
-
const scheduleUpdate = () => {
|
|
3093
|
-
if (rafId.current != null) return;
|
|
3094
|
-
rafId.current = requestAnimationFrame(() => {
|
|
3095
|
-
rafId.current = null;
|
|
3096
|
-
doUpdate();
|
|
3097
|
-
});
|
|
3098
|
-
};
|
|
3099
|
-
const doUpdate = () => {
|
|
3100
|
-
if (mutatingRef.current) return;
|
|
3101
|
-
mutatingRef.current = true;
|
|
3102
|
-
const rootEl = rootRef.current;
|
|
3103
|
-
const contentEl = contentRef.current;
|
|
3104
|
-
if (!rootEl || !contentEl) {
|
|
3105
|
-
mutatingRef.current = false;
|
|
3106
|
-
return;
|
|
3107
|
-
}
|
|
3108
|
-
const parentEl = rootEl.parentElement;
|
|
3109
|
-
if (!parentEl) {
|
|
3110
|
-
mutatingRef.current = false;
|
|
3111
|
-
return;
|
|
3112
|
-
}
|
|
3113
|
-
const rootBounds = ioRoot && "getBoundingClientRect" in ioRoot ? ioRoot.getBoundingClientRect() : new DOMRect(0, 0, window.innerWidth, window.innerHeight);
|
|
3114
|
-
const parentRect = parentEl.getBoundingClientRect();
|
|
3115
|
-
const contentRect = contentEl.getBoundingClientRect();
|
|
3116
|
-
let newOffset = 0;
|
|
3117
|
-
if (resolvedEdge === "top" || resolvedEdge === "bottom") {
|
|
3118
|
-
const maxTranslate = Math.max(
|
|
3119
|
-
0,
|
|
3120
|
-
parentRect.height - contentRect.height
|
|
3121
|
-
);
|
|
3122
|
-
let desiredTop = 0;
|
|
3123
|
-
if (resolvedEdge === "top") {
|
|
3124
|
-
desiredTop = rootBounds.top + offsetRef.current - parentRect.top;
|
|
3125
|
-
} else {
|
|
3126
|
-
const targetBottomFromParentTop = Math.min(
|
|
3127
|
-
parentRect.bottom,
|
|
3128
|
-
rootBounds.bottom - offsetRef.current
|
|
3129
|
-
) - parentRect.top;
|
|
3130
|
-
desiredTop = targetBottomFromParentTop - contentRect.height;
|
|
3131
|
-
}
|
|
3132
|
-
newOffset = clamp(desiredTop, 0, maxTranslate);
|
|
3133
|
-
} else {
|
|
3134
|
-
const maxTranslate = Math.max(
|
|
3135
|
-
0,
|
|
3136
|
-
parentRect.width - contentRect.width
|
|
3137
|
-
);
|
|
3138
|
-
let desiredLeft = 0;
|
|
3139
|
-
if (resolvedEdge === "left") {
|
|
3140
|
-
desiredLeft = rootBounds.left + offsetRef.current - parentRect.left;
|
|
3141
|
-
} else {
|
|
3142
|
-
const targetRightFromParentLeft = Math.min(
|
|
3143
|
-
parentRect.right,
|
|
3144
|
-
rootBounds.right - offsetRef.current
|
|
3145
|
-
) - parentRect.left;
|
|
3146
|
-
desiredLeft = targetRightFromParentLeft - contentRect.width;
|
|
3147
|
-
}
|
|
3148
|
-
newOffset = clamp(desiredLeft, 0, maxTranslate);
|
|
3149
|
-
}
|
|
3150
|
-
const nextOffset = quantizeToDevicePixel(newOffset);
|
|
3151
|
-
if (Math.abs(lastOffsetRef.current - nextOffset) > 0.5) {
|
|
3152
|
-
if (resolvedEdge === "top" || resolvedEdge === "bottom") {
|
|
3153
|
-
contentEl.style.transform = `translateY(${nextOffset}px)`;
|
|
3154
|
-
} else {
|
|
3155
|
-
contentEl.style.transform = `translateX(${nextOffset}px)`;
|
|
3156
|
-
}
|
|
3157
|
-
lastOffsetRef.current = nextOffset;
|
|
3158
|
-
onTranslateChange(nextOffset, rootRef, contentRef);
|
|
3159
|
-
}
|
|
3160
|
-
if (debug) {
|
|
3161
|
-
rootEl.style.outline = "1px dashed rgba(0,0,0,.2)";
|
|
3162
|
-
contentEl.style.outline = "1px solid rgba(0,128,255,.35)";
|
|
3163
|
-
}
|
|
3164
|
-
queueMicrotask(() => {
|
|
3165
|
-
mutatingRef.current = false;
|
|
3166
|
-
});
|
|
3167
|
-
};
|
|
3168
|
-
useEffect(() => {
|
|
3169
|
-
if (typeof window == "undefined") return;
|
|
3170
|
-
const rootEl = rootRef.current;
|
|
3171
|
-
if (!rootEl) return;
|
|
3172
|
-
const parentEl = rootEl.parentElement;
|
|
3173
|
-
console.log(parentEl);
|
|
3174
|
-
if (!parentEl) return;
|
|
3175
|
-
const targets = [parentEl];
|
|
3176
|
-
const observerCallback = () => {
|
|
3177
|
-
if (!mutatingRef.current) scheduleUpdate();
|
|
3178
|
-
};
|
|
3179
|
-
const io = new IntersectionObserver(observerCallback, {
|
|
3180
|
-
root: ioRoot instanceof Element ? ioRoot : null,
|
|
3181
|
-
threshold: 0,
|
|
3182
|
-
rootMargin: "1px"
|
|
3183
|
-
});
|
|
3184
|
-
const ro = new ResizeObserver(observerCallback);
|
|
3185
|
-
targets.forEach((t) => io.observe(t));
|
|
3186
|
-
ro.observe(parentEl);
|
|
3187
|
-
if (contentRef.current) {
|
|
3188
|
-
ro.observe(contentRef.current);
|
|
3189
|
-
}
|
|
3190
|
-
const scrollTarget = ioRoot || window;
|
|
3191
|
-
scrollTarget.addEventListener("scroll", scheduleUpdate, {
|
|
3192
|
-
passive: true
|
|
3193
|
-
});
|
|
3194
|
-
window.addEventListener("resize", scheduleUpdate);
|
|
3195
|
-
scheduleUpdate();
|
|
3196
|
-
return () => {
|
|
3197
|
-
io.disconnect();
|
|
3198
|
-
ro.disconnect();
|
|
3199
|
-
scrollTarget.removeEventListener("scroll", scheduleUpdate);
|
|
3200
|
-
window.removeEventListener("resize", scheduleUpdate);
|
|
3201
|
-
if (rafId.current != null) {
|
|
3202
|
-
cancelAnimationFrame(rafId.current);
|
|
3203
|
-
rafId.current = null;
|
|
3204
|
-
}
|
|
3205
|
-
};
|
|
3206
|
-
}, [ioRoot, resolvedEdge, offset, debug]);
|
|
3207
|
-
return /* @__PURE__ */ jsx(
|
|
3208
|
-
"div",
|
|
3209
|
-
{
|
|
3210
|
-
ref: rootRef,
|
|
3211
|
-
className,
|
|
3212
|
-
style: {
|
|
3213
|
-
display: "block",
|
|
3214
|
-
minWidth: 0,
|
|
3215
|
-
minHeight: 0,
|
|
3216
|
-
height: "100%",
|
|
3217
|
-
// 부모 높이를 채우도록 설정
|
|
3218
|
-
...style
|
|
3219
|
-
},
|
|
3220
|
-
...rest,
|
|
3221
|
-
children: /* @__PURE__ */ jsx(
|
|
3222
|
-
"div",
|
|
3223
|
-
{
|
|
3224
|
-
ref: contentRef,
|
|
3225
|
-
style: contentDynamicStyle,
|
|
3226
|
-
children
|
|
3227
|
-
}
|
|
3228
|
-
)
|
|
3229
|
-
}
|
|
3230
|
-
);
|
|
3231
|
-
};
|
|
3232
|
-
var FlexLayoutStickyBox_default = FlexLayoutStickyBox;
|
|
3233
|
-
var useListPagingForSentinel = ({
|
|
3234
|
-
//initPageNumber,
|
|
3235
|
-
//initPageSize,
|
|
3236
|
-
onReachTerminal
|
|
3237
|
-
}) => {
|
|
3238
|
-
const [firstChildNode, setFirstChildNode] = useState(null);
|
|
3239
|
-
const [lastChildNode, setLastChildNode] = useState(null);
|
|
3240
|
-
const observerRef = useRef(null);
|
|
3241
|
-
const firstChildRef = useCallback((node) => {
|
|
3242
|
-
setFirstChildNode(node);
|
|
3243
|
-
}, []);
|
|
3244
|
-
const lastChildRef = useCallback((node) => {
|
|
3245
|
-
setLastChildNode(node);
|
|
3246
|
-
}, []);
|
|
3247
|
-
useEffect(() => {
|
|
3248
|
-
if (firstChildNode && observerRef.current)
|
|
3249
|
-
observerRef.current.unobserve(firstChildNode);
|
|
3250
|
-
if (lastChildNode && observerRef.current)
|
|
3251
|
-
observerRef.current.unobserve(lastChildNode);
|
|
3252
|
-
const handleIntersect = (entries, observer2) => {
|
|
3253
|
-
entries.forEach((entry) => {
|
|
3254
|
-
if (entry.isIntersecting) {
|
|
3255
|
-
if (entry.target === firstChildNode) {
|
|
3256
|
-
if (onReachTerminal)
|
|
3257
|
-
onReachTerminal({
|
|
3258
|
-
isFirst: true,
|
|
3259
|
-
isLast: false,
|
|
3260
|
-
observer: observer2
|
|
3261
|
-
});
|
|
3262
|
-
}
|
|
3263
|
-
if (entry.target === lastChildNode) {
|
|
3264
|
-
if (onReachTerminal)
|
|
3265
|
-
onReachTerminal({
|
|
3266
|
-
isFirst: false,
|
|
3267
|
-
isLast: true,
|
|
3268
|
-
observer: observer2
|
|
3269
|
-
});
|
|
3270
|
-
}
|
|
3271
|
-
}
|
|
3272
|
-
});
|
|
3273
|
-
};
|
|
3274
|
-
const observer = new IntersectionObserver(handleIntersect, {
|
|
3275
|
-
threshold: 0.1
|
|
3276
|
-
});
|
|
3277
|
-
observerRef.current = observer;
|
|
3278
|
-
if (firstChildNode) observer.observe(firstChildNode);
|
|
3279
|
-
if (lastChildNode) observer.observe(lastChildNode);
|
|
3280
|
-
return () => {
|
|
3281
|
-
if (observerRef.current) {
|
|
3282
|
-
observerRef.current.disconnect();
|
|
3283
|
-
}
|
|
3284
|
-
};
|
|
3285
|
-
}, [firstChildNode, lastChildNode]);
|
|
3286
|
-
return {
|
|
3287
|
-
firstChildRef,
|
|
3288
|
-
lastChildRef
|
|
3289
|
-
};
|
|
3290
|
-
};
|
|
3291
|
-
var usePaginationViewNumber = ({
|
|
3292
|
-
initPageNumber
|
|
3293
|
-
}) => {
|
|
3294
|
-
const [showCurrentPageNumber, setShowCurrentPageNumber] = useState(initPageNumber);
|
|
3295
|
-
const observerRef = useRef(null);
|
|
3296
|
-
const showCurrentPageObserveTarget = useCallback(
|
|
3297
|
-
(node) => {
|
|
3298
|
-
if (!node) return;
|
|
3299
|
-
if (!observerRef.current) {
|
|
3300
|
-
observerRef.current = new IntersectionObserver(
|
|
3301
|
-
(entries) => {
|
|
3302
|
-
entries.forEach((entry) => {
|
|
3303
|
-
if (entry.isIntersecting) {
|
|
3304
|
-
const pageIndexAttr = entry.target.getAttribute(
|
|
3305
|
-
"data-page-index"
|
|
3306
|
-
);
|
|
3307
|
-
if (!pageIndexAttr) return;
|
|
3308
|
-
const pageIndex = parseInt(pageIndexAttr, 10);
|
|
3309
|
-
setShowCurrentPageNumber(pageIndex);
|
|
3310
|
-
}
|
|
3311
|
-
});
|
|
3312
|
-
},
|
|
3313
|
-
{
|
|
3314
|
-
threshold: 0.1
|
|
3315
|
-
// 예: 10% 이상 보여야 intersect로 판단
|
|
3316
|
-
}
|
|
3317
|
-
);
|
|
3318
|
-
}
|
|
3319
|
-
observerRef.current.observe(node);
|
|
3320
|
-
},
|
|
3321
|
-
[]
|
|
3322
|
-
);
|
|
3323
|
-
useEffect(() => {
|
|
3324
|
-
const currentObserver = observerRef.current;
|
|
3325
|
-
return () => {
|
|
3326
|
-
if (currentObserver) {
|
|
3327
|
-
currentObserver.disconnect();
|
|
3328
|
-
}
|
|
3329
|
-
};
|
|
3330
|
-
}, []);
|
|
3331
|
-
return {
|
|
3332
|
-
showCurrentPageNumber,
|
|
3333
|
-
showCurrentPageObserveTarget
|
|
3334
|
-
};
|
|
3335
|
-
};
|
|
3336
|
-
var usePagingHandler = ({
|
|
3337
|
-
lastCallPageNumber,
|
|
3338
|
-
dataListRef
|
|
3339
|
-
}) => {
|
|
3340
|
-
const jumpingPageNumberRef = useRef(lastCallPageNumber);
|
|
3341
|
-
useEffect(() => {
|
|
3342
|
-
if (jumpingPageNumberRef.current) {
|
|
3343
|
-
setTimeout(() => {
|
|
3344
|
-
jumpingPageNumberRef.current = null;
|
|
3345
|
-
}, 1e3);
|
|
3346
|
-
}
|
|
3347
|
-
}, [jumpingPageNumberRef]);
|
|
3348
|
-
const paginationScrollIntoViewTarget = useRef({});
|
|
3349
|
-
const pageNumberRef = useRef(lastCallPageNumber);
|
|
3350
|
-
const setPaginationRef = useCallback(
|
|
3351
|
-
(i) => (node) => {
|
|
3352
|
-
if (!node) return;
|
|
3353
|
-
paginationScrollIntoViewTarget.current[i] = node;
|
|
3354
|
-
if (jumpingPageNumberRef.current !== null && i === jumpingPageNumberRef.current) {
|
|
3355
|
-
node.scrollIntoView({
|
|
3356
|
-
behavior: "instant",
|
|
3357
|
-
// 필요한 경우 'smooth' 등으로 수정 가능
|
|
3358
|
-
block: "start"
|
|
3359
|
-
});
|
|
3360
|
-
jumpingPageNumberRef.current = null;
|
|
3361
|
-
}
|
|
3362
|
-
},
|
|
3363
|
-
[]
|
|
3364
|
-
);
|
|
3365
|
-
const handleReachTerminal = ({ isFirst, isLast, observer }, dataCallFetch) => {
|
|
3366
|
-
if (dataListRef.current.length === 0) return;
|
|
3367
|
-
if (jumpingPageNumberRef.current != null) return;
|
|
3368
|
-
if (!isFirst && !isLast) return;
|
|
3369
|
-
const callPageNumber = isFirst ? Math.max(pageNumberRef.current - 1, 0) : pageNumberRef.current + 1;
|
|
3370
|
-
if (dataListRef.current[callPageNumber] != null && (dataListRef.current[callPageNumber]?.length || 0) > 0)
|
|
3371
|
-
return;
|
|
3372
|
-
jumpingPageNumberRef.current = callPageNumber;
|
|
3373
|
-
setTimeout(() => {
|
|
3374
|
-
jumpingPageNumberRef.current = null;
|
|
3375
|
-
}, 1e3);
|
|
3376
|
-
dataCallFetch(callPageNumber);
|
|
3377
|
-
};
|
|
3378
|
-
const handleClickPageChange = (page, dataCallFetch) => {
|
|
3379
|
-
const pageData = dataListRef.current[page];
|
|
3380
|
-
if (pageData != null && Array.isArray(pageData) && pageData.length > 0) {
|
|
3381
|
-
paginationScrollIntoViewTarget.current[page]?.scrollIntoView({
|
|
3382
|
-
behavior: "smooth",
|
|
3383
|
-
block: "start"
|
|
3384
|
-
});
|
|
3385
|
-
return;
|
|
3386
|
-
}
|
|
3387
|
-
jumpingPageNumberRef.current = page;
|
|
3388
|
-
setTimeout(() => {
|
|
3389
|
-
jumpingPageNumberRef.current = null;
|
|
3390
|
-
}, 1e3);
|
|
3391
|
-
dataCallFetch(page);
|
|
3392
|
-
};
|
|
3393
|
-
return {
|
|
3394
|
-
jumpingPageNumberRef,
|
|
3395
|
-
paginationScrollIntoViewTarget,
|
|
3396
|
-
pageNumberRef,
|
|
3397
|
-
setPaginationRef,
|
|
3398
|
-
handleReachTerminal,
|
|
3399
|
-
handleClickPageChange
|
|
3400
|
-
};
|
|
3401
|
-
};
|
|
3402
|
-
|
|
3403
|
-
export { ContainerOpenCloseProvider, FlexLayout_default2 as FlexLayout, FlexLayoutContainer_default as FlexLayoutContainer, FlexLayoutResizePanel_default as FlexLayoutResizePanel, FlexLayoutSplitScreen_default as FlexLayoutSplitScreen, FlexLayoutSplitScreenDragBox, FlexLayoutSplitScreenScrollBox_default as FlexLayoutSplitScreenScrollBox, FlexLayoutStickyBox_default as FlexLayoutStickyBox, allSplitScreenCount, closeFlex, containerOpenCloseSubjectMap, containerSpreadSubjectMap, dragState, dropMovementEventSubject, findNotCloseFlexContent, flexContainerStore, flexResizePanelStore, folderEventSubject, getClientXy, getContainerRef, getCurrentSplitScreenComponents, getGrow, getLayoutInfos, getResizePanelRef, getScrollPosition, getSplitScreen, isDocumentOut, isOverMove, layoutSplitScreenStore, mathGrow, mathWeight, openFlex, remain, removeScrollPosition, removeSplitScreenChild, resetRootSplitScreen, resize, scrollPositions, setContainerRef, setFolderEvent, setResizePanelRef, setScrollPosition, setSplitScreen, useContainerSize, useContainers, useDecompositionLayout, useDoubleClick, useDragCapture, useDragEvents, useFolderEvent, useLayoutName, useListPagingForSentinel, usePaginationViewNumber, usePagingHandler };
|
|
1
|
+
export { FlexLayout_default as FlexLayout, FlexLayoutContainer_default as FlexLayoutContainer, FlexLayoutResizePanel_default as FlexLayoutResizePanel, FlexLayoutSplitScreen_default as FlexLayoutSplitScreen, FlexLayoutSplitScreenDragBox, FlexLayoutSplitScreenScrollBox_default as FlexLayoutSplitScreenScrollBox, FlexLayoutStickyBox_default as FlexLayoutStickyBox } from './chunk-UYI4Z27V.js';
|
|
2
|
+
export { useListPagingForSentinel, usePaginationViewNumber, usePagingHandler } from './chunk-5HWEFTNQ.js';
|
|
3
|
+
export { allSplitScreenCount, dragState, dropMovementEventSubject, folderEventSubject, setFolderEvent, useDragCapture, useDragEvents, useFolderEvent } from './chunk-PMTZFSP4.js';
|
|
4
|
+
import './chunk-7J5JUVZK.js';
|
|
5
|
+
import './chunk-YIHCWXKY.js';
|
|
6
|
+
import './chunk-3EDKZTM3.js';
|
|
7
|
+
export { ContainerOpenCloseProvider, containerOpenCloseSubjectMap, containerSpreadSubjectMap, useContainerSize, useContainers, useDecompositionLayout, useDoubleClick, useLayoutName } from './chunk-JM3CZ5DU.js';
|
|
8
|
+
export { closeFlex, findNotCloseFlexContent, getClientXy, getGrow, isDocumentOut, isOverMove, mathGrow, mathWeight, openFlex, remain, resize } from './chunk-W4CNFJTK.js';
|
|
9
|
+
export { flexContainerStore, flexResizePanelStore, getContainerRef, getCurrentSplitScreenComponents, getLayoutInfos, getResizePanelRef, getScrollPosition, getSplitScreen, layoutSplitScreenStore, removeScrollPosition, removeSplitScreenChild, resetRootSplitScreen, scrollPositions, setContainerRef, setResizePanelRef, setScrollPosition, setSplitScreen } from './chunk-CFQQ6ZDC.js';
|
|
3404
10
|
//# sourceMappingURL=index.js.map
|
|
3405
11
|
//# sourceMappingURL=index.js.map
|