@byeolnaerim/flex-layout 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/dist/flex-layout/components/FlexLayout.cjs +1 -76
  2. package/dist/flex-layout/components/FlexLayout.js +1 -70
  3. package/dist/flex-layout/components/FlexLayoutContainer.cjs +1 -196
  4. package/dist/flex-layout/components/FlexLayoutContainer.js +1 -189
  5. package/dist/flex-layout/components/FlexLayoutIFramePane.cjs +1 -0
  6. package/dist/flex-layout/components/FlexLayoutIFramePane.d.ts +4 -0
  7. package/dist/flex-layout/components/FlexLayoutIFramePane.js +1 -0
  8. package/dist/flex-layout/components/FlexLayoutResizePanel.cjs +1 -192
  9. package/dist/flex-layout/components/FlexLayoutResizePanel.d.ts +1 -1
  10. package/dist/flex-layout/components/FlexLayoutResizePanel.js +1 -186
  11. package/dist/flex-layout/components/FlexLayoutSplitScreen.cjs +1 -1211
  12. package/dist/flex-layout/components/FlexLayoutSplitScreen.js +1 -1197
  13. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.cjs +1 -339
  14. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.d.ts +1 -1
  15. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.js +1 -333
  16. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.cjs +1 -32
  17. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.js +1 -25
  18. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.cjs +1 -40
  19. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.js +1 -34
  20. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.cjs +1 -30
  21. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.js +1 -24
  22. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.cjs +1 -109
  23. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.js +1 -103
  24. package/dist/flex-layout/components/FlexLayoutStickyBox.cjs +1 -226
  25. package/dist/flex-layout/components/FlexLayoutStickyBox.d.ts +1 -0
  26. package/dist/flex-layout/components/FlexLayoutStickyBox.js +1 -224
  27. package/dist/flex-layout/components/index.cjs +1 -52
  28. package/dist/flex-layout/components/index.js +1 -9
  29. package/dist/flex-layout/hooks/index.cjs +1 -21
  30. package/dist/flex-layout/hooks/index.js +1 -4
  31. package/dist/flex-layout/hooks/useDrag.cjs +1 -232
  32. package/dist/flex-layout/hooks/useDrag.d.ts +20 -0
  33. package/dist/flex-layout/hooks/useDrag.js +1 -219
  34. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.cjs +1 -118
  35. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.js +1 -116
  36. package/dist/flex-layout/hooks/useListPaging.cjs +1 -179
  37. package/dist/flex-layout/hooks/useListPaging.js +1 -175
  38. package/dist/flex-layout/hooks/useSizes.cjs +1 -104
  39. package/dist/flex-layout/hooks/useSizes.js +1 -101
  40. package/dist/flex-layout/index.cjs +1 -42
  41. package/dist/flex-layout/index.js +1 -7
  42. package/dist/flex-layout/providers/FlexLayoutContext.cjs +1 -26
  43. package/dist/flex-layout/providers/FlexLayoutContext.js +1 -23
  44. package/dist/flex-layout/providers/FlexLayoutHooks.cjs +1 -247
  45. package/dist/flex-layout/providers/FlexLayoutHooks.d.ts +5 -1
  46. package/dist/flex-layout/providers/FlexLayoutHooks.js +1 -238
  47. package/dist/flex-layout/providers/index.cjs +1 -14
  48. package/dist/flex-layout/providers/index.js +1 -3
  49. package/dist/flex-layout/store/FlexLayoutContainerStore.cjs +1 -203
  50. package/dist/flex-layout/store/FlexLayoutContainerStore.d.ts +1 -0
  51. package/dist/flex-layout/store/FlexLayoutContainerStore.js +1 -181
  52. package/dist/flex-layout/store/index.cjs +1 -14
  53. package/dist/flex-layout/store/index.js +1 -3
  54. package/dist/flex-layout/styles/FlexLayout.module.css +473 -416
  55. package/dist/flex-layout/types/FlexDirectionTypes.cjs +1 -4
  56. package/dist/flex-layout/types/FlexDirectionTypes.js +0 -3
  57. package/dist/flex-layout/types/FlexLayoutTypes.cjs +1 -4
  58. package/dist/flex-layout/types/FlexLayoutTypes.d.ts +1 -3
  59. package/dist/flex-layout/types/FlexLayoutTypes.js +0 -3
  60. package/dist/flex-layout/utils/FlexLayoutUtils.cjs +1 -208
  61. package/dist/flex-layout/utils/FlexLayoutUtils.d.ts +4 -4
  62. package/dist/flex-layout/utils/FlexLayoutUtils.js +1 -196
  63. package/dist/flex-layout/utils/index.cjs +1 -14
  64. package/dist/flex-layout/utils/index.js +1 -3
  65. package/dist/index.cjs +1 -14
  66. package/dist/index.js +1 -3
  67. package/dist/types/css.d.cjs +1 -4
  68. package/dist/types/css.d.js +0 -3
  69. package/package.json +116 -109
  70. package/dist/flex-layout/components/FlexLayout.cjs.map +0 -1
  71. package/dist/flex-layout/components/FlexLayout.js.map +0 -1
  72. package/dist/flex-layout/components/FlexLayoutContainer.cjs.map +0 -1
  73. package/dist/flex-layout/components/FlexLayoutContainer.js.map +0 -1
  74. package/dist/flex-layout/components/FlexLayoutResizePanel.cjs.map +0 -1
  75. package/dist/flex-layout/components/FlexLayoutResizePanel.js.map +0 -1
  76. package/dist/flex-layout/components/FlexLayoutSplitScreen.cjs.map +0 -1
  77. package/dist/flex-layout/components/FlexLayoutSplitScreen.js.map +0 -1
  78. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.cjs.map +0 -1
  79. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.js.map +0 -1
  80. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.cjs.map +0 -1
  81. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.js.map +0 -1
  82. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.cjs.map +0 -1
  83. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.js.map +0 -1
  84. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.cjs.map +0 -1
  85. package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.js.map +0 -1
  86. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.cjs.map +0 -1
  87. package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.js.map +0 -1
  88. package/dist/flex-layout/components/FlexLayoutStickyBox.cjs.map +0 -1
  89. package/dist/flex-layout/components/FlexLayoutStickyBox.js.map +0 -1
  90. package/dist/flex-layout/components/index.cjs.map +0 -1
  91. package/dist/flex-layout/components/index.js.map +0 -1
  92. package/dist/flex-layout/hooks/index.cjs.map +0 -1
  93. package/dist/flex-layout/hooks/index.js.map +0 -1
  94. package/dist/flex-layout/hooks/useDrag.cjs.map +0 -1
  95. package/dist/flex-layout/hooks/useDrag.js.map +0 -1
  96. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.cjs.map +0 -1
  97. package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.js.map +0 -1
  98. package/dist/flex-layout/hooks/useListPaging.cjs.map +0 -1
  99. package/dist/flex-layout/hooks/useListPaging.js.map +0 -1
  100. package/dist/flex-layout/hooks/useSizes.cjs.map +0 -1
  101. package/dist/flex-layout/hooks/useSizes.js.map +0 -1
  102. package/dist/flex-layout/index.cjs.map +0 -1
  103. package/dist/flex-layout/index.js.map +0 -1
  104. package/dist/flex-layout/providers/FlexLayoutContext.cjs.map +0 -1
  105. package/dist/flex-layout/providers/FlexLayoutContext.js.map +0 -1
  106. package/dist/flex-layout/providers/FlexLayoutHooks.cjs.map +0 -1
  107. package/dist/flex-layout/providers/FlexLayoutHooks.js.map +0 -1
  108. package/dist/flex-layout/providers/index.cjs.map +0 -1
  109. package/dist/flex-layout/providers/index.js.map +0 -1
  110. package/dist/flex-layout/store/FlexLayoutContainerStore.cjs.map +0 -1
  111. package/dist/flex-layout/store/FlexLayoutContainerStore.js.map +0 -1
  112. package/dist/flex-layout/store/index.cjs.map +0 -1
  113. package/dist/flex-layout/store/index.js.map +0 -1
  114. package/dist/flex-layout/types/FlexDirectionTypes.cjs.map +0 -1
  115. package/dist/flex-layout/types/FlexDirectionTypes.js.map +0 -1
  116. package/dist/flex-layout/types/FlexLayoutTypes.cjs.map +0 -1
  117. package/dist/flex-layout/types/FlexLayoutTypes.js.map +0 -1
  118. package/dist/flex-layout/utils/FlexLayoutUtils.cjs.map +0 -1
  119. package/dist/flex-layout/utils/FlexLayoutUtils.js.map +0 -1
  120. package/dist/flex-layout/utils/index.cjs.map +0 -1
  121. package/dist/flex-layout/utils/index.js.map +0 -1
  122. package/dist/index.cjs.map +0 -1
  123. package/dist/index.js.map +0 -1
  124. package/dist/types/css.d.cjs.map +0 -1
  125. package/dist/types/css.d.js.map +0 -1
