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