@byeolnaerim/flex-layout 0.0.9 → 0.0.12

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.
Files changed (132) hide show
  1. package/dist/flex-layout/components/FlexLayout.cjs +1 -110
  2. package/dist/flex-layout/components/FlexLayout.d.ts +2 -1
  3. package/dist/flex-layout/components/FlexLayout.js +1 -85
  4. package/dist/flex-layout/components/FlexLayoutContainer.cjs +1 -262
  5. package/dist/flex-layout/components/FlexLayoutContainer.d.ts +1 -1
  6. package/dist/flex-layout/components/FlexLayoutContainer.js +1 -232
  7. package/dist/flex-layout/components/FlexLayoutDynamicHeight.cjs +1 -0
  8. package/dist/flex-layout/components/FlexLayoutDynamicHeight.d.ts +6 -0
  9. package/dist/flex-layout/components/FlexLayoutDynamicHeight.js +1 -0
  10. package/dist/flex-layout/components/FlexLayoutIFramePane.cjs +1 -68
  11. package/dist/flex-layout/components/FlexLayoutIFramePane.js +1 -44
  12. package/dist/flex-layout/components/FlexLayoutResizePanel.cjs +1 -246
  13. package/dist/flex-layout/components/FlexLayoutResizePanel.js +1 -216
  14. package/dist/flex-layout/components/FlexLayoutSplitScreen.cjs +1 -1252
  15. package/dist/flex-layout/components/FlexLayoutSplitScreen.d.ts +14 -1
  16. package/dist/flex-layout/components/FlexLayoutSplitScreen.js +1 -1236
  17. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.cjs +1 -532
  18. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.js +1 -509
  19. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.cjs +1 -55
  20. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.js +1 -25
  21. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.cjs +1 -63
  22. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.js +1 -33
  23. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.cjs +1 -53
  24. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.js +1 -23
  25. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.cjs +1 -133
  26. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.js +1 -107
  27. package/dist/flex-layout/components/FlexLayoutStickyBox.cjs +1 -245
  28. package/dist/flex-layout/components/FlexLayoutStickyBox.js +1 -229
  29. package/dist/flex-layout/components/index.cjs +1 -57
  30. package/dist/flex-layout/components/index.d.ts +1 -0
  31. package/dist/flex-layout/components/index.js +1 -17
  32. package/dist/flex-layout/hooks/index.cjs +1 -25
  33. package/dist/flex-layout/hooks/index.js +1 -3
  34. package/dist/flex-layout/hooks/useDrag.cjs +1 -289
  35. package/dist/flex-layout/hooks/useDrag.d.ts +15 -0
  36. package/dist/flex-layout/hooks/useDrag.js +1 -258
  37. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.cjs +1 -139
  38. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.js +1 -118
  39. package/dist/flex-layout/hooks/useListPaging.cjs +1 -212
  40. package/dist/flex-layout/hooks/useListPaging.js +1 -191
  41. package/dist/flex-layout/hooks/useSizes.cjs +1 -126
  42. package/dist/flex-layout/hooks/useSizes.d.ts +6 -3
  43. package/dist/flex-layout/hooks/useSizes.js +1 -101
  44. package/dist/flex-layout/index.cjs +1 -31
  45. package/dist/flex-layout/index.js +1 -6
  46. package/dist/flex-layout/providers/FlexLayoutContext.cjs +1 -49
  47. package/dist/flex-layout/providers/FlexLayoutContext.js +1 -24
  48. package/dist/flex-layout/providers/FlexLayoutHooks.cjs +1 -276
  49. package/dist/flex-layout/providers/FlexLayoutHooks.d.ts +5 -1
  50. package/dist/flex-layout/providers/FlexLayoutHooks.js +1 -263
  51. package/dist/flex-layout/providers/index.cjs +1 -23
  52. package/dist/flex-layout/providers/index.js +1 -2
  53. package/dist/flex-layout/store/FlexLayoutContainerStore.cjs +1 -257
  54. package/dist/flex-layout/store/FlexLayoutContainerStore.js +1 -206
  55. package/dist/flex-layout/store/index.cjs +1 -23
  56. package/dist/flex-layout/store/index.js +1 -2
  57. package/dist/flex-layout/styles/FlexLayout.module.css +499 -416
  58. package/dist/flex-layout/styles/sentinelStyle.module.css +11 -0
  59. package/dist/flex-layout/types/FlexDirectionTypes.cjs +1 -17
  60. package/dist/flex-layout/types/FlexDirectionTypes.js +0 -1
  61. package/dist/flex-layout/types/FlexLayoutTypes.cjs +1 -17
  62. package/dist/flex-layout/types/FlexLayoutTypes.d.ts +38 -2
  63. package/dist/flex-layout/types/FlexLayoutTypes.js +0 -1
  64. package/dist/flex-layout/utils/FlexLayoutUtils.cjs +1 -245
  65. package/dist/flex-layout/utils/FlexLayoutUtils.js +1 -211
  66. package/dist/flex-layout/utils/index.cjs +1 -23
  67. package/dist/flex-layout/utils/index.js +1 -2
  68. package/dist/index.cjs +1 -23
  69. package/dist/index.js +1 -2
  70. package/dist/types/css.d.cjs +0 -1
  71. package/dist/types/css.d.js +0 -1
  72. package/package.json +116 -113
  73. package/dist/flex-layout/components/FlexLayout.cjs.map +0 -1
  74. package/dist/flex-layout/components/FlexLayout.js.map +0 -1
  75. package/dist/flex-layout/components/FlexLayoutContainer.cjs.map +0 -1
  76. package/dist/flex-layout/components/FlexLayoutContainer.js.map +0 -1
  77. package/dist/flex-layout/components/FlexLayoutIFramePane.cjs.map +0 -1
  78. package/dist/flex-layout/components/FlexLayoutIFramePane.js.map +0 -1
  79. package/dist/flex-layout/components/FlexLayoutResizePanel.cjs.map +0 -1
  80. package/dist/flex-layout/components/FlexLayoutResizePanel.js.map +0 -1
  81. package/dist/flex-layout/components/FlexLayoutSplitScreen.cjs.map +0 -1
  82. package/dist/flex-layout/components/FlexLayoutSplitScreen.js.map +0 -1
  83. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.cjs.map +0 -1
  84. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.js.map +0 -1
  85. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.cjs.map +0 -1
  86. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.js.map +0 -1
  87. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.cjs.map +0 -1
  88. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.js.map +0 -1
  89. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.cjs.map +0 -1
  90. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.js.map +0 -1
  91. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.cjs.map +0 -1
  92. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.js.map +0 -1
  93. package/dist/flex-layout/components/FlexLayoutStickyBox.cjs.map +0 -1
  94. package/dist/flex-layout/components/FlexLayoutStickyBox.js.map +0 -1
  95. package/dist/flex-layout/components/index.cjs.map +0 -1
  96. package/dist/flex-layout/components/index.js.map +0 -1
  97. package/dist/flex-layout/hooks/index.cjs.map +0 -1
  98. package/dist/flex-layout/hooks/index.js.map +0 -1
  99. package/dist/flex-layout/hooks/useDrag.cjs.map +0 -1
  100. package/dist/flex-layout/hooks/useDrag.js.map +0 -1
  101. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.cjs.map +0 -1
  102. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.js.map +0 -1
  103. package/dist/flex-layout/hooks/useListPaging.cjs.map +0 -1
  104. package/dist/flex-layout/hooks/useListPaging.js.map +0 -1
  105. package/dist/flex-layout/hooks/useSizes.cjs.map +0 -1
  106. package/dist/flex-layout/hooks/useSizes.js.map +0 -1
  107. package/dist/flex-layout/index.cjs.map +0 -1
  108. package/dist/flex-layout/index.js.map +0 -1
  109. package/dist/flex-layout/providers/FlexLayoutContext.cjs.map +0 -1
  110. package/dist/flex-layout/providers/FlexLayoutContext.js.map +0 -1
  111. package/dist/flex-layout/providers/FlexLayoutHooks.cjs.map +0 -1
  112. package/dist/flex-layout/providers/FlexLayoutHooks.js.map +0 -1
  113. package/dist/flex-layout/providers/index.cjs.map +0 -1
  114. package/dist/flex-layout/providers/index.js.map +0 -1
  115. package/dist/flex-layout/store/FlexLayoutContainerStore.cjs.map +0 -1
  116. package/dist/flex-layout/store/FlexLayoutContainerStore.js.map +0 -1
  117. package/dist/flex-layout/store/index.cjs.map +0 -1
  118. package/dist/flex-layout/store/index.js.map +0 -1
  119. package/dist/flex-layout/types/FlexDirectionTypes.cjs.map +0 -1
  120. package/dist/flex-layout/types/FlexDirectionTypes.js.map +0 -1
  121. package/dist/flex-layout/types/FlexLayoutTypes.cjs.map +0 -1
  122. package/dist/flex-layout/types/FlexLayoutTypes.js.map +0 -1
  123. package/dist/flex-layout/utils/FlexLayoutUtils.cjs.map +0 -1
  124. package/dist/flex-layout/utils/FlexLayoutUtils.js.map +0 -1
  125. package/dist/flex-layout/utils/index.cjs.map +0 -1
  126. package/dist/flex-layout/utils/index.js.map +0 -1
  127. package/dist/index.cjs.map +0 -1
  128. package/dist/index.js.map +0 -1
  129. package/dist/metafile-cjs.json +0 -1
  130. package/dist/metafile-esm.json +0 -1
  131. package/dist/types/css.d.cjs.map +0 -1
  132. package/dist/types/css.d.js.map +0 -1