@@ -1,1211 +1 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var react = require('react');
5
- var useDrag = require('../hooks/useDrag');
6
- var useFlexLayoutSplitScreen = require('../hooks/useFlexLayoutSplitScreen');
7
- var FlexLayoutContainerStore = require('../store/FlexLayoutContainerStore');
8
- var styles = require('../styles/FlexLayout.module.css');
9
- var FlexLayout = require('./FlexLayout');
10
- var FlexLayoutContainer = require('./FlexLayoutContainer');
11
- var FlexLayoutSplitScreenDragBox = require('./FlexLayoutSplitScreenDragBox');
12
- var equal = require('fast-deep-equal');
13
- var rxjs = require('rxjs');
14
- var FlexLayoutSplitScreenDragBoxContainer = require('./FlexLayoutSplitScreenDragBoxContainer');
15
- var FlexLayoutSplitScreenDragBoxItem = require('./FlexLayoutSplitScreenDragBoxItem');
16
- var FlexLayoutSplitScreenDragBoxTitleMore = require('./FlexLayoutSplitScreenDragBoxTitleMore');
17
- var FlexLayoutSplitScreenScrollBox = require('./FlexLayoutSplitScreenScrollBox');
18
-
19
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
20
-
21
- var styles__default = /*#__PURE__*/_interopDefault(styles);
22
- var FlexLayout__default = /*#__PURE__*/_interopDefault(FlexLayout);
23
- var FlexLayoutContainer__default = /*#__PURE__*/_interopDefault(FlexLayoutContainer);
24
- var FlexLayoutSplitScreenDragBox__default = /*#__PURE__*/_interopDefault(FlexLayoutSplitScreenDragBox);
25
- var equal__default = /*#__PURE__*/_interopDefault(equal);
26
- var FlexLayoutSplitScreenDragBoxContainer__default = /*#__PURE__*/_interopDefault(FlexLayoutSplitScreenDragBoxContainer);
27
- var FlexLayoutSplitScreenDragBoxItem__default = /*#__PURE__*/_interopDefault(FlexLayoutSplitScreenDragBoxItem);
28
- var FlexLayoutSplitScreenDragBoxTitleMore__default = /*#__PURE__*/_interopDefault(FlexLayoutSplitScreenDragBoxTitleMore);
29
- var FlexLayoutSplitScreenScrollBox__default = /*#__PURE__*/_interopDefault(FlexLayoutSplitScreenScrollBox);
30
-
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: react.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
- useDrag.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.useFlexLayoutSplitScreen({
237
- isSplitInitial: false,
238
- directionInitial: "row",
239
- selfContainerName: containerName,
240
- parentLayoutName: "",
241
- layoutName
242
- });
243
- react.useEffect(() => {
244
- FlexLayoutContainerStore.resetRootSplitScreen(layoutName);
245
- const subscribe = FlexLayoutContainerStore.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
- FlexLayoutContainerStore.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
- FlexLayoutContainerStore.resetRootSplitScreen(layoutName);
285
- };
286
- }, [layoutName]);
287
- react.useEffect(() => {
288
- const subscribe = useDrag.dropMovementEventSubject.pipe(
289
- rxjs.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__default.default(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
- FlexLayoutContainerStore.setSplitScreen(layoutName, layoutName, {
324
- ...FlexLayoutContainerStore.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 = FlexLayoutContainerStore.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
- FlexLayoutContainerStore.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
- FlexLayoutContainerStore.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 = FlexLayoutContainerStore.getCurrentSplitScreenComponents(
431
- layoutName,
432
- `${layoutName}_center=${centerDropTargetComponent[0].screenKey}`
433
- ) || {
434
- afterDropTargetComponent: [],
435
- beforeDropTargetComponent: [],
436
- centerDropTargetComponent: [],
437
- direction
438
- };
439
- FlexLayoutContainerStore.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: centerDropTargetComponent[0].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__ */ jsxRuntime.jsxs("div", { className: `${styles__default.default["flex-split-screen"]}`, ref: layoutRef, children: [
475
- /* @__PURE__ */ jsxRuntime.jsxs(
476
- FlexLayout__default.default,
477
- {
478
- direction,
479
- layoutName,
480
- "data-is_split": isSplit,
481
- panelMovementMode: "bulldozer",
482
- children: [
483
- beforeDropTargetComponent.length != 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: beforeDropTargetComponent.map(
484
- ({
485
- containerName: cName,
486
- component,
487
- navigationTitle: navigationTitle2,
488
- dropDocumentOutsideOption: dropDocumentOutsideOption2,
489
- screenKey: screenKey2
490
- }, i) => /* @__PURE__ */ jsxRuntime.jsx(
491
- FlexLayoutContainer__default.default,
492
- {
493
- containerName: cName,
494
- isInitialResizable: true,
495
- isResizePanel: true,
496
- children: /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx("div", {}),
522
- centerDropTargetComponent.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", {}) : /* @__PURE__ */ jsxRuntime.jsx(
523
- FlexLayoutContainer__default.default,
524
- {
525
- containerName: `${centerDropTargetComponent[0].containerName}`,
526
- isInitialResizable: true,
527
- isResizePanel: isSplit,
528
- children: isSplit ? /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(
550
- FlexLayoutSplitScreenScrollBox__default.default,
551
- {
552
- keyName: centerDropTargetComponent[0].containerName,
553
- isDefaultScrollStyle: true,
554
- children: centerDropTargetComponent[0].component
555
- }
556
- )
557
- }
558
- ),
559
- afterDropTargetComponent.length != 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: afterDropTargetComponent.map(
560
- ({
561
- containerName: cName,
562
- component,
563
- navigationTitle: navigationTitle2,
564
- dropDocumentOutsideOption: dropDocumentOutsideOption2,
565
- screenKey: screenKey2
566
- }, i) => /* @__PURE__ */ jsxRuntime.jsx(
567
- FlexLayoutContainer__default.default,
568
- {
569
- containerName: cName,
570
- isInitialResizable: true,
571
- isResizePanel: afterDropTargetComponent.length - 1 !== i,
572
- children: /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx("div", {})
598
- ]
599
- }
600
- ),
601
- boundaryContainerSize && /* @__PURE__ */ jsxRuntime.jsx(
602
- "div",
603
- {
604
- className: `${styles__default.default["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.useFlexLayoutSplitScreen({
637
- isSplitInitial: false,
638
- directionInitial: "row",
639
- parentDirection,
640
- selfContainerName: containerName,
641
- parentLayoutName,
642
- layoutName
643
- });
644
- const [isEmptyContent, setIsEmptyContent] = react.useState(false);
645
- const [activeIndex, setActiveIndex] = react.useState(0);
646
- const centerDropTargetComponentRef = react.useRef(centerDropTargetComponent);
647
- const activeIndexRef = react.useRef(activeIndex);
648
- react.useEffect(() => {
649
- const subscribe = FlexLayoutContainerStore.getSplitScreen(rootName, `${layoutName}=${screenKey}`).pipe(rxjs.take(1)).subscribe((layoutInfo) => {
650
- FlexLayoutContainerStore.setSplitScreen(rootName, `${layoutName}=${screenKey}`, {
651
- afterDropTargetComponent: layoutInfo?.afterDropTargetComponent || [],
652
- beforeDropTargetComponent: layoutInfo?.beforeDropTargetComponent || [],
653
- centerDropTargetComponent: layoutInfo?.centerDropTargetComponent || initialCenterComponents || [],
654
- direction: layoutInfo?.direction || direction
655
- });
656
- });
657
- return () => {
658
- FlexLayoutContainerStore.removeSplitScreenChild(rootName, layoutName);
659
- subscribe.unsubscribe();
660
- };
661
- }, [rootName, layoutName, initialCenterComponents]);
662
- react.useEffect(() => {
663
- const subscribe = FlexLayoutContainerStore.getSplitScreen(rootName, `${layoutName}=${screenKey}`).subscribe((layoutInfo) => {
664
- if (layoutInfo) {
665
- setBeforeDropTargetComponent([
666
- ...layoutInfo.beforeDropTargetComponent
667
- ]);
668
- setAfterDropTargetComponent([
669
- ...layoutInfo.afterDropTargetComponent
670
- ]);
671
- setCenterDropTargetComponent([
672
- ...layoutInfo.centerDropTargetComponent
673
- ]);
674
- setDirection(layoutInfo.direction);
675
- if (layoutInfo.beforeDropTargetComponent.length !== 0 || layoutInfo.afterDropTargetComponent.length !== 0) {
676
- setIsSplit(true);
677
- } else if (layoutInfo.beforeDropTargetComponent.length === 0 && layoutInfo.centerDropTargetComponent.length === 0 && layoutInfo.afterDropTargetComponent.length === 0) {
678
- useDrag.dropMovementEventSubject.next({
679
- state: "remove",
680
- targetContainerName: containerName,
681
- targetParentLayoutName: "",
682
- targetLayoutName: parentLayoutName
683
- });
684
- setIsEmptyContent(true);
685
- }
686
- }
687
- });
688
- return () => {
689
- subscribe.unsubscribe();
690
- };
691
- }, [rootName, layoutName]);
692
- react.useEffect(() => {
693
- const subscribe = useDrag.dropMovementEventSubject.pipe(
694
- rxjs.distinctUntilChanged((prev, curr) => {
695
- const filterChildren = (obj) => {
696
- const {
697
- children,
698
- component,
699
- targetComponent,
700
- x,
701
- y,
702
- ...rest
703
- } = obj || {};
704
- return rest;
705
- };
706
- return equal__default.default(filterChildren(prev), filterChildren(curr));
707
- })
708
- ).subscribe((event) => {
709
- if (event.state === "remove") {
710
- if (event.targetParentLayoutName === layoutName || event.targetParentLayoutName === "" && event.targetLayoutName === layoutName) {
711
- requestAnimationFrame(() => {
712
- let removeCallback = (removeOrderName) => {
713
- if (event.nextContainerName && event.dropTargetComponentEvent && event.targetComponent) {
714
- const targetComponentsMap = handleUpdateDropTargetComponents({
715
- orderName: removeOrderName,
716
- containerName: event.nextContainerName,
717
- parentLayoutName,
718
- layoutName,
719
- dropComponent: event.targetComponent,
720
- navigationTitle: event.dropTargetComponentEvent.navigationTitle,
721
- isUsePrefix: true,
722
- afterDropTargetComponent,
723
- beforeDropTargetComponent,
724
- centerDropTargetComponent,
725
- dropDocumentOutsideOption: event.dropTargetComponentEvent?.dropDocumentOutsideOption,
726
- screenKey: event.dropTargetComponentEvent.screenKey
727
- });
728
- FlexLayoutContainerStore.setSplitScreen(
729
- rootName,
730
- `${layoutName}=${screenKey}`,
731
- {
732
- ...FlexLayoutContainerStore.getCurrentSplitScreenComponents(
733
- rootName,
734
- `${layoutName}=${screenKey}`
735
- ) || {
736
- afterDropTargetComponent,
737
- beforeDropTargetComponent,
738
- centerDropTargetComponent,
739
- direction
740
- },
741
- ...targetComponentsMap
742
- }
743
- );
744
- Promise.resolve().then(
745
- () => event.dropEndCallback && event.dropEndCallback({
746
- x: event.x,
747
- y: event.y,
748
- containerName
749
- })
750
- );
751
- }
752
- };
753
- const currentComponents = FlexLayoutContainerStore.getCurrentSplitScreenComponents(
754
- rootName,
755
- `${layoutName}=${screenKey}`
756
- );
757
- const afterList = handleRemove(
758
- currentComponents?.afterDropTargetComponent || afterDropTargetComponent,
759
- event.targetContainerName,
760
- () => removeCallback("after")
761
- );
762
- const beforList = handleRemove(
763
- currentComponents?.beforeDropTargetComponent || beforeDropTargetComponent,
764
- event.targetContainerName,
765
- () => removeCallback("before")
766
- );
767
- const centerList = handleRemove(
768
- currentComponents?.centerDropTargetComponent || centerDropTargetComponent,
769
- event.targetContainerName,
770
- () => removeCallback("center")
771
- );
772
- FlexLayoutContainerStore.setSplitScreen(
773
- rootName,
774
- `${layoutName}=${screenKey}`,
775
- {
776
- afterDropTargetComponent: afterList,
777
- beforeDropTargetComponent: beforList,
778
- centerDropTargetComponent: centerList,
779
- direction
780
- }
781
- );
782
- });
783
- }
784
- } else if (event.state === "append") {
785
- const {
786
- x,
787
- y,
788
- dropEndCallback,
789
- dropTargetComponentEvent,
790
- orderName,
791
- targetLayoutName,
792
- targetParentLayoutName,
793
- targetContainerName,
794
- targetComponent,
795
- nextContainerName,
796
- parentOrderName
797
- } = event;
798
- if (layoutRef.current && orderName && x && y && dropTargetComponentEvent && isInnerDrop({ x, y, element: layoutRef.current })) {
799
- const {
800
- direction: dropDirection,
801
- navigationTitle,
802
- dropDocumentOutsideOption,
803
- screenKey: containerScreenKey
804
- } = dropTargetComponentEvent;
805
- if (
806
- //orderName !== 'center' &&
807
- targetLayoutName === layoutName && targetComponent
808
- ) {
809
- if (dropDirection === parentDirection && orderName !== "center") {
810
- useDrag.dropMovementEventSubject.next({
811
- state: "append",
812
- targetContainerName,
813
- targetParentLayoutName: "",
814
- targetLayoutName: parentLayoutName,
815
- targetComponent,
816
- nextContainerName: containerName,
817
- parentOrderName: getSelfOrderName(layoutName) || orderName,
818
- orderName,
819
- x,
820
- y,
821
- dropEndCallback,
822
- dropTargetComponentEvent: {
823
- navigationTitle,
824
- dropDocumentOutsideOption,
825
- direction: parentDirection,
826
- screenKey
827
- }
828
- });
829
- } else {
830
- if (orderName !== "center") {
831
- setDirection(dropDirection);
832
- setIsSplit(true);
833
- }
834
- const targetComponentsMap = handleUpdateDropTargetComponents({
835
- orderName,
836
- parentOrderName,
837
- containerName: targetContainerName,
838
- nextContainerName,
839
- parentLayoutName,
840
- layoutName,
841
- dropComponent: targetComponent,
842
- navigationTitle,
843
- isUsePrefix: orderName !== "center",
844
- afterDropTargetComponent,
845
- beforeDropTargetComponent,
846
- centerDropTargetComponent,
847
- dropDocumentOutsideOption
848
- });
849
- FlexLayoutContainerStore.setSplitScreen(
850
- rootName,
851
- `${layoutName}=${screenKey}`,
852
- {
853
- ...FlexLayoutContainerStore.getCurrentSplitScreenComponents(
854
- rootName,
855
- `${layoutName}=${screenKey}`
856
- ) || {
857
- afterDropTargetComponent,
858
- beforeDropTargetComponent,
859
- centerDropTargetComponent,
860
- direction
861
- },
862
- ...targetComponentsMap,
863
- ...{ direction: dropDirection }
864
- }
865
- );
866
- Promise.resolve().then(
867
- () => event.dropEndCallback && event.dropEndCallback({
868
- x: event.x,
869
- y: event.y,
870
- containerName
871
- })
872
- );
873
- }
874
- }
875
- }
876
- }
877
- });
878
- return () => {
879
- subscribe.unsubscribe();
880
- };
881
- }, [
882
- direction,
883
- parentDirection,
884
- parentLayoutName,
885
- layoutName,
886
- beforeDropTargetComponent,
887
- afterDropTargetComponent,
888
- centerDropTargetComponent
889
- ]);
890
- react.useEffect(() => {
891
- centerDropTargetComponentRef.current = centerDropTargetComponent;
892
- }, [centerDropTargetComponent]);
893
- react.useEffect(() => {
894
- activeIndexRef.current = activeIndex;
895
- }, [activeIndex]);
896
- const [isOnlyOneScreen, setIsOnlyOneScreen] = react.useState(false);
897
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: !isEmptyContent && /* @__PURE__ */ jsxRuntime.jsxs(
898
- "div",
899
- {
900
- className: `${styles__default.default["flex-split-screen"]}`,
901
- ref: layoutRef,
902
- children: [
903
- /* @__PURE__ */ jsxRuntime.jsxs(
904
- FlexLayout__default.default,
905
- {
906
- direction,
907
- layoutName: `${layoutName}`,
908
- panelMovementMode: "bulldozer",
909
- children: [
910
- beforeDropTargetComponent.length != 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: beforeDropTargetComponent.map(
911
- ({
912
- containerName: cName,
913
- component,
914
- navigationTitle,
915
- dropDocumentOutsideOption,
916
- screenKey: screenKey2
917
- }, i) => /* @__PURE__ */ jsxRuntime.jsx(
918
- FlexLayoutContainer__default.default,
919
- {
920
- containerName: cName,
921
- isInitialResizable: true,
922
- isResizePanel: true,
923
- children: /* @__PURE__ */ jsxRuntime.jsx(
924
- FlexLayoutSplitScreenChild,
925
- {
926
- parentDirection: direction,
927
- layoutName: `${layoutName}_before-${depth}`,
928
- parentLayoutName: layoutName,
929
- containerName: cName,
930
- depth: depth + 1,
931
- rootRef,
932
- screenKey: screenKey2,
933
- initialCenterComponents: [
934
- {
935
- navigationTitle,
936
- component,
937
- containerName: cName,
938
- dropDocumentOutsideOption,
939
- screenKey: screenKey2
940
- }
941
- ],
942
- rootName
943
- }
944
- )
945
- },
946
- cName
947
- )
948
- ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", {}),
949
- centerDropTargetComponent.length != 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
950
- FlexLayoutContainer__default.default,
951
- {
952
- containerName: `${(centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName}`,
953
- isInitialResizable: true,
954
- isResizePanel: isSplit,
955
- children: isSplit ? /* @__PURE__ */ jsxRuntime.jsx("div", { "data-key": screenKey, children: /* @__PURE__ */ jsxRuntime.jsx(
956
- FlexLayoutSplitScreenChild,
957
- {
958
- parentDirection: direction,
959
- layoutName: `${layoutName}_center-${depth}`,
960
- parentLayoutName: layoutName,
961
- containerName: `${(centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName}`,
962
- depth: depth + 1,
963
- rootRef,
964
- initialCenterComponents: centerDropTargetComponent.map(
965
- ({
966
- navigationTitle,
967
- component,
968
- containerName: cName,
969
- dropDocumentOutsideOption,
970
- screenKey: centerScreenKey
971
- }) => ({
972
- navigationTitle,
973
- component,
974
- containerName: cName,
975
- dropDocumentOutsideOption,
976
- screenKey: centerScreenKey
977
- })
978
- ),
979
- screenKey,
980
- rootName
981
- }
982
- ) }) : /* @__PURE__ */ jsxRuntime.jsxs(
983
- FlexLayoutSplitScreenScrollBox__default.default,
984
- {
985
- keyName: (centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName,
986
- isDefaultScrollStyle: true,
987
- children: [
988
- !isOnlyOneScreen && /* @__PURE__ */ jsxRuntime.jsx(
989
- "div",
990
- {
991
- className: `${styles__default.default["flex-split-screen-drag-box-title-wrapper-sticky"]}`,
992
- children: /* @__PURE__ */ jsxRuntime.jsxs(
993
- "div",
994
- {
995
- "data-is_split": isSplit,
996
- "data-layout_name": layoutName,
997
- "data-parent_layout_name": parentLayoutName,
998
- "data-container_name": `${(centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName}`,
999
- className: `${styles__default.default["flex-split-screen-drag-box-title-wrapper"]}`,
1000
- children: [
1001
- /* @__PURE__ */ jsxRuntime.jsx(
1002
- FlexLayoutSplitScreenDragBoxContainer__default.default,
1003
- {
1004
- "data-layout_name": layoutName,
1005
- layoutName,
1006
- children: centerDropTargetComponent.map(
1007
- (item, index) => /* @__PURE__ */ jsxRuntime.jsx(
1008
- FlexLayoutSplitScreenDragBoxItem__default.default,
1009
- {
1010
- onClose: (ev) => {
1011
- if (activeIndexRef.current === index && centerDropTargetComponent.length === 1) {
1012
- useDrag.dropMovementEventSubject.next(
1013
- {
1014
- state: "remove",
1015
- targetContainerName: containerName,
1016
- targetParentLayoutName: parentLayoutName,
1017
- targetLayoutName: layoutName
1018
- }
1019
- );
1020
- } else {
1021
- if (centerDropTargetComponent.length === activeIndexRef.current + 1) {
1022
- setActiveIndex(
1023
- activeIndexRef.current - 1
1024
- );
1025
- }
1026
- setCenterDropTargetComponent(
1027
- (prev) => {
1028
- const result = handleRemove(
1029
- prev,
1030
- item.containerName,
1031
- () => {
1032
- }
1033
- );
1034
- return result;
1035
- }
1036
- );
1037
- }
1038
- },
1039
- isActive: activeIndex === index,
1040
- children: /* @__PURE__ */ jsxRuntime.jsx(
1041
- FlexLayoutSplitScreenDragBox__default.default,
1042
- {
1043
- onClick: () => {
1044
- setActiveIndex(
1045
- index
1046
- );
1047
- },
1048
- containerName: item.containerName,
1049
- dropDocumentOutsideOption: item.dropDocumentOutsideOption,
1050
- targetComponent: item.component,
1051
- navigationTitle: item.navigationTitle,
1052
- "data-container-name": item.containerName,
1053
- "data-layout-name": layoutName,
1054
- "data-parent-layout-name": parentLayoutName,
1055
- dropEndCallback: ({
1056
- x,
1057
- y,
1058
- containerName: appendContainerName
1059
- }) => {
1060
- if (!rootRef.current || !layoutRef.current)
1061
- return;
1062
- const isRootOver = isOverDrop(
1063
- {
1064
- x,
1065
- y,
1066
- element: rootRef.current
1067
- }
1068
- );
1069
- const isLayoutInner = isInnerDrop(
1070
- {
1071
- x,
1072
- y,
1073
- element: layoutRef.current
1074
- }
1075
- );
1076
- if (!isRootOver && !isLayoutInner || !isRootOver && isLayoutInner && centerDropTargetComponentRef.current.length > 1) {
1077
- const option = {};
1078
- if (centerDropTargetComponentRef.current.length > 1) {
1079
- const {
1080
- adjacentItem,
1081
- adjacentIndex
1082
- } = getAdjacentItem(
1083
- centerDropTargetComponentRef.current,
1084
- activeIndexRef.current
1085
- );
1086
- if (adjacentItem && activeIndexRef.current === index) {
1087
- Object.assign(
1088
- option,
1089
- {
1090
- x,
1091
- y,
1092
- targetComponent: adjacentItem.component,
1093
- nextContainerName: adjacentItem.containerName,
1094
- orderName: "center",
1095
- dropTargetComponentEvent: {
1096
- navigationTitle: adjacentItem.navigationTitle,
1097
- dropDocumentOutsideOption: adjacentItem.dropDocumentOutsideOption,
1098
- direction,
1099
- screenKey
1100
- }
1101
- }
1102
- );
1103
- }
1104
- }
1105
- if (index === 0) {
1106
- useDrag.dropMovementEventSubject.next(
1107
- {
1108
- state: "remove",
1109
- targetContainerName: item.containerName,
1110
- targetParentLayoutName: parentLayoutName,
1111
- targetLayoutName: layoutName,
1112
- ...option
1113
- }
1114
- );
1115
- } else {
1116
- useDrag.dropMovementEventSubject.next(
1117
- {
1118
- state: "remove",
1119
- targetContainerName: item.containerName,
1120
- targetParentLayoutName: "",
1121
- targetLayoutName: layoutName,
1122
- ...option
1123
- }
1124
- );
1125
- }
1126
- }
1127
- },
1128
- children: item.navigationTitle
1129
- }
1130
- )
1131
- },
1132
- item.navigationTitle + layoutName + item.containerName
1133
- )
1134
- )
1135
- },
1136
- layoutName
1137
- ),
1138
- /* @__PURE__ */ jsxRuntime.jsx(FlexLayoutSplitScreenDragBoxTitleMore__default.default, {})
1139
- ]
1140
- }
1141
- )
1142
- }
1143
- ),
1144
- (() => {
1145
- const target = centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0];
1146
- return target.component;
1147
- })()
1148
- ]
1149
- }
1150
- )
1151
- },
1152
- (centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName
1153
- ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", {}),
1154
- afterDropTargetComponent.length != 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: afterDropTargetComponent.map(
1155
- ({
1156
- containerName: cName,
1157
- component,
1158
- navigationTitle,
1159
- dropDocumentOutsideOption,
1160
- screenKey: screenKey2
1161
- }, i) => /* @__PURE__ */ jsxRuntime.jsx(
1162
- FlexLayoutContainer__default.default,
1163
- {
1164
- containerName: cName,
1165
- isInitialResizable: true,
1166
- isResizePanel: i !== afterDropTargetComponent.length - 1,
1167
- children: /* @__PURE__ */ jsxRuntime.jsx(
1168
- FlexLayoutSplitScreenChild,
1169
- {
1170
- parentDirection: direction,
1171
- layoutName: `${layoutName}_after-${depth}`,
1172
- parentLayoutName: layoutName,
1173
- containerName: cName,
1174
- depth: depth + 1,
1175
- rootRef,
1176
- screenKey: screenKey2,
1177
- initialCenterComponents: [
1178
- {
1179
- navigationTitle,
1180
- component,
1181
- containerName: cName,
1182
- dropDocumentOutsideOption,
1183
- screenKey: screenKey2
1184
- }
1185
- ],
1186
- rootName
1187
- }
1188
- )
1189
- },
1190
- cName
1191
- )
1192
- ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", {})
1193
- ]
1194
- }
1195
- ),
1196
- boundaryContainerSize && /* @__PURE__ */ jsxRuntime.jsx(
1197
- "div",
1198
- {
1199
- className: `${styles__default.default["flex-split-screen-boundary-container"]}`,
1200
- style: { ...boundaryContainerSize },
1201
- children: "\u2B07\uFE0F\uB4DC\uB86D\uD558\uBA74 \uD654\uBA74\uC774 \uBD84\uD560\uB429\uB2C8\uB2E4."
1202
- }
1203
- )
1204
- ]
1205
- }
1206
- ) });
1207
- }
1208
-
1209
- module.exports = FlexLayoutSplitScreen;
1210
- //# sourceMappingURL=FlexLayoutSplitScreen.cjs.map
1211
- //# sourceMappingURL=FlexLayoutSplitScreen.cjs.map
1
+ "use strict";"use client";var ue=Object.create;var J=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var Te=Object.getPrototypeOf,Se=Object.prototype.hasOwnProperty;var xe=(n,e)=>{for(var t in e)J(n,t,{get:e[t],enumerable:!0})},pe=(n,e,t,T)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of be(e))!Se.call(n,u)&&u!==t&&J(n,u,{get:()=>e[u],enumerable:!(T=De(e,u))||T.enumerable});return n};var j=(n,e,t)=>(t=n!=null?ue(Te(n)):{},pe(e||!n||!n.__esModule?J(t,"default",{value:n,enumerable:!0}):t,n)),Le=n=>pe(J({},"__esModule",{value:!0}),n);var ye={};xe(ye,{default:()=>ge});module.exports=Le(ye);var i=require("react/jsx-runtime"),O=require("react"),w=require("../hooks/useDrag"),te=require("../hooks/useFlexLayoutSplitScreen"),l=require("../store/FlexLayoutContainerStore"),U=j(require("../styles/FlexLayout.module.css"),1),ne=j(require("./FlexLayout"),1),K=j(require("./FlexLayoutContainer"),1),se=j(require("./FlexLayoutSplitScreenDragBox"),1),re=j(require("fast-deep-equal"),1),Y=require("rxjs"),ce=j(require("./FlexLayoutSplitScreenDragBoxContainer"),1),le=j(require("./FlexLayoutSplitScreenDragBoxItem"),1),me=j(require("./FlexLayoutSplitScreenDragBoxTitleMore"),1),oe=j(require("./FlexLayoutSplitScreenScrollBox"),1);function he({x:n,y:e,element:t}){const{x:T,y:u,right:v,bottom:s}=t.getBoundingClientRect();return n<T||n>v||e<u||e>s}function ee({x:n,y:e,element:t}){const{x:T,y:u,right:v,bottom:s}=t.getBoundingClientRect();return n>=T&&n<=v&&e>=u&&e<=s}const Q=({orderName:n,parentOrderName:e,containerName:t,parentLayoutName:T,layoutName:u,dropComponent:v,navigationTitle:s,nextContainerName:k,isUsePrefix:S=!0,beforeDropTargetComponent:D,afterDropTargetComponent:R,centerDropTargetComponent:g,dropDocumentOutsideOption:N,screenKey:E=Array.from(window.crypto.getRandomValues(new Uint32Array(16)),p=>p.toString(32).padStart(2,"0")).join("")})=>{const p=e||n;let F,C,z;p===n||p==="center"?F=n==="before"?{beforeDropTargetComponent:D}:n==="after"?{afterDropTargetComponent:R}:{centerDropTargetComponent:g.filter(a=>!a.containerName.split("_").at(0).startsWith(t.split("_").at(0)))}:F=p==="before"?{beforeDropTargetComponent:D}:{afterDropTargetComponent:R};const b=Object.entries(F)[0];z=b[0],C=b[1];const o={containerName:`${t+"_"+u}${S?"_"+n+"-"+C.length:""}`,component:(0,O.cloneElement)(v,{key:E,screenKey:E}),navigationTitle:s,dropDocumentOutsideOption:N,screenKey:E||Array.from(window.crypto.getRandomValues(new Uint32Array(16)),a=>a.toString(32).padStart(2,"0")).join("")};let m;if(k){const a=C.findIndex(P=>P.containerName===k);a!==-1?p===n?n==="before"?m=[...C.slice(0,a),o,...C.slice(a)]:m=[...C.slice(0,a+1),o,...C.slice(a+1)]:p==="after"&&n==="before"?m=[...C.slice(0,a),o,...C.slice(a)]:p==="before"&&n==="after"?m=[...C.slice(0,a+1),o,...C.slice(a+1)]:n==="before"?m=[...C.slice(0,a),o,...C.slice(a)]:m=[...C.slice(0,a+1),o,...C.slice(a+1)]:p==="center"&&n==="after"?m=[o,...C]:p==="center"&&n==="before"?m=[...C,o]:m=n==="before"?[o,...C]:[...C,o]}else m=n==="before"?[o,...C]:[...C,o];const h=new Set,$=m.filter(a=>h.has(a.containerName)?!1:(h.add(a.containerName),!0));return w.dropMovementEventSubject.next({state:"append",targetParentLayoutName:T,targetLayoutName:u,targetContainerName:t,orderName:n}),{[z]:$}},I=(n,e,t)=>{const T=n.filter(u=>u.containerName!==e);return T.length!=n.length&&t(n.length-T.length),T};function Oe(n,e){return e+1<n.length?{adjacentItem:n[e+1],adjacentIndex:e+1}:e-1>=0?{adjacentItem:n[e-1],adjacentIndex:e-1}:{adjacentItem:null,adjacentIndex:e}}const $e=n=>{const e=n.split("_").at(-1)?.split("-").at(0)?.split("=").at(0);if(["before","center","after"].some(t=>t===e))return e};function ge({children:n,containerName:e,layoutName:t,navigationTitle:T,dropDocumentOutsideOption:u,screenKey:v}){const{direction:s,isSplit:k,boundaryContainerSize:S,afterDropTargetComponent:D,beforeDropTargetComponent:R,centerDropTargetComponent:g,setAfterDropTargetComponent:N,setBeforeDropTargetComponent:E,setCenterDropTargetComponent:p,layoutRef:F,setIsSplit:C,setDirection:z}=(0,te.useFlexLayoutSplitScreen)({isSplitInitial:!1,directionInitial:"row",selfContainerName:e,parentLayoutName:"",layoutName:t});return(0,O.useEffect)(()=>{(0,l.resetRootSplitScreen)(t);const b=(0,l.getSplitScreen)(t,t).subscribe(o=>{o?(E([...o.beforeDropTargetComponent]),N([...o.afterDropTargetComponent]),p([...o.centerDropTargetComponent]),z(o.direction),(o.beforeDropTargetComponent.length!==0||o.afterDropTargetComponent.length!==0)&&C(!0)):(0,l.setSplitScreen)(t,t,{afterDropTargetComponent:[],beforeDropTargetComponent:[],centerDropTargetComponent:[{containerName:e,component:n,navigationTitle:T,dropDocumentOutsideOption:u,screenKey:v||Array.from(window.crypto.getRandomValues(new Uint32Array(16)),m=>m.toString(32).padStart(2,"0")).join("")}],direction:s})});return()=>{b.unsubscribe(),(0,l.removeRootSplitScreen)(t)}},[t,v,T,n,s]),(0,O.useEffect)(()=>{const b=w.dropMovementEventSubject.pipe((0,Y.distinctUntilChanged)((o,m)=>{const h=$=>{const{children:a,component:P,targetComponent:_,x:q,y:M,...H}=$||{};return H};return(0,re.default)(h(o),h(m))})).subscribe(o=>{if(o.state==="remove")(o.targetParentLayoutName===t||o.targetParentLayoutName===""&&o.targetLayoutName===t)&&requestAnimationFrame(()=>{let m=_=>{if(o.nextContainerName&&o.dropTargetComponentEvent&&o.targetComponent){const q=Q({orderName:_,containerName:o.nextContainerName,parentLayoutName:"",layoutName:t,dropComponent:o.targetComponent,navigationTitle:o.dropTargetComponentEvent.navigationTitle,isUsePrefix:!0,afterDropTargetComponent:D,beforeDropTargetComponent:R,centerDropTargetComponent:g,dropDocumentOutsideOption:u,screenKey:o.dropTargetComponentEvent.screenKey});(0,l.setSplitScreen)(t,t,{...(0,l.getCurrentSplitScreenComponents)(t,t)||{afterDropTargetComponent:D,beforeDropTargetComponent:R,centerDropTargetComponent:g,direction:s},...q}),Promise.resolve().then(()=>o.dropEndCallback&&o.dropEndCallback({x:o.x,y:o.y,containerName:e}))}};const h=(0,l.getCurrentSplitScreenComponents)(t,t),$=I(h?.afterDropTargetComponent||D,o.targetContainerName,()=>m("after")),a=I(h?.beforeDropTargetComponent||R,o.targetContainerName,()=>m("before")),P=I(h?.centerDropTargetComponent||g,o.targetContainerName,()=>m("center"));(0,l.setSplitScreen)(t,t,{afterDropTargetComponent:$,beforeDropTargetComponent:a,centerDropTargetComponent:P,direction:s})});else if(o.state==="append"){const{x:m,y:h,dropEndCallback:$,dropTargetComponentEvent:a,orderName:P,parentOrderName:_,targetLayoutName:q,targetParentLayoutName:M,targetContainerName:H,targetComponent:W,nextContainerName:c}=o;if(F.current&&P&&m&&h&&W&&a&&q===t&&ee({x:m,y:h,element:F.current})){const{direction:r,navigationTitle:f,dropDocumentOutsideOption:d}=a,x=P!=="center",y=P==="center"&&g.length<=1;if(x||y)if(C(!0),x){z(r);const L=Q({orderName:P,parentOrderName:_,containerName:H,nextContainerName:c,dropComponent:W,parentLayoutName:"",layoutName:t,navigationTitle:f,isUsePrefix:!0,afterDropTargetComponent:D,beforeDropTargetComponent:R,centerDropTargetComponent:g,dropDocumentOutsideOption:d});(0,l.setSplitScreen)(t,t,{afterDropTargetComponent:D,beforeDropTargetComponent:R,centerDropTargetComponent:g,direction:r,...L,direction:r}),Promise.resolve().then(()=>$&&$({x:o.x,y:o.y,containerName:e}))}else{const L=(0,l.getCurrentSplitScreenComponents)(t,`${t}_center=${g[0].screenKey}`)||{afterDropTargetComponent:[],beforeDropTargetComponent:[],centerDropTargetComponent:[],direction:s};(0,l.setSplitScreen)(t,`${t}_center=${g[0].screenKey}`,{...L,centerDropTargetComponent:[g[0],{containerName:`${H}_${t}_${P}`,component:W,dropDocumentOutsideOption:d,screenKey:a.screenKey,navigationTitle:f}]})}}}});return()=>{b.unsubscribe()}},[s,t,k,R,D,g]),(0,i.jsxs)("div",{className:`${U.default["flex-split-screen"]}`,ref:F,children:[(0,i.jsxs)(ne.default,{direction:s,layoutName:t,"data-is_split":k,panelMovementMode:"bulldozer",children:[R.length!=0?(0,i.jsx)(i.Fragment,{children:R.map(({containerName:b,component:o,navigationTitle:m,dropDocumentOutsideOption:h,screenKey:$},a)=>(0,i.jsx)(K.default,{containerName:b,isInitialResizable:!0,isResizePanel:!0,children:(0,i.jsx)(V,{parentDirection:s,layoutName:`${t}_before`,parentLayoutName:t,containerName:b,depth:1,rootRef:F,screenKey:$,initialCenterComponents:[{navigationTitle:m,component:o,containerName:b,dropDocumentOutsideOption:h,screenKey:$}],rootName:t})},b))}):(0,i.jsx)("div",{}),g.length===0?(0,i.jsx)("div",{}):(0,i.jsx)(K.default,{containerName:`${g[0].containerName}`,isInitialResizable:!0,isResizePanel:k,children:k?(0,i.jsx)(V,{parentDirection:s,layoutName:`${t}_center`,parentLayoutName:t,containerName:`${g[0].containerName}`,depth:0,rootRef:F,screenKey:g[0].screenKey,initialCenterComponents:[{navigationTitle:g[0].navigationTitle,component:g[0].component,containerName:g[0].containerName,dropDocumentOutsideOption:g[0].dropDocumentOutsideOption,screenKey:g[0].screenKey}],rootName:t}):(0,i.jsx)(oe.default,{keyName:g[0].containerName,isDefaultScrollStyle:!0,children:g[0].component})}),D.length!=0?(0,i.jsx)(i.Fragment,{children:D.map(({containerName:b,component:o,navigationTitle:m,dropDocumentOutsideOption:h,screenKey:$},a)=>(0,i.jsx)(K.default,{containerName:b,isInitialResizable:!0,isResizePanel:D.length-1!==a,children:(0,i.jsx)(V,{parentDirection:s,layoutName:`${t}_after`,parentLayoutName:t,containerName:b,depth:1,rootRef:F,screenKey:$,initialCenterComponents:[{navigationTitle:m,component:o,containerName:b,dropDocumentOutsideOption:h,screenKey:$}],rootName:t})},b))}):(0,i.jsx)("div",{})]}),S&&(0,i.jsx)("div",{className:`${U.default["flex-split-screen-boundary-container"]}`,style:{...S},children:"\u2B07\uFE0F\uB4DC\uB86D\uD558\uBA74 \uD654\uBA74\uC774 \uBD84\uD560\uB429\uB2C8\uB2E4."})]})}function V({containerName:n,layoutName:e,parentLayoutName:t,parentDirection:T,depth:u,rootRef:v,rootName:s,initialCenterComponents:k,screenKey:S}){const{direction:D,isSplit:R,boundaryContainerSize:g,afterDropTargetComponent:N,beforeDropTargetComponent:E,centerDropTargetComponent:p,setAfterDropTargetComponent:F,setBeforeDropTargetComponent:C,setCenterDropTargetComponent:z,layoutRef:b,setIsSplit:o,setDirection:m}=(0,te.useFlexLayoutSplitScreen)({isSplitInitial:!1,directionInitial:"row",parentDirection:T,selfContainerName:n,parentLayoutName:t,layoutName:e}),[h,$]=(0,O.useState)(!1),[a,P]=(0,O.useState)(0),_=(0,O.useRef)(p),q=(0,O.useRef)(k??[]),M=(0,O.useRef)(a);(0,O.useEffect)(()=>{const c=`${e}=${S}`,r=(0,l.getSplitScreen)(s,c).pipe((0,Y.take)(1)).subscribe(f=>{f||(0,l.setSplitScreen)(s,c,{afterDropTargetComponent:[],beforeDropTargetComponent:[],centerDropTargetComponent:q.current,direction:D})});return()=>{(0,l.removeSplitScreenChild)(s,`${e}=${S}`),r.unsubscribe()}},[s,e,S]),(0,O.useEffect)(()=>{const c=(0,l.getSplitScreen)(s,`${e}=${S}`).subscribe(r=>{r&&(C([...r.beforeDropTargetComponent]),F([...r.afterDropTargetComponent]),z([...r.centerDropTargetComponent]),m(r.direction),r.beforeDropTargetComponent.length!==0||r.afterDropTargetComponent.length!==0?o(!0):r.beforeDropTargetComponent.length===0&&r.centerDropTargetComponent.length===0&&r.afterDropTargetComponent.length===0&&(w.dropMovementEventSubject.next({state:"remove",targetContainerName:n,targetParentLayoutName:"",targetLayoutName:t}),$(!0)))});return()=>{c.unsubscribe(),(0,l.removeRootSplitScreen)(e)}},[s,e]),(0,O.useEffect)(()=>{const c=w.dropMovementEventSubject.pipe((0,Y.distinctUntilChanged)((r,f)=>{const d=x=>{const{children:y,component:L,targetComponent:A,x:B,y:G,...X}=x||{};return X};return(0,re.default)(d(r),d(f))})).subscribe(r=>{if(r.state==="remove")(r.targetParentLayoutName===e||r.targetParentLayoutName===""&&r.targetLayoutName===e)&&requestAnimationFrame(()=>{let f=A=>{if(r.nextContainerName&&r.dropTargetComponentEvent&&r.targetComponent){const B=Q({orderName:A,containerName:r.nextContainerName,parentLayoutName:t,layoutName:e,dropComponent:r.targetComponent,navigationTitle:r.dropTargetComponentEvent.navigationTitle,isUsePrefix:!0,afterDropTargetComponent:N,beforeDropTargetComponent:E,centerDropTargetComponent:p,dropDocumentOutsideOption:r.dropTargetComponentEvent?.dropDocumentOutsideOption,screenKey:r.dropTargetComponentEvent.screenKey});(0,l.setSplitScreen)(s,`${e}=${S}`,{...(0,l.getCurrentSplitScreenComponents)(s,`${e}=${S}`)||{afterDropTargetComponent:N,beforeDropTargetComponent:E,centerDropTargetComponent:p,direction:D},...B}),Promise.resolve().then(()=>r.dropEndCallback&&r.dropEndCallback({x:r.x,y:r.y,containerName:n}))}};const d=(0,l.getCurrentSplitScreenComponents)(s,`${e}=${S}`),x=I(d?.afterDropTargetComponent||N,r.targetContainerName,()=>f("after")),y=I(d?.beforeDropTargetComponent||E,r.targetContainerName,()=>f("before")),L=I(d?.centerDropTargetComponent||p,r.targetContainerName,()=>f("center"));(0,l.setSplitScreen)(s,`${e}=${S}`,{afterDropTargetComponent:x,beforeDropTargetComponent:y,centerDropTargetComponent:L,direction:D})});else if(r.state==="append"){const{x:f,y:d,dropEndCallback:x,dropTargetComponentEvent:y,orderName:L,targetLayoutName:A,targetParentLayoutName:B,targetContainerName:G,targetComponent:X,nextContainerName:Ce,parentOrderName:de}=r;if(b.current&&L&&f&&d&&y&&ee({x:f,y:d,element:b.current})){const{direction:Z,navigationTitle:ie,dropDocumentOutsideOption:ae,screenKey:ve}=y;if(A===e&&X)if(Z===T&&L!=="center")w.dropMovementEventSubject.next({state:"append",targetContainerName:G,targetParentLayoutName:"",targetLayoutName:t,targetComponent:X,nextContainerName:n,parentOrderName:$e(e)||L,orderName:L,x:f,y:d,dropEndCallback:x,dropTargetComponentEvent:{navigationTitle:ie,dropDocumentOutsideOption:ae,direction:T,screenKey:S}});else{L!=="center"&&(m(Z),o(!0));const fe=Q({orderName:L,parentOrderName:de,containerName:G,nextContainerName:Ce,parentLayoutName:t,layoutName:e,dropComponent:X,navigationTitle:ie,isUsePrefix:L!=="center",afterDropTargetComponent:N,beforeDropTargetComponent:E,centerDropTargetComponent:p,dropDocumentOutsideOption:ae});(0,l.setSplitScreen)(s,`${e}=${S}`,{...(0,l.getCurrentSplitScreenComponents)(s,`${e}=${S}`)||{afterDropTargetComponent:N,beforeDropTargetComponent:E,centerDropTargetComponent:p,direction:D},...fe,direction:Z}),Promise.resolve().then(()=>r.dropEndCallback&&r.dropEndCallback({x:r.x,y:r.y,containerName:n}))}}}});return()=>{c.unsubscribe()}},[D,T,t,e,E,N,p]),(0,O.useEffect)(()=>{_.current=p},[p]),(0,O.useEffect)(()=>{M.current=a},[a]);const[H,W]=(0,O.useState)(!1);return(0,i.jsx)(i.Fragment,{children:!h&&(0,i.jsxs)("div",{className:`${U.default["flex-split-screen"]}`,ref:b,children:[(0,i.jsxs)(ne.default,{direction:D,layoutName:`${e}`,panelMovementMode:"bulldozer",children:[E.length!=0?(0,i.jsx)(i.Fragment,{children:E.map(({containerName:c,component:r,navigationTitle:f,dropDocumentOutsideOption:d,screenKey:x},y)=>(0,i.jsx)(K.default,{containerName:c,isInitialResizable:!0,isResizePanel:!0,children:(0,i.jsx)(V,{parentDirection:D,layoutName:`${e}_before-${u}`,parentLayoutName:e,containerName:c,depth:u+1,rootRef:v,screenKey:x,initialCenterComponents:[{navigationTitle:f,component:r,containerName:c,dropDocumentOutsideOption:d,screenKey:x}],rootName:s})},c))}):(0,i.jsx)("div",{}),p.length!=0?(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(K.default,{containerName:`${(p[a]||p[0]).containerName}`,isInitialResizable:!0,isResizePanel:R,children:R?(0,i.jsx)("div",{"data-key":S,children:(0,i.jsx)(V,{parentDirection:D,layoutName:`${e}_center-${u}`,parentLayoutName:e,containerName:`${(p[a]||p[0]).containerName}`,depth:u+1,rootRef:v,initialCenterComponents:p.map(({navigationTitle:c,component:r,containerName:f,dropDocumentOutsideOption:d,screenKey:x})=>({navigationTitle:c,component:r,containerName:f,dropDocumentOutsideOption:d,screenKey:x})),screenKey:S,rootName:s})}):(0,i.jsxs)(oe.default,{keyName:(p[a]||p[0]).containerName,isDefaultScrollStyle:!0,children:[!H&&(0,i.jsx)("div",{className:`${U.default["flex-split-screen-drag-box-title-wrapper-sticky"]}`,children:(0,i.jsxs)("div",{"data-is_split":R,"data-layout_name":e,"data-parent_layout_name":t,"data-container_name":`${(p[a]||p[0]).containerName}`,className:`${U.default["flex-split-screen-drag-box-title-wrapper"]}`,children:[(0,i.jsx)(ce.default,{"data-layout_name":e,layoutName:e,children:p.map((c,r)=>(0,i.jsx)(le.default,{onClose:f=>{M.current===r&&p.length===1?w.dropMovementEventSubject.next({state:"remove",targetContainerName:n,targetParentLayoutName:t,targetLayoutName:e}):(p.length===M.current+1&&P(M.current-1),z(d=>{const x=I(d,c.containerName,()=>{}),y=`${e}=${S}`,L=(0,l.getCurrentSplitScreenComponents)(s,y)||{afterDropTargetComponent:N,beforeDropTargetComponent:E,centerDropTargetComponent:d,direction:D};return(0,l.setSplitScreen)(s,y,{...L,centerDropTargetComponent:x}),x}))},isActive:a===r,children:(0,i.jsx)(se.default,{screenKey:c.screenKey,onClick:()=>{P(r)},containerName:c.containerName,dropDocumentOutsideOption:c.dropDocumentOutsideOption,targetComponent:c.component,navigationTitle:c.navigationTitle,"data-container-name":c.containerName,"data-layout-name":e,"data-parent-layout-name":t,dropEndCallback:({x:f,y:d,containerName:x})=>{if(!v.current||!b.current)return;const y=he({x:f,y:d,element:v.current}),L=ee({x:f,y:d,element:b.current});if(!y&&!L||!y&&L&&_.current.length>1){const A={};if(_.current.length>1){const{adjacentItem:B,adjacentIndex:G}=Oe(_.current,M.current);B&&M.current===r&&Object.assign(A,{x:f,y:d,targetComponent:B.component,nextContainerName:B.containerName,orderName:"center",dropTargetComponentEvent:{navigationTitle:B.navigationTitle,dropDocumentOutsideOption:B.dropDocumentOutsideOption,direction:D,screenKey:S}})}r===0?w.dropMovementEventSubject.next({state:"remove",targetContainerName:c.containerName,targetParentLayoutName:t,targetLayoutName:e,...A}):w.dropMovementEventSubject.next({state:"remove",targetContainerName:c.containerName,targetParentLayoutName:"",targetLayoutName:e,...A})}},children:c.navigationTitle})},c.navigationTitle+e+c.containerName))},e),(0,i.jsx)(me.default,{})]})}),(p[a]||p[0]).component]})},(p[a]||p[0]).containerName)}):(0,i.jsx)("div",{}),N.length!=0?(0,i.jsx)(i.Fragment,{children:N.map(({containerName:c,component:r,navigationTitle:f,dropDocumentOutsideOption:d,screenKey:x},y)=>(0,i.jsx)(K.default,{containerName:c,isInitialResizable:!0,isResizePanel:y!==N.length-1,children:(0,i.jsx)(V,{parentDirection:D,layoutName:`${e}_after-${u}`,parentLayoutName:e,containerName:c,depth:u+1,rootRef:v,screenKey:x,initialCenterComponents:[{navigationTitle:f,component:r,containerName:c,dropDocumentOutsideOption:d,screenKey:x}],rootName:s})},c))}):(0,i.jsx)("div",{})]}),g&&(0,i.jsx)("div",{className:`${U.default["flex-split-screen-boundary-container"]}`,style:{...g},children:"\u2B07\uFE0F\uB4DC\uB86D\uD558\uBA74 \uD654\uBA74\uC774 \uBD84\uD560\uB429\uB2C8\uB2E4."})]})})}