@@ -1,1236 +1 @@
1
- "use client";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import {
4
- cloneElement,
5
- useEffect,
6
- useRef,
7
- useState
8
- } from "react";
9
- import {
10
- dropMovementEventSubject
11
- } from "../hooks/useDrag";
12
- import { useFlexLayoutSplitScreen } from "../hooks/useFlexLayoutSplitScreen";
13
- import {
14
- getCurrentSplitScreenComponents,
15
- getSplitScreen,
16
- removeRootSplitScreen,
17
- removeSplitScreenChild,
18
- resetRootSplitScreen,
19
- setSplitScreen
20
- } from "../store/FlexLayoutContainerStore";
21
- import styles from "../styles/FlexLayout.module.css";
22
- import FlexLayout from "./FlexLayout";
23
- import FlexLayoutContainer from "./FlexLayoutContainer";
24
- import FlexLayoutSplitScreenDragBox from "./FlexLayoutSplitScreenDragBox";
25
- import equal from "fast-deep-equal";
26
- import { distinctUntilChanged, take } from "rxjs";
27
- import FlexLayoutSplitScreenDragBoxContainer from "./FlexLayoutSplitScreenDragBoxContainer";
28
- import FlexLayoutSplitScreenDragBoxItem from "./FlexLayoutSplitScreenDragBoxItem";
29
- import FlexLayoutSplitScreenDragBoxTitleMore from "./FlexLayoutSplitScreenDragBoxTitleMore";
30
- import FlexLayoutSplitScreenScrollBox from "./FlexLayoutSplitScreenScrollBox";
31
- function isOverDrop({
32
- x,
33
- y,
34
- element
35
- }) {
36
- const {
37
- x: elementX,
38
- y: elementY,
39
- right: elementRight,
40
- bottom: elementBottom
41
- } = element.getBoundingClientRect();
42
- const isElementOver = x < elementX || x > elementRight || y < elementY || y > elementBottom;
43
- return isElementOver;
44
- }
45
- function isInnerDrop({
46
- x,
47
- y,
48
- element
49
- }) {
50
- const {
51
- x: elementX,
52
- y: elementY,
53
- right: elementRight,
54
- bottom: elementBottom
55
- } = element.getBoundingClientRect();
56
- const isElementInner = x >= elementX && x <= elementRight && y >= elementY && y <= elementBottom;
57
- return isElementInner;
58
- }
59
- const handleUpdateDropTargetComponents = ({
60
- orderName,
61
- parentOrderName,
62
- containerName,
63
- parentLayoutName,
64
- layoutName,
65
- dropComponent,
66
- navigationTitle,
67
- nextContainerName,
68
- isUsePrefix = true,
69
- beforeDropTargetComponent,
70
- afterDropTargetComponent,
71
- centerDropTargetComponent,
72
- dropDocumentOutsideOption,
73
- screenKey = Array.from(
74
- window.crypto.getRandomValues(new Uint32Array(16)),
75
- (e) => e.toString(32).padStart(2, "0")
76
- ).join("")
77
- }) => {
78
- const nextContainerNameOrderName = parentOrderName ? parentOrderName : orderName;
79
- let listMap;
80
- let list;
81
- let key;
82
- if (nextContainerNameOrderName === orderName || nextContainerNameOrderName === "center") {
83
- listMap = orderName === "before" ? { beforeDropTargetComponent } : orderName === "after" ? { afterDropTargetComponent } : {
84
- centerDropTargetComponent: centerDropTargetComponent.filter(
85
- (e) => !e.containerName.split("_").at(0).startsWith(
86
- containerName.split("_").at(0)
87
- )
88
- )
89
- };
90
- } else {
91
- listMap = nextContainerNameOrderName === "before" ? { beforeDropTargetComponent } : { afterDropTargetComponent };
92
- }
93
- const entries = Object.entries(listMap)[0];
94
- key = entries[0];
95
- list = entries[1];
96
- const newComponent = {
97
- containerName: `${containerName + "_" + layoutName}${isUsePrefix ? "_" + orderName + "-" + list.length : ""}`,
98
- component: cloneElement(
99
- dropComponent,
100
- { key: screenKey, screenKey }
101
- ),
102
- navigationTitle,
103
- dropDocumentOutsideOption,
104
- screenKey: screenKey || Array.from(
105
- window.crypto.getRandomValues(new Uint32Array(16)),
106
- (e) => e.toString(32).padStart(2, "0")
107
- ).join("")
108
- };
109
- let allComponents;
110
- if (nextContainerName) {
111
- const index = list.findIndex(
112
- (item) => item.containerName === nextContainerName
113
- );
114
- if (index !== -1) {
115
- if (nextContainerNameOrderName === orderName) {
116
- if (orderName === "before") {
117
- allComponents = [
118
- ...list.slice(0, index),
119
- newComponent,
120
- ...list.slice(index)
121
- ];
122
- } else {
123
- allComponents = [
124
- ...list.slice(0, index + 1),
125
- newComponent,
126
- ...list.slice(index + 1)
127
- ];
128
- }
129
- } else {
130
- if (nextContainerNameOrderName === "after" && orderName === "before") {
131
- allComponents = [
132
- ...list.slice(0, index),
133
- newComponent,
134
- ...list.slice(index)
135
- ];
136
- } else if (nextContainerNameOrderName === "before" && orderName === "after") {
137
- allComponents = [
138
- ...list.slice(0, index + 1),
139
- newComponent,
140
- ...list.slice(index + 1)
141
- ];
142
- } else {
143
- if (orderName === "before") {
144
- allComponents = [
145
- ...list.slice(0, index),
146
- newComponent,
147
- ...list.slice(index)
148
- ];
149
- } else {
150
- allComponents = [
151
- ...list.slice(0, index + 1),
152
- newComponent,
153
- ...list.slice(index + 1)
154
- ];
155
- }
156
- }
157
- }
158
- } else {
159
- if (nextContainerNameOrderName === "center" && orderName === "after") {
160
- allComponents = [newComponent, ...list];
161
- } else if (nextContainerNameOrderName === "center" && orderName === "before") {
162
- allComponents = [...list, newComponent];
163
- } else {
164
- allComponents = orderName === "before" ? [newComponent, ...list] : [...list, newComponent];
165
- }
166
- }
167
- } else {
168
- allComponents = orderName === "before" ? [newComponent, ...list] : [...list, newComponent];
169
- }
170
- const seen = /* @__PURE__ */ new Set();
171
- const result = allComponents.filter((item) => {
172
- if (seen.has(item.containerName)) {
173
- return false;
174
- }
175
- seen.add(item.containerName);
176
- return true;
177
- });
178
- dropMovementEventSubject.next({
179
- state: "append",
180
- targetParentLayoutName: parentLayoutName,
181
- targetLayoutName: layoutName,
182
- targetContainerName: containerName,
183
- orderName
184
- });
185
- return { [key]: result };
186
- };
187
- const handleRemove = (list, targetContainerName, orderNameSetter) => {
188
- const result = list.filter((e) => e.containerName !== targetContainerName);
189
- if (result.length != list.length)
190
- orderNameSetter(list.length - result.length);
191
- return result;
192
- };
193
- function getAdjacentItem(items, currentIndex) {
194
- if (currentIndex + 1 < items.length) {
195
- return {
196
- adjacentItem: items[currentIndex + 1],
197
- adjacentIndex: currentIndex + 1
198
- };
199
- } else if (currentIndex - 1 >= 0) {
200
- return {
201
- adjacentItem: items[currentIndex - 1],
202
- adjacentIndex: currentIndex - 1
203
- };
204
- }
205
- return { adjacentItem: null, adjacentIndex: currentIndex };
206
- }
207
- const getSelfOrderName = (containerName) => {
208
- const result = containerName.split("_").at(-1)?.split("-").at(0)?.split("=").at(0);
209
- if (["before", "center", "after"].some((e) => e === result)) {
210
- return result;
211
- } else {
212
- return;
213
- }
214
- };
215
- function FlexLayoutSplitScreen({
216
- children,
217
- containerName,
218
- layoutName,
219
- navigationTitle,
220
- dropDocumentOutsideOption,
221
- screenKey
222
- }) {
223
- const {
224
- direction,
225
- isSplit,
226
- boundaryContainerSize,
227
- afterDropTargetComponent,
228
- beforeDropTargetComponent,
229
- centerDropTargetComponent,
230
- setAfterDropTargetComponent,
231
- setBeforeDropTargetComponent,
232
- setCenterDropTargetComponent,
233
- layoutRef,
234
- setIsSplit,
235
- setDirection
236
- } = useFlexLayoutSplitScreen({
237
- isSplitInitial: false,
238
- directionInitial: "row",
239
- selfContainerName: containerName,
240
- parentLayoutName: "",
241
- layoutName
242
- });
243
- useEffect(() => {
244
- resetRootSplitScreen(layoutName);
245
- const subscribe = getSplitScreen(layoutName, layoutName).subscribe((layoutInfo) => {
246
- if (layoutInfo) {
247
- setBeforeDropTargetComponent([
248
- ...layoutInfo.beforeDropTargetComponent
249
- ]);
250
- setAfterDropTargetComponent([
251
- ...layoutInfo.afterDropTargetComponent
252
- ]);
253
- setCenterDropTargetComponent([
254
- ...layoutInfo.centerDropTargetComponent
255
- ]);
256
- setDirection(layoutInfo.direction);
257
- if (layoutInfo.beforeDropTargetComponent.length !== 0 || layoutInfo.afterDropTargetComponent.length !== 0) {
258
- setIsSplit(true);
259
- }
260
- } else {
261
- setSplitScreen(layoutName, layoutName, {
262
- afterDropTargetComponent: [],
263
- beforeDropTargetComponent: [],
264
- centerDropTargetComponent: [
265
- {
266
- containerName,
267
- component: children,
268
- navigationTitle,
269
- dropDocumentOutsideOption,
270
- screenKey: screenKey ? screenKey : Array.from(
271
- window.crypto.getRandomValues(
272
- new Uint32Array(16)
273
- ),
274
- (e) => e.toString(32).padStart(2, "0")
275
- ).join("")
276
- }
277
- ],
278
- direction
279
- });
280
- }
281
- });
282
- return () => {
283
- subscribe.unsubscribe();
284
- removeRootSplitScreen(layoutName);
285
- };
286
- }, [layoutName, screenKey, navigationTitle, children, direction]);
287
- useEffect(() => {
288
- const subscribe = dropMovementEventSubject.pipe(
289
- distinctUntilChanged((prev, curr) => {
290
- const filterChildren = (obj) => {
291
- const {
292
- children: children2,
293
- component,
294
- targetComponent,
295
- x,
296
- y,
297
- ...rest
298
- } = obj || {};
299
- return rest;
300
- };
301
- return equal(filterChildren(prev), filterChildren(curr));
302
- })
303
- ).subscribe((event) => {
304
- if (event.state === "remove") {
305
- if (event.targetParentLayoutName === layoutName || event.targetParentLayoutName === "" && event.targetLayoutName === layoutName) {
306
- requestAnimationFrame(() => {
307
- let removeCallback = (removeOrderName) => {
308
- if (event.nextContainerName && event.dropTargetComponentEvent && event.targetComponent) {
309
- const targetComponentsMap = handleUpdateDropTargetComponents({
310
- orderName: removeOrderName,
311
- containerName: event.nextContainerName,
312
- parentLayoutName: "",
313
- layoutName,
314
- dropComponent: event.targetComponent,
315
- navigationTitle: event.dropTargetComponentEvent.navigationTitle,
316
- isUsePrefix: true,
317
- afterDropTargetComponent,
318
- beforeDropTargetComponent,
319
- centerDropTargetComponent,
320
- dropDocumentOutsideOption,
321
- screenKey: event.dropTargetComponentEvent.screenKey
322
- });
323
- setSplitScreen(layoutName, layoutName, {
324
- ...getCurrentSplitScreenComponents(
325
- layoutName,
326
- layoutName
327
- ) || {
328
- afterDropTargetComponent,
329
- beforeDropTargetComponent,
330
- centerDropTargetComponent,
331
- direction
332
- },
333
- ...targetComponentsMap
334
- });
335
- Promise.resolve().then(
336
- () => event.dropEndCallback && event.dropEndCallback({
337
- x: event.x,
338
- y: event.y,
339
- containerName
340
- })
341
- );
342
- }
343
- };
344
- const currentComponents = getCurrentSplitScreenComponents(
345
- layoutName,
346
- layoutName
347
- );
348
- const afterList = handleRemove(
349
- currentComponents?.afterDropTargetComponent || afterDropTargetComponent,
350
- event.targetContainerName,
351
- () => removeCallback("after")
352
- );
353
- const beforList = handleRemove(
354
- currentComponents?.beforeDropTargetComponent || beforeDropTargetComponent,
355
- event.targetContainerName,
356
- () => removeCallback("before")
357
- );
358
- const centerList = handleRemove(
359
- currentComponents?.centerDropTargetComponent || centerDropTargetComponent,
360
- event.targetContainerName,
361
- () => removeCallback("center")
362
- );
363
- setSplitScreen(layoutName, layoutName, {
364
- afterDropTargetComponent: afterList,
365
- beforeDropTargetComponent: beforList,
366
- centerDropTargetComponent: centerList,
367
- direction
368
- });
369
- });
370
- }
371
- } else if (event.state === "append") {
372
- const {
373
- x,
374
- y,
375
- dropEndCallback,
376
- dropTargetComponentEvent,
377
- orderName,
378
- parentOrderName,
379
- targetLayoutName,
380
- targetParentLayoutName,
381
- targetContainerName,
382
- targetComponent,
383
- nextContainerName
384
- } = event;
385
- if (layoutRef.current && orderName && x && y && targetComponent && dropTargetComponentEvent && targetLayoutName === layoutName && isInnerDrop({ x, y, element: layoutRef.current })) {
386
- const {
387
- direction: dropDirection,
388
- navigationTitle: navigationTitle2,
389
- dropDocumentOutsideOption: dropDocumentOutsideOption2
390
- } = dropTargetComponentEvent;
391
- const isOrderNameNotCenter = orderName !== "center";
392
- const isOrderNameCenterAndFirstScreen = orderName === "center" && centerDropTargetComponent.length <= 1;
393
- if (isOrderNameNotCenter || isOrderNameCenterAndFirstScreen) {
394
- setIsSplit(true);
395
- if (isOrderNameNotCenter) {
396
- setDirection(dropDirection);
397
- const targetComponentsMap = handleUpdateDropTargetComponents({
398
- orderName,
399
- parentOrderName,
400
- containerName: targetContainerName,
401
- nextContainerName,
402
- dropComponent: targetComponent,
403
- parentLayoutName: "",
404
- layoutName,
405
- navigationTitle: navigationTitle2,
406
- isUsePrefix: true,
407
- afterDropTargetComponent,
408
- beforeDropTargetComponent,
409
- centerDropTargetComponent,
410
- dropDocumentOutsideOption: dropDocumentOutsideOption2
411
- });
412
- setSplitScreen(layoutName, layoutName, {
413
- ...{
414
- afterDropTargetComponent,
415
- beforeDropTargetComponent,
416
- centerDropTargetComponent,
417
- direction: dropDirection
418
- },
419
- ...targetComponentsMap,
420
- ...{ direction: dropDirection }
421
- });
422
- Promise.resolve().then(
423
- () => dropEndCallback && dropEndCallback({
424
- x: event.x,
425
- y: event.y,
426
- containerName
427
- })
428
- );
429
- } else {
430
- const childScreenInfo = getCurrentSplitScreenComponents(
431
- layoutName,
432
- `${layoutName}_center=${centerDropTargetComponent[0].screenKey}`
433
- ) || {
434
- afterDropTargetComponent: [],
435
- beforeDropTargetComponent: [],
436
- centerDropTargetComponent: [],
437
- direction
438
- };
439
- setSplitScreen(
440
- layoutName,
441
- `${layoutName}_center=${centerDropTargetComponent[0].screenKey}`,
442
- {
443
- ...childScreenInfo,
444
- ...{
445
- centerDropTargetComponent: [
446
- centerDropTargetComponent[0],
447
- {
448
- containerName: `${targetContainerName}_${layoutName}_${orderName}`,
449
- component: targetComponent,
450
- dropDocumentOutsideOption: dropDocumentOutsideOption2,
451
- screenKey: dropTargetComponentEvent.screenKey,
452
- navigationTitle: navigationTitle2
453
- }
454
- ]
455
- }
456
- }
457
- );
458
- }
459
- }
460
- }
461
- }
462
- });
463
- return () => {
464
- subscribe.unsubscribe();
465
- };
466
- }, [
467
- direction,
468
- layoutName,
469
- isSplit,
470
- beforeDropTargetComponent,
471
- afterDropTargetComponent,
472
- centerDropTargetComponent
473
- ]);
474
- return /* @__PURE__ */ jsxs("div", { className: `${styles["flex-split-screen"]}`, ref: layoutRef, children: [
475
- /* @__PURE__ */ jsxs(
476
- FlexLayout,
477
- {
478
- direction,
479
- layoutName,
480
- "data-is_split": isSplit,
481
- panelMovementMode: "bulldozer",
482
- children: [
483
- beforeDropTargetComponent.length != 0 ? /* @__PURE__ */ jsx(Fragment, { children: beforeDropTargetComponent.map(
484
- ({
485
- containerName: cName,
486
- component,
487
- navigationTitle: navigationTitle2,
488
- dropDocumentOutsideOption: dropDocumentOutsideOption2,
489
- screenKey: screenKey2
490
- }, i) => /* @__PURE__ */ jsx(
491
- FlexLayoutContainer,
492
- {
493
- containerName: cName,
494
- isInitialResizable: true,
495
- isResizePanel: true,
496
- children: /* @__PURE__ */ jsx(
497
- FlexLayoutSplitScreenChild,
498
- {
499
- parentDirection: direction,
500
- layoutName: `${layoutName}_before`,
501
- parentLayoutName: layoutName,
502
- containerName: cName,
503
- depth: 1,
504
- rootRef: layoutRef,
505
- screenKey: screenKey2,
506
- initialCenterComponents: [
507
- {
508
- navigationTitle: navigationTitle2,
509
- component,
510
- containerName: cName,
511
- dropDocumentOutsideOption: dropDocumentOutsideOption2,
512
- screenKey: screenKey2
513
- }
514
- ],
515
- rootName: layoutName
516
- }
517
- )
518
- },
519
- cName
520
- )
521
- ) }) : /* @__PURE__ */ jsx("div", {}),
522
- centerDropTargetComponent.length === 0 ? /* @__PURE__ */ jsx("div", {}) : /* @__PURE__ */ jsx(
523
- FlexLayoutContainer,
524
- {
525
- containerName: `${centerDropTargetComponent[0].containerName}`,
526
- isInitialResizable: true,
527
- isResizePanel: isSplit,
528
- children: isSplit ? /* @__PURE__ */ jsx(
529
- FlexLayoutSplitScreenChild,
530
- {
531
- parentDirection: direction,
532
- layoutName: `${layoutName}_center`,
533
- parentLayoutName: layoutName,
534
- containerName: `${centerDropTargetComponent[0].containerName}`,
535
- depth: 0,
536
- rootRef: layoutRef,
537
- screenKey: centerDropTargetComponent[0].screenKey,
538
- initialCenterComponents: [
539
- {
540
- navigationTitle: centerDropTargetComponent[0].navigationTitle,
541
- component: centerDropTargetComponent[0].component,
542
- containerName: centerDropTargetComponent[0].containerName,
543
- dropDocumentOutsideOption: centerDropTargetComponent[0].dropDocumentOutsideOption,
544
- screenKey: centerDropTargetComponent[0].screenKey
545
- }
546
- ],
547
- rootName: layoutName
548
- }
549
- ) : /* @__PURE__ */ jsx(
550
- FlexLayoutSplitScreenScrollBox,
551
- {
552
- keyName: centerDropTargetComponent[0].containerName,
553
- isDefaultScrollStyle: true,
554
- children: centerDropTargetComponent[0].component
555
- }
556
- )
557
- }
558
- ),
559
- afterDropTargetComponent.length != 0 ? /* @__PURE__ */ jsx(Fragment, { children: afterDropTargetComponent.map(
560
- ({
561
- containerName: cName,
562
- component,
563
- navigationTitle: navigationTitle2,
564
- dropDocumentOutsideOption: dropDocumentOutsideOption2,
565
- screenKey: screenKey2
566
- }, i) => /* @__PURE__ */ jsx(
567
- FlexLayoutContainer,
568
- {
569
- containerName: cName,
570
- isInitialResizable: true,
571
- isResizePanel: afterDropTargetComponent.length - 1 !== i,
572
- children: /* @__PURE__ */ jsx(
573
- FlexLayoutSplitScreenChild,
574
- {
575
- parentDirection: direction,
576
- layoutName: `${layoutName}_after`,
577
- parentLayoutName: layoutName,
578
- containerName: cName,
579
- depth: 1,
580
- rootRef: layoutRef,
581
- screenKey: screenKey2,
582
- initialCenterComponents: [
583
- {
584
- navigationTitle: navigationTitle2,
585
- component,
586
- containerName: cName,
587
- dropDocumentOutsideOption: dropDocumentOutsideOption2,
588
- screenKey: screenKey2
589
- }
590
- ],
591
- rootName: layoutName
592
- }
593
- )
594
- },
595
- cName
596
- )
597
- ) }) : /* @__PURE__ */ jsx("div", {})
598
- ]
599
- }
600
- ),
601
- boundaryContainerSize && /* @__PURE__ */ jsx(
602
- "div",
603
- {
604
- className: `${styles["flex-split-screen-boundary-container"]}`,
605
- style: { ...boundaryContainerSize },
606
- children: "\u2B07\uFE0F\uB4DC\uB86D\uD558\uBA74 \uD654\uBA74\uC774 \uBD84\uD560\uB429\uB2C8\uB2E4."
607
- }
608
- )
609
- ] });
610
- }
611
- function FlexLayoutSplitScreenChild({
612
- containerName,
613
- layoutName,
614
- parentLayoutName,
615
- parentDirection,
616
- depth,
617
- //isSplit: isSplitInitial,
618
- rootRef,
619
- rootName,
620
- initialCenterComponents,
621
- screenKey
622
- }) {
623
- const {
624
- direction,
625
- isSplit,
626
- boundaryContainerSize,
627
- afterDropTargetComponent,
628
- beforeDropTargetComponent,
629
- centerDropTargetComponent,
630
- setAfterDropTargetComponent,
631
- setBeforeDropTargetComponent,
632
- setCenterDropTargetComponent,
633
- layoutRef,
634
- setIsSplit,
635
- setDirection
636
- } = useFlexLayoutSplitScreen({
637
- isSplitInitial: false,
638
- directionInitial: "row",
639
- parentDirection,
640
- selfContainerName: containerName,
641
- parentLayoutName,
642
- layoutName
643
- });
644
- const [isEmptyContent, setIsEmptyContent] = useState(false);
645
- const [activeIndex, setActiveIndex] = useState(0);
646
- const centerDropTargetComponentRef = useRef(centerDropTargetComponent);
647
- const initialCenterRef = useRef(
648
- initialCenterComponents ?? []
649
- );
650
- const activeIndexRef = useRef(activeIndex);
651
- useEffect(() => {
652
- const storeKey = `${layoutName}=${screenKey}`;
653
- const subscribe = getSplitScreen(rootName, storeKey).pipe(take(1)).subscribe((layoutInfo) => {
654
- if (layoutInfo) return;
655
- setSplitScreen(rootName, storeKey, {
656
- afterDropTargetComponent: [],
657
- beforeDropTargetComponent: [],
658
- centerDropTargetComponent: initialCenterRef.current,
659
- direction
660
- });
661
- });
662
- return () => {
663
- removeSplitScreenChild(rootName, `${layoutName}=${screenKey}`);
664
- subscribe.unsubscribe();
665
- };
666
- }, [rootName, layoutName, screenKey]);
667
- useEffect(() => {
668
- const subscribe = getSplitScreen(rootName, `${layoutName}=${screenKey}`).subscribe((layoutInfo) => {
669
- if (layoutInfo) {
670
- setBeforeDropTargetComponent([
671
- ...layoutInfo.beforeDropTargetComponent
672
- ]);
673
- setAfterDropTargetComponent([
674
- ...layoutInfo.afterDropTargetComponent
675
- ]);
676
- setCenterDropTargetComponent([
677
- ...layoutInfo.centerDropTargetComponent
678
- ]);
679
- setDirection(layoutInfo.direction);
680
- if (layoutInfo.beforeDropTargetComponent.length !== 0 || layoutInfo.afterDropTargetComponent.length !== 0) {
681
- setIsSplit(true);
682
- } else if (layoutInfo.beforeDropTargetComponent.length === 0 && layoutInfo.centerDropTargetComponent.length === 0 && layoutInfo.afterDropTargetComponent.length === 0) {
683
- dropMovementEventSubject.next({
684
- state: "remove",
685
- targetContainerName: containerName,
686
- targetParentLayoutName: "",
687
- targetLayoutName: parentLayoutName
688
- });
689
- setIsEmptyContent(true);
690
- }
691
- }
692
- });
693
- return () => {
694
- subscribe.unsubscribe();
695
- removeRootSplitScreen(layoutName);
696
- };
697
- }, [rootName, layoutName]);
698
- useEffect(() => {
699
- const subscribe = dropMovementEventSubject.pipe(
700
- distinctUntilChanged((prev, curr) => {
701
- const filterChildren = (obj) => {
702
- const {
703
- children,
704
- component,
705
- targetComponent,
706
- x,
707
- y,
708
- ...rest
709
- } = obj || {};
710
- return rest;
711
- };
712
- return equal(filterChildren(prev), filterChildren(curr));
713
- })
714
- ).subscribe((event) => {
715
- if (event.state === "remove") {
716
- if (event.targetParentLayoutName === layoutName || event.targetParentLayoutName === "" && event.targetLayoutName === layoutName) {
717
- requestAnimationFrame(() => {
718
- let removeCallback = (removeOrderName) => {
719
- if (event.nextContainerName && event.dropTargetComponentEvent && event.targetComponent) {
720
- const targetComponentsMap = handleUpdateDropTargetComponents({
721
- orderName: removeOrderName,
722
- containerName: event.nextContainerName,
723
- parentLayoutName,
724
- layoutName,
725
- dropComponent: event.targetComponent,
726
- navigationTitle: event.dropTargetComponentEvent.navigationTitle,
727
- isUsePrefix: true,
728
- afterDropTargetComponent,
729
- beforeDropTargetComponent,
730
- centerDropTargetComponent,
731
- dropDocumentOutsideOption: event.dropTargetComponentEvent?.dropDocumentOutsideOption,
732
- screenKey: event.dropTargetComponentEvent.screenKey
733
- });
734
- setSplitScreen(
735
- rootName,
736
- `${layoutName}=${screenKey}`,
737
- {
738
- ...getCurrentSplitScreenComponents(
739
- rootName,
740
- `${layoutName}=${screenKey}`
741
- ) || {
742
- afterDropTargetComponent,
743
- beforeDropTargetComponent,
744
- centerDropTargetComponent,
745
- direction
746
- },
747
- ...targetComponentsMap
748
- }
749
- );
750
- Promise.resolve().then(
751
- () => event.dropEndCallback && event.dropEndCallback({
752
- x: event.x,
753
- y: event.y,
754
- containerName
755
- })
756
- );
757
- }
758
- };
759
- const currentComponents = getCurrentSplitScreenComponents(
760
- rootName,
761
- `${layoutName}=${screenKey}`
762
- );
763
- const afterList = handleRemove(
764
- currentComponents?.afterDropTargetComponent || afterDropTargetComponent,
765
- event.targetContainerName,
766
- () => removeCallback("after")
767
- );
768
- const beforList = handleRemove(
769
- currentComponents?.beforeDropTargetComponent || beforeDropTargetComponent,
770
- event.targetContainerName,
771
- () => removeCallback("before")
772
- );
773
- const centerList = handleRemove(
774
- currentComponents?.centerDropTargetComponent || centerDropTargetComponent,
775
- event.targetContainerName,
776
- () => removeCallback("center")
777
- );
778
- setSplitScreen(
779
- rootName,
780
- `${layoutName}=${screenKey}`,
781
- {
782
- afterDropTargetComponent: afterList,
783
- beforeDropTargetComponent: beforList,
784
- centerDropTargetComponent: centerList,
785
- direction
786
- }
787
- );
788
- });
789
- }
790
- } else if (event.state === "append") {
791
- const {
792
- x,
793
- y,
794
- dropEndCallback,
795
- dropTargetComponentEvent,
796
- orderName,
797
- targetLayoutName,
798
- targetParentLayoutName,
799
- targetContainerName,
800
- targetComponent,
801
- nextContainerName,
802
- parentOrderName
803
- } = event;
804
- if (layoutRef.current && orderName && x && y && dropTargetComponentEvent && isInnerDrop({ x, y, element: layoutRef.current })) {
805
- const {
806
- direction: dropDirection,
807
- navigationTitle,
808
- dropDocumentOutsideOption,
809
- screenKey: containerScreenKey
810
- } = dropTargetComponentEvent;
811
- if (
812
- //orderName !== 'center' &&
813
- targetLayoutName === layoutName && targetComponent
814
- ) {
815
- if (dropDirection === parentDirection && orderName !== "center") {
816
- dropMovementEventSubject.next({
817
- state: "append",
818
- targetContainerName,
819
- targetParentLayoutName: "",
820
- targetLayoutName: parentLayoutName,
821
- targetComponent,
822
- nextContainerName: containerName,
823
- parentOrderName: getSelfOrderName(layoutName) || orderName,
824
- orderName,
825
- x,
826
- y,
827
- dropEndCallback,
828
- dropTargetComponentEvent: {
829
- navigationTitle,
830
- dropDocumentOutsideOption,
831
- direction: parentDirection,
832
- screenKey
833
- }
834
- });
835
- } else {
836
- if (orderName !== "center") {
837
- setDirection(dropDirection);
838
- setIsSplit(true);
839
- }
840
- const targetComponentsMap = handleUpdateDropTargetComponents({
841
- orderName,
842
- parentOrderName,
843
- containerName: targetContainerName,
844
- nextContainerName,
845
- parentLayoutName,
846
- layoutName,
847
- dropComponent: targetComponent,
848
- navigationTitle,
849
- isUsePrefix: orderName !== "center",
850
- afterDropTargetComponent,
851
- beforeDropTargetComponent,
852
- centerDropTargetComponent,
853
- dropDocumentOutsideOption
854
- });
855
- setSplitScreen(
856
- rootName,
857
- `${layoutName}=${screenKey}`,
858
- {
859
- ...getCurrentSplitScreenComponents(
860
- rootName,
861
- `${layoutName}=${screenKey}`
862
- ) || {
863
- afterDropTargetComponent,
864
- beforeDropTargetComponent,
865
- centerDropTargetComponent,
866
- direction
867
- },
868
- ...targetComponentsMap,
869
- ...{ direction: dropDirection }
870
- }
871
- );
872
- Promise.resolve().then(
873
- () => event.dropEndCallback && event.dropEndCallback({
874
- x: event.x,
875
- y: event.y,
876
- containerName
877
- })
878
- );
879
- }
880
- }
881
- }
882
- }
883
- });
884
- return () => {
885
- subscribe.unsubscribe();
886
- };
887
- }, [
888
- direction,
889
- parentDirection,
890
- parentLayoutName,
891
- layoutName,
892
- beforeDropTargetComponent,
893
- afterDropTargetComponent,
894
- centerDropTargetComponent
895
- ]);
896
- useEffect(() => {
897
- centerDropTargetComponentRef.current = centerDropTargetComponent;
898
- }, [centerDropTargetComponent]);
899
- useEffect(() => {
900
- activeIndexRef.current = activeIndex;
901
- }, [activeIndex]);
902
- const [isOnlyOneScreen, setIsOnlyOneScreen] = useState(false);
903
- return /* @__PURE__ */ jsx(Fragment, { children: !isEmptyContent && /* @__PURE__ */ jsxs(
904
- "div",
905
- {
906
- className: `${styles["flex-split-screen"]}`,
907
- ref: layoutRef,
908
- children: [
909
- /* @__PURE__ */ jsxs(
910
- FlexLayout,
911
- {
912
- direction,
913
- layoutName: `${layoutName}`,
914
- panelMovementMode: "bulldozer",
915
- children: [
916
- beforeDropTargetComponent.length != 0 ? /* @__PURE__ */ jsx(Fragment, { children: beforeDropTargetComponent.map(
917
- ({
918
- containerName: cName,
919
- component,
920
- navigationTitle,
921
- dropDocumentOutsideOption,
922
- screenKey: screenKey2
923
- }, i) => /* @__PURE__ */ jsx(
924
- FlexLayoutContainer,
925
- {
926
- containerName: cName,
927
- isInitialResizable: true,
928
- isResizePanel: true,
929
- children: /* @__PURE__ */ jsx(
930
- FlexLayoutSplitScreenChild,
931
- {
932
- parentDirection: direction,
933
- layoutName: `${layoutName}_before-${depth}`,
934
- parentLayoutName: layoutName,
935
- containerName: cName,
936
- depth: depth + 1,
937
- rootRef,
938
- screenKey: screenKey2,
939
- initialCenterComponents: [
940
- {
941
- navigationTitle,
942
- component,
943
- containerName: cName,
944
- dropDocumentOutsideOption,
945
- screenKey: screenKey2
946
- }
947
- ],
948
- rootName
949
- }
950
- )
951
- },
952
- cName
953
- )
954
- ) }) : /* @__PURE__ */ jsx("div", {}),
955
- centerDropTargetComponent.length != 0 ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
956
- FlexLayoutContainer,
957
- {
958
- containerName: `${(centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName}`,
959
- isInitialResizable: true,
960
- isResizePanel: isSplit,
961
- children: isSplit ? /* @__PURE__ */ jsx("div", { "data-key": screenKey, children: /* @__PURE__ */ jsx(
962
- FlexLayoutSplitScreenChild,
963
- {
964
- parentDirection: direction,
965
- layoutName: `${layoutName}_center-${depth}`,
966
- parentLayoutName: layoutName,
967
- containerName: `${(centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName}`,
968
- depth: depth + 1,
969
- rootRef,
970
- initialCenterComponents: centerDropTargetComponent.map(
971
- ({
972
- navigationTitle,
973
- component,
974
- containerName: cName,
975
- dropDocumentOutsideOption,
976
- screenKey: centerScreenKey
977
- }) => ({
978
- navigationTitle,
979
- component,
980
- containerName: cName,
981
- dropDocumentOutsideOption,
982
- screenKey: centerScreenKey
983
- })
984
- ),
985
- screenKey,
986
- rootName
987
- }
988
- ) }) : /* @__PURE__ */ jsxs(
989
- FlexLayoutSplitScreenScrollBox,
990
- {
991
- keyName: (centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName,
992
- isDefaultScrollStyle: true,
993
- children: [
994
- !isOnlyOneScreen && /* @__PURE__ */ jsx(
995
- "div",
996
- {
997
- className: `${styles["flex-split-screen-drag-box-title-wrapper-sticky"]}`,
998
- children: /* @__PURE__ */ jsxs(
999
- "div",
1000
- {
1001
- "data-is_split": isSplit,
1002
- "data-layout_name": layoutName,
1003
- "data-parent_layout_name": parentLayoutName,
1004
- "data-container_name": `${(centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName}`,
1005
- className: `${styles["flex-split-screen-drag-box-title-wrapper"]}`,
1006
- children: [
1007
- /* @__PURE__ */ jsx(
1008
- FlexLayoutSplitScreenDragBoxContainer,
1009
- {
1010
- "data-layout_name": layoutName,
1011
- layoutName,
1012
- children: centerDropTargetComponent.map(
1013
- (item, index) => /* @__PURE__ */ jsx(
1014
- FlexLayoutSplitScreenDragBoxItem,
1015
- {
1016
- onClose: (ev) => {
1017
- if (activeIndexRef.current === index && centerDropTargetComponent.length === 1) {
1018
- dropMovementEventSubject.next(
1019
- {
1020
- state: "remove",
1021
- targetContainerName: containerName,
1022
- targetParentLayoutName: parentLayoutName,
1023
- targetLayoutName: layoutName
1024
- }
1025
- );
1026
- } else {
1027
- if (centerDropTargetComponent.length === activeIndexRef.current + 1) {
1028
- setActiveIndex(
1029
- activeIndexRef.current - 1
1030
- );
1031
- }
1032
- setCenterDropTargetComponent(
1033
- (prev) => {
1034
- const next = handleRemove(
1035
- prev,
1036
- item.containerName,
1037
- () => {
1038
- }
1039
- );
1040
- const key = `${layoutName}=${screenKey}`;
1041
- const current = getCurrentSplitScreenComponents(
1042
- rootName,
1043
- key
1044
- ) || {
1045
- afterDropTargetComponent,
1046
- beforeDropTargetComponent,
1047
- centerDropTargetComponent: prev,
1048
- direction
1049
- };
1050
- setSplitScreen(
1051
- rootName,
1052
- key,
1053
- {
1054
- ...current,
1055
- centerDropTargetComponent: next
1056
- }
1057
- );
1058
- return next;
1059
- }
1060
- );
1061
- }
1062
- },
1063
- isActive: activeIndex === index,
1064
- children: /* @__PURE__ */ jsx(
1065
- FlexLayoutSplitScreenDragBox,
1066
- {
1067
- screenKey: item.screenKey,
1068
- onClick: () => {
1069
- setActiveIndex(
1070
- index
1071
- );
1072
- },
1073
- containerName: item.containerName,
1074
- dropDocumentOutsideOption: item.dropDocumentOutsideOption,
1075
- targetComponent: item.component,
1076
- navigationTitle: item.navigationTitle,
1077
- "data-container-name": item.containerName,
1078
- "data-layout-name": layoutName,
1079
- "data-parent-layout-name": parentLayoutName,
1080
- dropEndCallback: ({
1081
- x,
1082
- y,
1083
- containerName: appendContainerName
1084
- }) => {
1085
- if (!rootRef.current || !layoutRef.current)
1086
- return;
1087
- const isRootOver = isOverDrop(
1088
- {
1089
- x,
1090
- y,
1091
- element: rootRef.current
1092
- }
1093
- );
1094
- const isLayoutInner = isInnerDrop(
1095
- {
1096
- x,
1097
- y,
1098
- element: layoutRef.current
1099
- }
1100
- );
1101
- if (!isRootOver && !isLayoutInner || !isRootOver && isLayoutInner && centerDropTargetComponentRef.current.length > 1) {
1102
- const option = {};
1103
- if (centerDropTargetComponentRef.current.length > 1) {
1104
- const {
1105
- adjacentItem,
1106
- adjacentIndex
1107
- } = getAdjacentItem(
1108
- centerDropTargetComponentRef.current,
1109
- activeIndexRef.current
1110
- );
1111
- if (adjacentItem && activeIndexRef.current === index) {
1112
- Object.assign(
1113
- option,
1114
- {
1115
- x,
1116
- y,
1117
- targetComponent: adjacentItem.component,
1118
- nextContainerName: adjacentItem.containerName,
1119
- orderName: "center",
1120
- dropTargetComponentEvent: {
1121
- navigationTitle: adjacentItem.navigationTitle,
1122
- dropDocumentOutsideOption: adjacentItem.dropDocumentOutsideOption,
1123
- direction,
1124
- screenKey
1125
- }
1126
- }
1127
- );
1128
- }
1129
- }
1130
- if (index === 0) {
1131
- dropMovementEventSubject.next(
1132
- {
1133
- state: "remove",
1134
- targetContainerName: item.containerName,
1135
- targetParentLayoutName: parentLayoutName,
1136
- targetLayoutName: layoutName,
1137
- ...option
1138
- }
1139
- );
1140
- } else {
1141
- dropMovementEventSubject.next(
1142
- {
1143
- state: "remove",
1144
- targetContainerName: item.containerName,
1145
- targetParentLayoutName: "",
1146
- targetLayoutName: layoutName,
1147
- ...option
1148
- }
1149
- );
1150
- }
1151
- }
1152
- },
1153
- children: item.navigationTitle
1154
- }
1155
- )
1156
- },
1157
- item.navigationTitle + layoutName + item.containerName
1158
- )
1159
- )
1160
- },
1161
- layoutName
1162
- ),
1163
- /* @__PURE__ */ jsx(FlexLayoutSplitScreenDragBoxTitleMore, {})
1164
- ]
1165
- }
1166
- )
1167
- }
1168
- ),
1169
- (() => {
1170
- const target = centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0];
1171
- return target.component;
1172
- })()
1173
- ]
1174
- }
1175
- )
1176
- },
1177
- (centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName
1178
- ) }) : /* @__PURE__ */ jsx("div", {}),
1179
- afterDropTargetComponent.length != 0 ? /* @__PURE__ */ jsx(Fragment, { children: afterDropTargetComponent.map(
1180
- ({
1181
- containerName: cName,
1182
- component,
1183
- navigationTitle,
1184
- dropDocumentOutsideOption,
1185
- screenKey: screenKey2
1186
- }, i) => /* @__PURE__ */ jsx(
1187
- FlexLayoutContainer,
1188
- {
1189
- containerName: cName,
1190
- isInitialResizable: true,
1191
- isResizePanel: i !== afterDropTargetComponent.length - 1,
1192
- children: /* @__PURE__ */ jsx(
1193
- FlexLayoutSplitScreenChild,
1194
- {
1195
- parentDirection: direction,
1196
- layoutName: `${layoutName}_after-${depth}`,
1197
- parentLayoutName: layoutName,
1198
- containerName: cName,
1199
- depth: depth + 1,
1200
- rootRef,
1201
- screenKey: screenKey2,
1202
- initialCenterComponents: [
1203
- {
1204
- navigationTitle,
1205
- component,
1206
- containerName: cName,
1207
- dropDocumentOutsideOption,
1208
- screenKey: screenKey2
1209
- }
1210
- ],
1211
- rootName
1212
- }
1213
- )
1214
- },
1215
- cName
1216
- )
1217
- ) }) : /* @__PURE__ */ jsx("div", {})
1218
- ]
1219
- }
1220
- ),
1221
- boundaryContainerSize && /* @__PURE__ */ jsx(
1222
- "div",
1223
- {
1224
- className: `${styles["flex-split-screen-boundary-container"]}`,
1225
- style: { ...boundaryContainerSize },
1226
- children: "\u2B07\uFE0F\uB4DC\uB86D\uD558\uBA74 \uD654\uBA74\uC774 \uBD84\uD560\uB429\uB2C8\uB2E4."
1227
- }
1228
- )
1229
- ]
1230
- }
1231
- ) });
1232
- }
1233
- export {
1234
- FlexLayoutSplitScreen as default
1235
- };
1236
- //# sourceMappingURL=FlexLayoutSplitScreen.js.map
1
+ "use client";import{Fragment as G,jsx as c,jsxs as J}from"react/jsx-runtime";import{cloneElement as ue,useEffect as j,useRef as ee,useState as re}from"react";import{dropMovementEventSubject as w}from"../hooks/useDrag";import{useFlexLayoutSplitScreen as ce}from"../hooks/useFlexLayoutSplitScreen";import{getCurrentSplitScreenComponents as B,getSplitScreen as oe,removeRootSplitScreen as me,removeSplitScreenChild as De,resetRootSplitScreen as be,setSplitScreen as k}from"../store/FlexLayoutContainerStore";import Y from"../styles/FlexLayout.module.css";import le from"./FlexLayout";import V from"./FlexLayoutContainer";import Te from"./FlexLayoutSplitScreenDragBox";import ge from"fast-deep-equal/react";import{distinctUntilChanged as Ce,take as Se}from"rxjs";import xe from"./FlexLayoutSplitScreenDragBoxContainer";import Le from"./FlexLayoutSplitScreenDragBoxItem";import he from"./FlexLayoutSplitScreenDragBoxTitleMore";import de from"./FlexLayoutSplitScreenScrollBox";function $e({x:r,y:n,element:e}){const{x:T,y:u,right:y,bottom:l}=e.getBoundingClientRect();return r<T||r>y||n<u||n>l}function ie({x:r,y:n,element:e}){const{x:T,y:u,right:y,bottom:l}=e.getBoundingClientRect();return r>=T&&r<=y&&n>=u&&n<=l}const ae=()=>typeof window<"u"&&window.crypto?Array.from(window.crypto.getRandomValues(new Uint32Array(16)),r=>r.toString(32).padStart(2,"0")).join(""):Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),te=({orderName:r,parentOrderName:n,containerName:e,parentLayoutName:T,layoutName:u,dropComponent:y,navigationTitle:l,nextContainerName:M,isUsePrefix:g=!0,beforeDropTargetComponent:x,afterDropTargetComponent:K,centerDropTargetComponent:E,dropDocumentOutsideOption:D,screenKey:C=ae()})=>{const p=n||r;let I,d,F;p===r||p==="center"?I=r==="before"?{beforeDropTargetComponent:x}:r==="after"?{afterDropTargetComponent:K}:{centerDropTargetComponent:E.filter(a=>!a.containerName.split("_").at(0).startsWith(e.split("_").at(0)))}:I=p==="before"?{beforeDropTargetComponent:x}:{afterDropTargetComponent:K};const N=Object.entries(I)[0];F=N[0],d=N[1];const O={containerName:`${e+"_"+u}${g?"_"+r+"-"+d.length:""}`,component:ue(y,{key:C,screenKey:C}),navigationTitle:l,dropDocumentOutsideOption:D,screenKey:C||ae()};let R;if(M){const a=d.findIndex(X=>X.containerName===M);a!==-1?p===r?r==="before"?R=[...d.slice(0,a),O,...d.slice(a)]:R=[...d.slice(0,a+1),O,...d.slice(a+1)]:p==="after"&&r==="before"?R=[...d.slice(0,a),O,...d.slice(a)]:p==="before"&&r==="after"?R=[...d.slice(0,a+1),O,...d.slice(a+1)]:r==="before"?R=[...d.slice(0,a),O,...d.slice(a)]:R=[...d.slice(0,a+1),O,...d.slice(a+1)]:p==="center"&&r==="after"?R=[O,...d]:p==="center"&&r==="before"?R=[...d,O]:R=r==="before"?[O,...d]:[...d,O]}else R=r==="before"?[O,...d]:[...d,O];const A=new Set,Q=R.filter(a=>A.has(a.containerName)?!1:(A.add(a.containerName),!0));return w.next({state:"append",targetParentLayoutName:T,targetLayoutName:u,targetContainerName:e,orderName:r}),{[F]:Q}},H=(r,n,e)=>{const T=r.filter(u=>u.containerName!==n);return T.length!=r.length&&e(r.length-T.length),T};function Oe(r,n){return n+1<r.length?{adjacentItem:r[n+1],adjacentIndex:n+1}:n-1>=0?{adjacentItem:r[n-1],adjacentIndex:n-1}:{adjacentItem:null,adjacentIndex:n}}const ye=r=>{const n=r.split("_").at(-1)?.split("-").at(0)?.split("=").at(0);if(["before","center","after"].some(e=>e===n))return n};function Re({children:r,containerName:n,layoutName:e,navigationTitle:T,dropDocumentOutsideOption:u,screenKey:y,isResetOnChildrenChange:l=!0,isRemoveStoreOnUnmount:M=!0}){const{direction:g,isSplit:x,boundaryContainerSize:K,afterDropTargetComponent:E,beforeDropTargetComponent:D,centerDropTargetComponent:C,setAfterDropTargetComponent:p,setBeforeDropTargetComponent:I,setCenterDropTargetComponent:d,layoutRef:F,setIsSplit:N,setDirection:O}=ce({isSplitInitial:!1,directionInitial:"row",selfContainerName:n,parentLayoutName:"",layoutName:e}),R=ee(y??ae()),A=y??R.current;j(()=>{l&&be(e);const f=oe(e,e).subscribe(o=>{if(o){I([...o.beforeDropTargetComponent]),p([...o.afterDropTargetComponent]),d([...o.centerDropTargetComponent]),O(o.direction),(o.beforeDropTargetComponent.length!==0||o.afterDropTargetComponent.length!==0)&&N(!0);return}k(e,e,{afterDropTargetComponent:[],beforeDropTargetComponent:[],centerDropTargetComponent:[{containerName:n,component:r,navigationTitle:T,dropDocumentOutsideOption:u,screenKey:A}],direction:g})});return()=>{f.unsubscribe(),M&&me(e)}},[e,l]),j(()=>{if(l)return;const f=B(e,e);if(!f||f.centerDropTargetComponent.length===0)return;const o=f.centerDropTargetComponent[0],b=y??o.screenKey;if(o.screenKey!==b)return;const S={...o,component:r,navigationTitle:T,dropDocumentOutsideOption:u};if(o.component===S.component&&o.navigationTitle===S.navigationTitle&&o.dropDocumentOutsideOption===S.dropDocumentOutsideOption)return;k(e,e,{...f,centerDropTargetComponent:[S]});const v=o.screenKey,i=`${e}_center=${v}`,t=B(e,i);if(t?.centerDropTargetComponent?.length){const m=t.centerDropTargetComponent.findIndex(s=>s.screenKey===v);if(m!==-1){const s=[...t.centerDropTargetComponent];s[m]={...s[m],component:r,navigationTitle:T,dropDocumentOutsideOption:u},k(e,i,{...t,centerDropTargetComponent:s})}}},[l,e,r,T,u,y]),j(()=>{const f=w.pipe(Ce((o,b)=>{const S=v=>{const{children:i,component:t,targetComponent:m,x:s,y:L,...h}=v||{};return h};return ge(S(o),S(b))})).subscribe(o=>{if(o.state==="remove")(o.targetParentLayoutName===e||o.targetParentLayoutName===""&&o.targetLayoutName===e)&&requestAnimationFrame(()=>{let b=m=>{if(o.nextContainerName&&o.dropTargetComponentEvent&&o.targetComponent){const s=te({orderName:m,containerName:o.nextContainerName,parentLayoutName:"",layoutName:e,dropComponent:o.targetComponent,navigationTitle:o.dropTargetComponentEvent.navigationTitle,isUsePrefix:!0,afterDropTargetComponent:E,beforeDropTargetComponent:D,centerDropTargetComponent:C,dropDocumentOutsideOption:u,screenKey:o.dropTargetComponentEvent.screenKey});k(e,e,{...B(e,e)||{afterDropTargetComponent:E,beforeDropTargetComponent:D,centerDropTargetComponent:C,direction:g},...s}),Promise.resolve().then(()=>o.dropEndCallback&&o.dropEndCallback({x:o.x,y:o.y,containerName:n}))}};const S=B(e,e),v=H(S?.afterDropTargetComponent||E,o.targetContainerName,()=>b("after")),i=H(S?.beforeDropTargetComponent||D,o.targetContainerName,()=>b("before")),t=H(S?.centerDropTargetComponent||C,o.targetContainerName,()=>b("center"));k(e,e,{afterDropTargetComponent:v,beforeDropTargetComponent:i,centerDropTargetComponent:t,direction:g})});else if(o.state==="append"){const{x:b,y:S,dropEndCallback:v,dropTargetComponentEvent:i,orderName:t,parentOrderName:m,targetLayoutName:s,targetParentLayoutName:L,targetContainerName:h,targetComponent:$,nextContainerName:_}=o;if(F.current&&t&&b&&S&&$&&i&&s===e&&ie({x:b,y:S,element:F.current})){const{direction:P,navigationTitle:U,dropDocumentOutsideOption:z}=i,Z=t!=="center",ne=t==="center"&&C.length<=1;if(Z||ne)if(N(!0),Z){O(P);const q=te({orderName:t,parentOrderName:m,containerName:h,nextContainerName:_,dropComponent:$,parentLayoutName:"",layoutName:e,navigationTitle:U,isUsePrefix:!0,afterDropTargetComponent:E,beforeDropTargetComponent:D,centerDropTargetComponent:C,dropDocumentOutsideOption:z});k(e,e,{afterDropTargetComponent:E,beforeDropTargetComponent:D,centerDropTargetComponent:C,direction:P,...q,direction:P}),Promise.resolve().then(()=>v&&v({x:o.x,y:o.y,containerName:n}))}else{const q=B(e,`${e}_center=${C[0].screenKey}`)||{afterDropTargetComponent:[],beforeDropTargetComponent:[],centerDropTargetComponent:[],direction:g};k(e,`${e}_center=${C[0].screenKey}`,{...q,centerDropTargetComponent:[C[0],{containerName:`${h}_${e}_${t}`,component:$,dropDocumentOutsideOption:z,screenKey:i.screenKey,navigationTitle:U}]})}}}});return()=>{f.unsubscribe()}},[g,e,x,D,E,C]);const Q={containerName:n,component:r,navigationTitle:T,dropDocumentOutsideOption:u,screenKey:A},a=C[0]??Q,X=C.length>0;return J("div",{className:`${Y["flex-split-screen"]}`,ref:F,children:[J(le,{direction:g,layoutName:e,"data-is_split":x,panelMovementMode:"bulldozer",children:[D.length!=0?c(G,{children:D.map(({containerName:f,component:o,navigationTitle:b,dropDocumentOutsideOption:S,screenKey:v},i)=>c(V,{containerName:f,isInitialResizable:!0,isResizePanel:!0,children:c(W,{parentDirection:g,layoutName:`${e}_before`,parentLayoutName:e,containerName:f,depth:1,rootRef:F,screenKey:v,initialCenterComponents:[{navigationTitle:b,component:o,containerName:f,dropDocumentOutsideOption:S,screenKey:v}],rootName:e})},f))}):c("div",{}),c(V,{containerName:`${a.containerName}`,isInitialResizable:!0,isResizePanel:x,children:X&&x?c(W,{parentDirection:g,layoutName:`${e}_center`,parentLayoutName:e,containerName:a.containerName,depth:0,rootRef:F,screenKey:a.screenKey,initialCenterComponents:[{navigationTitle:a.navigationTitle,component:a.component,containerName:a.containerName,dropDocumentOutsideOption:a.dropDocumentOutsideOption,screenKey:a.screenKey}],rootName:e}):c(de,{keyName:a.containerName,isDefaultScrollStyle:!0,children:a.component})}),E.length!=0?c(G,{children:E.map(({containerName:f,component:o,navigationTitle:b,dropDocumentOutsideOption:S,screenKey:v},i)=>c(V,{containerName:f,isInitialResizable:!0,isResizePanel:E.length-1!==i,children:c(W,{parentDirection:g,layoutName:`${e}_after`,parentLayoutName:e,containerName:f,depth:1,rootRef:F,screenKey:v,initialCenterComponents:[{navigationTitle:b,component:o,containerName:f,dropDocumentOutsideOption:S,screenKey:v}],rootName:e})},f))}):c("div",{})]}),K&&c("div",{className:`${Y["flex-split-screen-boundary-container"]}`,style:{...K},children:"\u2B07\uFE0F\uB4DC\uB86D\uD558\uBA74 \uD654\uBA74\uC774 \uBD84\uD560\uB429\uB2C8\uB2E4."})]})}function W({containerName:r,layoutName:n,parentLayoutName:e,parentDirection:T,depth:u,rootRef:y,rootName:l,initialCenterComponents:M,screenKey:g}){const{direction:x,isSplit:K,boundaryContainerSize:E,afterDropTargetComponent:D,beforeDropTargetComponent:C,centerDropTargetComponent:p,setAfterDropTargetComponent:I,setBeforeDropTargetComponent:d,setCenterDropTargetComponent:F,layoutRef:N,setIsSplit:O,setDirection:R}=ce({isSplitInitial:!1,directionInitial:"row",parentDirection:T,selfContainerName:r,parentLayoutName:e,layoutName:n}),[A,Q]=re(!1),[a,X]=re(0),f=ee(p),o=ee(M??[]),b=ee(a);j(()=>{const i=`${n}=${g}`,t=oe(l,i).pipe(Se(1)).subscribe(m=>{m||k(l,i,{afterDropTargetComponent:[],beforeDropTargetComponent:[],centerDropTargetComponent:o.current,direction:x})});return()=>{De(l,`${n}=${g}`),t.unsubscribe()}},[l,n,g]),j(()=>{const i=oe(l,`${n}=${g}`).subscribe(t=>{t&&(d([...t.beforeDropTargetComponent]),I([...t.afterDropTargetComponent]),F([...t.centerDropTargetComponent]),R(t.direction),t.beforeDropTargetComponent.length!==0||t.afterDropTargetComponent.length!==0?O(!0):t.beforeDropTargetComponent.length===0&&t.centerDropTargetComponent.length===0&&t.afterDropTargetComponent.length===0&&(w.next({state:"remove",targetContainerName:r,targetParentLayoutName:"",targetLayoutName:e}),Q(!0)))});return()=>{i.unsubscribe(),me(n)}},[l,n]),j(()=>{const i=w.pipe(Ce((t,m)=>{const s=L=>{const{children:h,component:$,targetComponent:_,x:P,y:U,...z}=L||{};return z};return ge(s(t),s(m))})).subscribe(t=>{if(t.state==="remove")(t.targetParentLayoutName===n||t.targetParentLayoutName===""&&t.targetLayoutName===n)&&requestAnimationFrame(()=>{let m=_=>{if(t.nextContainerName&&t.dropTargetComponentEvent&&t.targetComponent){const P=te({orderName:_,containerName:t.nextContainerName,parentLayoutName:e,layoutName:n,dropComponent:t.targetComponent,navigationTitle:t.dropTargetComponentEvent.navigationTitle,isUsePrefix:!0,afterDropTargetComponent:D,beforeDropTargetComponent:C,centerDropTargetComponent:p,dropDocumentOutsideOption:t.dropTargetComponentEvent?.dropDocumentOutsideOption,screenKey:t.dropTargetComponentEvent.screenKey});k(l,`${n}=${g}`,{...B(l,`${n}=${g}`)||{afterDropTargetComponent:D,beforeDropTargetComponent:C,centerDropTargetComponent:p,direction:x},...P}),Promise.resolve().then(()=>t.dropEndCallback&&t.dropEndCallback({x:t.x,y:t.y,containerName:r}))}};const s=B(l,`${n}=${g}`),L=H(s?.afterDropTargetComponent||D,t.targetContainerName,()=>m("after")),h=H(s?.beforeDropTargetComponent||C,t.targetContainerName,()=>m("before")),$=H(s?.centerDropTargetComponent||p,t.targetContainerName,()=>m("center"));k(l,`${n}=${g}`,{afterDropTargetComponent:L,beforeDropTargetComponent:h,centerDropTargetComponent:$,direction:x})});else if(t.state==="append"){const{x:m,y:s,dropEndCallback:L,dropTargetComponentEvent:h,orderName:$,targetLayoutName:_,targetParentLayoutName:P,targetContainerName:U,targetComponent:z,nextContainerName:Z,parentOrderName:ne}=t;if(N.current&&$&&m&&s&&h&&ie({x:m,y:s,element:N.current})){const{direction:q,navigationTitle:pe,dropDocumentOutsideOption:se,screenKey:ve}=h;if(_===n&&z)if(q===T&&$!=="center")w.next({state:"append",targetContainerName:U,targetParentLayoutName:"",targetLayoutName:e,targetComponent:z,nextContainerName:r,parentOrderName:ye(n)||$,orderName:$,x:m,y:s,dropEndCallback:L,dropTargetComponentEvent:{navigationTitle:pe,dropDocumentOutsideOption:se,direction:T,screenKey:g}});else{$!=="center"&&(R(q),O(!0));const fe=te({orderName:$,parentOrderName:ne,containerName:U,nextContainerName:Z,parentLayoutName:e,layoutName:n,dropComponent:z,navigationTitle:pe,isUsePrefix:$!=="center",afterDropTargetComponent:D,beforeDropTargetComponent:C,centerDropTargetComponent:p,dropDocumentOutsideOption:se});k(l,`${n}=${g}`,{...B(l,`${n}=${g}`)||{afterDropTargetComponent:D,beforeDropTargetComponent:C,centerDropTargetComponent:p,direction:x},...fe,direction:q}),Promise.resolve().then(()=>t.dropEndCallback&&t.dropEndCallback({x:t.x,y:t.y,containerName:r}))}}}});return()=>{i.unsubscribe()}},[x,T,e,n,C,D,p]),j(()=>{f.current=p},[p]),j(()=>{b.current=a},[a]);const[S,v]=re(!1);return c(G,{children:!A&&J("div",{className:`${Y["flex-split-screen"]}`,ref:N,children:[J(le,{direction:x,layoutName:`${n}`,panelMovementMode:"bulldozer",children:[C.length!=0?c(G,{children:C.map(({containerName:i,component:t,navigationTitle:m,dropDocumentOutsideOption:s,screenKey:L},h)=>c(V,{containerName:i,isInitialResizable:!0,isResizePanel:!0,children:c(W,{parentDirection:x,layoutName:`${n}_before-${u}`,parentLayoutName:n,containerName:i,depth:u+1,rootRef:y,screenKey:L,initialCenterComponents:[{navigationTitle:m,component:t,containerName:i,dropDocumentOutsideOption:s,screenKey:L}],rootName:l})},i))}):c("div",{}),p.length!=0?c(G,{children:c(V,{containerName:`${(p[a]||p[0]).containerName}`,isInitialResizable:!0,isResizePanel:K,children:K?c("div",{"data-key":g,children:c(W,{parentDirection:x,layoutName:`${n}_center-${u}`,parentLayoutName:n,containerName:`${(p[a]||p[0]).containerName}`,depth:u+1,rootRef:y,initialCenterComponents:p.map(({navigationTitle:i,component:t,containerName:m,dropDocumentOutsideOption:s,screenKey:L})=>({navigationTitle:i,component:t,containerName:m,dropDocumentOutsideOption:s,screenKey:L})),screenKey:g,rootName:l})}):J(de,{keyName:(p[a]||p[0]).containerName,isDefaultScrollStyle:!0,children:[!S&&c("div",{className:`${Y["flex-split-screen-drag-box-title-wrapper-sticky"]}`,children:J("div",{"data-is_split":K,"data-layout_name":n,"data-parent_layout_name":e,"data-container_name":`${(p[a]||p[0]).containerName}`,className:`${Y["flex-split-screen-drag-box-title-wrapper"]}`,children:[c(xe,{"data-layout_name":n,layoutName:n,children:p.map((i,t)=>c(Le,{onClose:m=>{b.current===t&&p.length===1?w.next({state:"remove",targetContainerName:r,targetParentLayoutName:e,targetLayoutName:n}):(p.length===b.current+1&&X(b.current-1),F(s=>{const L=H(s,i.containerName,()=>{}),h=`${n}=${g}`,$=B(l,h)||{afterDropTargetComponent:D,beforeDropTargetComponent:C,centerDropTargetComponent:s,direction:x};return k(l,h,{...$,centerDropTargetComponent:L}),L}))},isActive:a===t,children:c(Te,{screenKey:i.screenKey,onClick:()=>{X(t)},containerName:i.containerName,dropDocumentOutsideOption:i.dropDocumentOutsideOption,targetComponent:i.component,navigationTitle:i.navigationTitle,"data-container-name":i.containerName,"data-layout-name":n,"data-parent-layout-name":e,dropEndCallback:({x:m,y:s,containerName:L})=>{if(!y.current||!N.current)return;const h=$e({x:m,y:s,element:y.current}),$=ie({x:m,y:s,element:N.current});if(!h&&!$||!h&&$&&f.current.length>1){const _={};if(f.current.length>1){const{adjacentItem:P,adjacentIndex:U}=Oe(f.current,b.current);P&&b.current===t&&Object.assign(_,{x:m,y:s,targetComponent:P.component,nextContainerName:P.containerName,orderName:"center",dropTargetComponentEvent:{navigationTitle:P.navigationTitle,dropDocumentOutsideOption:P.dropDocumentOutsideOption,direction:x,screenKey:g}})}t===0?w.next({state:"remove",targetContainerName:i.containerName,targetParentLayoutName:e,targetLayoutName:n,..._}):w.next({state:"remove",targetContainerName:i.containerName,targetParentLayoutName:"",targetLayoutName:n,..._})}},children:i.navigationTitle})},i.navigationTitle+n+i.containerName))},n),c(he,{})]})}),(p[a]||p[0]).component]})},(p[a]||p[0]).containerName)}):c("div",{}),D.length!=0?c(G,{children:D.map(({containerName:i,component:t,navigationTitle:m,dropDocumentOutsideOption:s,screenKey:L},h)=>c(V,{containerName:i,isInitialResizable:!0,isResizePanel:h!==D.length-1,children:c(W,{parentDirection:x,layoutName:`${n}_after-${u}`,parentLayoutName:n,containerName:i,depth:u+1,rootRef:y,screenKey:L,initialCenterComponents:[{navigationTitle:m,component:t,containerName:i,dropDocumentOutsideOption:s,screenKey:L}],rootName:l})},i))}):c("div",{})]}),E&&c("div",{className:`${Y["flex-split-screen-boundary-container"]}`,style:{...E},children:"\u2B07\uFE0F\uB4DC\uB86D\uD558\uBA74 \uD654\uBA74\uC774 \uBD84\uD560\uB429\uB2C8\uB2E4."})]})})}export{Re as default};