@byeolnaerim/flex-layout 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/flex-layout/components/FlexLayout.cjs +1 -76
- package/dist/flex-layout/components/FlexLayout.js +1 -70
- package/dist/flex-layout/components/FlexLayoutContainer.cjs +1 -196
- package/dist/flex-layout/components/FlexLayoutContainer.js +1 -189
- package/dist/flex-layout/components/FlexLayoutIFramePane.cjs +1 -0
- package/dist/flex-layout/components/FlexLayoutIFramePane.d.ts +4 -0
- package/dist/flex-layout/components/FlexLayoutIFramePane.js +1 -0
- package/dist/flex-layout/components/FlexLayoutResizePanel.cjs +1 -192
- package/dist/flex-layout/components/FlexLayoutResizePanel.d.ts +1 -1
- package/dist/flex-layout/components/FlexLayoutResizePanel.js +1 -186
- package/dist/flex-layout/components/FlexLayoutSplitScreen.cjs +1 -1211
- package/dist/flex-layout/components/FlexLayoutSplitScreen.js +1 -1197
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.cjs +1 -339
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.d.ts +1 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.js +1 -333
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.cjs +1 -32
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.js +1 -25
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.cjs +1 -40
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.js +1 -34
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.cjs +1 -30
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.js +1 -24
- package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.cjs +1 -109
- package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.js +1 -103
- package/dist/flex-layout/components/FlexLayoutStickyBox.cjs +1 -226
- package/dist/flex-layout/components/FlexLayoutStickyBox.d.ts +1 -0
- package/dist/flex-layout/components/FlexLayoutStickyBox.js +1 -224
- package/dist/flex-layout/components/index.cjs +1 -52
- package/dist/flex-layout/components/index.js +1 -9
- package/dist/flex-layout/hooks/index.cjs +1 -21
- package/dist/flex-layout/hooks/index.js +1 -4
- package/dist/flex-layout/hooks/useDrag.cjs +1 -232
- package/dist/flex-layout/hooks/useDrag.d.ts +20 -0
- package/dist/flex-layout/hooks/useDrag.js +1 -219
- package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.cjs +1 -118
- package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.js +1 -116
- package/dist/flex-layout/hooks/useListPaging.cjs +1 -179
- package/dist/flex-layout/hooks/useListPaging.js +1 -175
- package/dist/flex-layout/hooks/useSizes.cjs +1 -104
- package/dist/flex-layout/hooks/useSizes.js +1 -101
- package/dist/flex-layout/index.cjs +1 -42
- package/dist/flex-layout/index.js +1 -7
- package/dist/flex-layout/providers/FlexLayoutContext.cjs +1 -26
- package/dist/flex-layout/providers/FlexLayoutContext.js +1 -23
- package/dist/flex-layout/providers/FlexLayoutHooks.cjs +1 -247
- package/dist/flex-layout/providers/FlexLayoutHooks.d.ts +5 -1
- package/dist/flex-layout/providers/FlexLayoutHooks.js +1 -238
- package/dist/flex-layout/providers/index.cjs +1 -14
- package/dist/flex-layout/providers/index.js +1 -3
- package/dist/flex-layout/store/FlexLayoutContainerStore.cjs +1 -203
- package/dist/flex-layout/store/FlexLayoutContainerStore.d.ts +1 -0
- package/dist/flex-layout/store/FlexLayoutContainerStore.js +1 -181
- package/dist/flex-layout/store/index.cjs +1 -14
- package/dist/flex-layout/store/index.js +1 -3
- package/dist/flex-layout/styles/FlexLayout.module.css +473 -416
- package/dist/flex-layout/types/FlexDirectionTypes.cjs +1 -4
- package/dist/flex-layout/types/FlexDirectionTypes.js +0 -3
- package/dist/flex-layout/types/FlexLayoutTypes.cjs +1 -4
- package/dist/flex-layout/types/FlexLayoutTypes.d.ts +1 -3
- package/dist/flex-layout/types/FlexLayoutTypes.js +0 -3
- package/dist/flex-layout/utils/FlexLayoutUtils.cjs +1 -208
- package/dist/flex-layout/utils/FlexLayoutUtils.d.ts +4 -4
- package/dist/flex-layout/utils/FlexLayoutUtils.js +1 -196
- package/dist/flex-layout/utils/index.cjs +1 -14
- package/dist/flex-layout/utils/index.js +1 -3
- package/dist/index.cjs +1 -14
- package/dist/index.js +1 -3
- package/dist/types/css.d.cjs +1 -4
- package/dist/types/css.d.js +0 -3
- package/package.json +116 -109
- package/dist/flex-layout/components/FlexLayout.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayout.js.map +0 -1
- package/dist/flex-layout/components/FlexLayoutContainer.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayoutContainer.js.map +0 -1
- package/dist/flex-layout/components/FlexLayoutResizePanel.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayoutResizePanel.js.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreen.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreen.js.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBox.js.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxContainer.js.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxItem.js.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenDragBoxTitleMore.js.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayoutSplitScreenScrollBox.js.map +0 -1
- package/dist/flex-layout/components/FlexLayoutStickyBox.cjs.map +0 -1
- package/dist/flex-layout/components/FlexLayoutStickyBox.js.map +0 -1
- package/dist/flex-layout/components/index.cjs.map +0 -1
- package/dist/flex-layout/components/index.js.map +0 -1
- package/dist/flex-layout/hooks/index.cjs.map +0 -1
- package/dist/flex-layout/hooks/index.js.map +0 -1
- package/dist/flex-layout/hooks/useDrag.cjs.map +0 -1
- package/dist/flex-layout/hooks/useDrag.js.map +0 -1
- package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.cjs.map +0 -1
- package/dist/flex-layout/hooks/useFlexLayoutSplitScreen.js.map +0 -1
- package/dist/flex-layout/hooks/useListPaging.cjs.map +0 -1
- package/dist/flex-layout/hooks/useListPaging.js.map +0 -1
- package/dist/flex-layout/hooks/useSizes.cjs.map +0 -1
- package/dist/flex-layout/hooks/useSizes.js.map +0 -1
- package/dist/flex-layout/index.cjs.map +0 -1
- package/dist/flex-layout/index.js.map +0 -1
- package/dist/flex-layout/providers/FlexLayoutContext.cjs.map +0 -1
- package/dist/flex-layout/providers/FlexLayoutContext.js.map +0 -1
- package/dist/flex-layout/providers/FlexLayoutHooks.cjs.map +0 -1
- package/dist/flex-layout/providers/FlexLayoutHooks.js.map +0 -1
- package/dist/flex-layout/providers/index.cjs.map +0 -1
- package/dist/flex-layout/providers/index.js.map +0 -1
- package/dist/flex-layout/store/FlexLayoutContainerStore.cjs.map +0 -1
- package/dist/flex-layout/store/FlexLayoutContainerStore.js.map +0 -1
- package/dist/flex-layout/store/index.cjs.map +0 -1
- package/dist/flex-layout/store/index.js.map +0 -1
- package/dist/flex-layout/types/FlexDirectionTypes.cjs.map +0 -1
- package/dist/flex-layout/types/FlexDirectionTypes.js.map +0 -1
- package/dist/flex-layout/types/FlexLayoutTypes.cjs.map +0 -1
- package/dist/flex-layout/types/FlexLayoutTypes.js.map +0 -1
- package/dist/flex-layout/utils/FlexLayoutUtils.cjs.map +0 -1
- package/dist/flex-layout/utils/FlexLayoutUtils.js.map +0 -1
- package/dist/flex-layout/utils/index.cjs.map +0 -1
- package/dist/flex-layout/utils/index.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types/css.d.cjs.map +0 -1
- package/dist/types/css.d.js.map +0 -1
|
@@ -1,238 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getLayoutInfos, flexContainerStore, getResizePanelRef } from '../store/FlexLayoutContainerStore';
|
|
3
|
-
import { getGrow, mathGrow, openFlex, closeFlex } from '../utils/FlexLayoutUtils';
|
|
4
|
-
import { Subject, map, filter, switchMap, EMPTY, fromEvent, buffer, debounceTime } from 'rxjs';
|
|
5
|
-
|
|
6
|
-
const g = globalThis;
|
|
7
|
-
g.__FLEX_SUBJECTS__ ?? (g.__FLEX_SUBJECTS__ = { openClose: {}, spread: {} });
|
|
8
|
-
const containerOpenCloseSubjectMap = g.__FLEX_SUBJECTS__.openClose;
|
|
9
|
-
const containerSpreadSubjectMap = g.__FLEX_SUBJECTS__.spread;
|
|
10
|
-
const ContainerOpenCloseProvider = ({
|
|
11
|
-
layoutName,
|
|
12
|
-
containerName,
|
|
13
|
-
sizeName
|
|
14
|
-
}) => {
|
|
15
|
-
if (!containerOpenCloseSubjectMap[containerName]) {
|
|
16
|
-
containerOpenCloseSubjectMap[containerName] = new Subject();
|
|
17
|
-
}
|
|
18
|
-
if (!containerSpreadSubjectMap[containerName]) {
|
|
19
|
-
containerSpreadSubjectMap[containerName] = new Subject();
|
|
20
|
-
}
|
|
21
|
-
const [containers, setContainers] = useState([]);
|
|
22
|
-
const [container, setContainer] = useState();
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
const subscription = getLayoutInfos(layoutName).subscribe(
|
|
25
|
-
(layout) => {
|
|
26
|
-
if (!layout || !layout.container[containerName] || !layout.container[containerName].current)
|
|
27
|
-
return;
|
|
28
|
-
setContainers(
|
|
29
|
-
Object.values(layout.container).filter(
|
|
30
|
-
(e) => e.current !== null
|
|
31
|
-
).map((e) => e.current)
|
|
32
|
-
);
|
|
33
|
-
setContainer(layout.container[containerName].current);
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
return () => subscription.unsubscribe();
|
|
37
|
-
}, [containerName, layoutName]);
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
const styleName = `${sizeName.charAt(0).toUpperCase() + sizeName.substring(1)}`;
|
|
40
|
-
const clientSize = "client" + styleName;
|
|
41
|
-
const outerSize = "outer" + styleName;
|
|
42
|
-
const maxSize = "max" + styleName;
|
|
43
|
-
const subscribe = containerOpenCloseSubjectMap[containerName].subscribe(
|
|
44
|
-
({
|
|
45
|
-
mode,
|
|
46
|
-
initOpenState: isOpenState,
|
|
47
|
-
onClose,
|
|
48
|
-
onOpen,
|
|
49
|
-
openOption = {},
|
|
50
|
-
closeOption = {}
|
|
51
|
-
}) => {
|
|
52
|
-
if (!container || containers.length === 0) return;
|
|
53
|
-
const currentGrow = getGrow(container);
|
|
54
|
-
const styleMap = window.getComputedStyle(container);
|
|
55
|
-
const maxSizeGrow = mathGrow(
|
|
56
|
-
parseInt(styleMap[maxSize]),
|
|
57
|
-
container.parentElement && container.parentElement[clientSize] || window[outerSize],
|
|
58
|
-
containers.length
|
|
59
|
-
);
|
|
60
|
-
const open = () => openFlex(container, containers, {
|
|
61
|
-
sizeName,
|
|
62
|
-
...isNaN(maxSizeGrow) ? {} : {
|
|
63
|
-
openGrowImportant: maxSizeGrow
|
|
64
|
-
},
|
|
65
|
-
...openOption
|
|
66
|
-
}).then((openTargetGrow) => {
|
|
67
|
-
if (onOpen) onOpen();
|
|
68
|
-
containerSpreadSubjectMap[containerName].next({
|
|
69
|
-
isOpen: true,
|
|
70
|
-
grow: openTargetGrow,
|
|
71
|
-
targetContainer: container
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
const close = () => closeFlex(container, containers, {
|
|
75
|
-
sizeName,
|
|
76
|
-
...closeOption
|
|
77
|
-
}).then(() => {
|
|
78
|
-
if (onClose) onClose();
|
|
79
|
-
containerSpreadSubjectMap[containerName].next({
|
|
80
|
-
isOpen: false,
|
|
81
|
-
grow: 0,
|
|
82
|
-
targetContainer: container
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
if (mode === "toggle") {
|
|
86
|
-
if (currentGrow === 0) {
|
|
87
|
-
open();
|
|
88
|
-
} else {
|
|
89
|
-
close();
|
|
90
|
-
}
|
|
91
|
-
} else if (mode === "open") {
|
|
92
|
-
if (currentGrow === 0) {
|
|
93
|
-
open();
|
|
94
|
-
}
|
|
95
|
-
} else if (mode === "close") {
|
|
96
|
-
if (currentGrow !== 0) {
|
|
97
|
-
close();
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
);
|
|
102
|
-
return () => {
|
|
103
|
-
subscribe.unsubscribe();
|
|
104
|
-
};
|
|
105
|
-
}, [containerName, container, containers, sizeName]);
|
|
106
|
-
return null;
|
|
107
|
-
};
|
|
108
|
-
const useContainers = (layoutName) => {
|
|
109
|
-
const [containers, setContainers] = useState([]);
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
const subscription = getLayoutInfos(layoutName).subscribe(
|
|
112
|
-
(layout) => {
|
|
113
|
-
setContainers(
|
|
114
|
-
Object.values(layout.container).filter(
|
|
115
|
-
(e) => e.current !== null
|
|
116
|
-
).map((e) => e.current)
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
);
|
|
120
|
-
return () => subscription.unsubscribe();
|
|
121
|
-
}, [layoutName]);
|
|
122
|
-
return containers;
|
|
123
|
-
};
|
|
124
|
-
const useLayoutName = (containerName) => {
|
|
125
|
-
const [layoutName, setLayoutName] = useState();
|
|
126
|
-
useEffect(() => {
|
|
127
|
-
const subscribe = flexContainerStore.pipe(
|
|
128
|
-
map(
|
|
129
|
-
(layouts) => Object.entries(layouts).filter(([_, v]) => v[containerName]).map(([k]) => k)[0]
|
|
130
|
-
// 첫 번째 결과 가져오기
|
|
131
|
-
)
|
|
132
|
-
).subscribe(setLayoutName);
|
|
133
|
-
return () => subscribe.unsubscribe();
|
|
134
|
-
}, [containerName]);
|
|
135
|
-
return layoutName;
|
|
136
|
-
};
|
|
137
|
-
const useDecompositionLayout = ({
|
|
138
|
-
layoutName: initialLayoutName,
|
|
139
|
-
containerName
|
|
140
|
-
}) => {
|
|
141
|
-
const derivedLayoutName = useLayoutName(containerName);
|
|
142
|
-
const finalLayoutName = initialLayoutName || derivedLayoutName;
|
|
143
|
-
const [containers, setContainers] = useState([]);
|
|
144
|
-
const [container, setContainer] = useState();
|
|
145
|
-
const [resizePanel, setResizePanel] = useState();
|
|
146
|
-
useEffect(() => {
|
|
147
|
-
if (!finalLayoutName) return;
|
|
148
|
-
const subscription = getLayoutInfos(finalLayoutName).subscribe(
|
|
149
|
-
(layout) => {
|
|
150
|
-
if (!layout) return;
|
|
151
|
-
setContainers(
|
|
152
|
-
Object.values(layout.container).filter(
|
|
153
|
-
(e) => e.current !== null
|
|
154
|
-
).map((e) => e.current)
|
|
155
|
-
);
|
|
156
|
-
if (containerName && layout.container[containerName] && layout.container[containerName].current) {
|
|
157
|
-
setContainer(layout.container[containerName].current);
|
|
158
|
-
if (layout.resizePanel[containerName] && layout.resizePanel[containerName].current) {
|
|
159
|
-
setResizePanel(
|
|
160
|
-
layout.resizePanel[containerName].current
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
);
|
|
166
|
-
return () => subscription.unsubscribe();
|
|
167
|
-
}, [containerName, finalLayoutName]);
|
|
168
|
-
return { layout: containers, container, resizePanel };
|
|
169
|
-
};
|
|
170
|
-
const useContainerSize = (containerName) => {
|
|
171
|
-
const { layout, container, resizePanel } = useDecompositionLayout({
|
|
172
|
-
containerName
|
|
173
|
-
});
|
|
174
|
-
const [size, setSize] = useState();
|
|
175
|
-
useEffect(() => {
|
|
176
|
-
if (!container) return;
|
|
177
|
-
const observer = new ResizeObserver((entries) => {
|
|
178
|
-
for (const entry of entries) {
|
|
179
|
-
setSize({
|
|
180
|
-
width: entry.contentRect.width,
|
|
181
|
-
height: entry.contentRect.height
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
observer.observe(container);
|
|
186
|
-
return () => observer.disconnect();
|
|
187
|
-
}, [container]);
|
|
188
|
-
return { size };
|
|
189
|
-
};
|
|
190
|
-
const useDoubleClick = (containerName, opt) => {
|
|
191
|
-
const [isOpen, setIsOpen] = useState();
|
|
192
|
-
const [isDoubleClick, setIsDoubleClick] = useState();
|
|
193
|
-
useEffect(() => {
|
|
194
|
-
const resizePanelClickEvent = getResizePanelRef({
|
|
195
|
-
containerName
|
|
196
|
-
}).pipe(
|
|
197
|
-
filter(
|
|
198
|
-
(resizePanelref) => resizePanelref != void 0 && resizePanelref.current != void 0
|
|
199
|
-
),
|
|
200
|
-
//take(1),
|
|
201
|
-
switchMap((resizePanelref) => {
|
|
202
|
-
if (!resizePanelref || !resizePanelref.current) return EMPTY;
|
|
203
|
-
return fromEvent(resizePanelref.current, "click");
|
|
204
|
-
})
|
|
205
|
-
);
|
|
206
|
-
const subscribe = resizePanelClickEvent.pipe(
|
|
207
|
-
buffer(resizePanelClickEvent.pipe(debounceTime(500))),
|
|
208
|
-
filter((clickEventArray) => clickEventArray.length >= 2),
|
|
209
|
-
map((events) => {
|
|
210
|
-
containerOpenCloseSubjectMap[containerName].next({
|
|
211
|
-
...opt,
|
|
212
|
-
openOption: {
|
|
213
|
-
...opt.openOption,
|
|
214
|
-
isPrevSizeOpen: false
|
|
215
|
-
},
|
|
216
|
-
onClose: () => {
|
|
217
|
-
if (opt.onClose) opt.onClose();
|
|
218
|
-
setIsOpen(false);
|
|
219
|
-
setIsDoubleClick(true);
|
|
220
|
-
},
|
|
221
|
-
onOpen: () => {
|
|
222
|
-
if (opt.onOpen) opt.onOpen();
|
|
223
|
-
setIsOpen(true);
|
|
224
|
-
setIsDoubleClick(true);
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
})
|
|
228
|
-
).subscribe();
|
|
229
|
-
return () => {
|
|
230
|
-
subscribe.unsubscribe();
|
|
231
|
-
};
|
|
232
|
-
}, [containerName]);
|
|
233
|
-
return { isOpen, isDoubleClick, setIsDoubleClick };
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
export { ContainerOpenCloseProvider, containerOpenCloseSubjectMap, containerSpreadSubjectMap, useContainerSize, useContainers, useDecompositionLayout, useDoubleClick, useLayoutName };
|
|
237
|
-
//# sourceMappingURL=FlexLayoutHooks.js.map
|
|
238
|
-
//# sourceMappingURL=FlexLayoutHooks.js.map
|
|
1
|
+
"use client";import{useEffect as a,useState as l}from"react";import{flexContainerStore as k,getLayoutInfos as E,getResizePanelRef as D}from"../store/FlexLayoutContainerStore";import{closeFlex as I,getGrow as y,mathGrow as G,openFlex as F}from"../utils/FlexLayoutUtils";import{buffer as M,debounceTime as z,EMPTY as q,filter as O,fromEvent as U,map as B,Subject as v,switchMap as J}from"rxjs";const g=globalThis;g.__FLEX_SUBJECTS__??(g.__FLEX_SUBJECTS__={openClose:{},spread:{}});const C=g.__FLEX_SUBJECTS__.openClose,S=g.__FLEX_SUBJECTS__.spread,V=({layoutName:n,containerName:e,sizeName:r})=>{C[e]||(C[e]=new v),S[e]||(S[e]=new v);const[s,o]=l([]),[t,c]=l();return a(()=>{const u=E(n).subscribe(i=>{!i||!i.container[e]||!i.container[e].current||(o(Object.values(i.container).filter(b=>b.current!==null).map(b=>b.current)),c(i.container[e].current))});return()=>u.unsubscribe()},[e,n]),a(()=>{const u=`${r.charAt(0).toUpperCase()+r.substring(1)}`,i="client"+u,b="outer"+u,h="max"+u,p=C[e].subscribe(({mode:f,initOpenState:$,onClose:m,onOpen:w,openOption:R={},closeOption:H={}})=>{if(!t||s.length===0)return;const d=y(t),P=window.getComputedStyle(t),x=G(parseInt(P[h]),t.parentElement&&t.parentElement[i]||window[b],s.length),L=()=>F(t,s,{sizeName:r,...isNaN(x)?{}:{openGrowImportant:x},...R}).then(j=>{w&&w(),S[e].next({isOpen:!0,grow:j,targetContainer:t})}),T=()=>I(t,s,{sizeName:r,...H}).then(()=>{m&&m(),S[e].next({isOpen:!1,grow:0,targetContainer:t})});f==="toggle"?d===0?L():T():f==="open"?d===0&&L():f==="close"&&d!==0&&T()});return()=>{p.unsubscribe()}},[e,t,s,r]),null},Z=n=>{const[e,r]=l([]);return a(()=>{const s=E(n).subscribe(o=>{r(Object.values(o.container).filter(t=>t.current!==null).map(t=>t.current))});return()=>s.unsubscribe()},[n]),e},W=n=>{const[e,r]=l();return a(()=>{const s=k.pipe(B(o=>Object.entries(o).filter(([t,c])=>c[n]).map(([t])=>t)[0])).subscribe(r);return()=>s.unsubscribe()},[n]),e},X=({layoutName:n,containerName:e})=>{const r=W(e),s=n||r,[o,t]=l([]),[c,u]=l(),[i,b]=l();return a(()=>{if(!s)return;const h=E(s).subscribe(p=>{p&&(t(Object.values(p.container).filter(f=>f.current!==null).map(f=>f.current)),e&&p.container[e]&&p.container[e].current&&(u(p.container[e].current),p.resizePanel[e]&&p.resizePanel[e].current&&b(p.resizePanel[e].current)))});return()=>h.unsubscribe()},[e,s]),{layout:o,container:c,resizePanel:i}},N=n=>{const{layout:e,container:r,resizePanel:s}=X({containerName:n}),[o,t]=l();return a(()=>{if(!r)return;const c=new ResizeObserver(u=>{for(const i of u)t({width:i.contentRect.width,height:i.contentRect.height})});return c.observe(r),()=>c.disconnect()},[r]),{size:o}},_=n=>D({containerName:n}).pipe(O(e=>e!=null&&e.current!=null),J(e=>!e||!e.current?q:U(e.current,"click"))),ee=(n,e)=>{const[r,s]=l(),[o,t]=l();return a(()=>{const c=_(n),u=c.pipe(M(c.pipe(z(500))),O(i=>i.length>=2)).subscribe(()=>{C[n].next({...e,openOption:{...e.openOption,isPrevSizeOpen:!1},onClose:()=>{e.onClose&&e.onClose(),s(!1),t(!0)},onOpen:()=>{e.onOpen&&e.onOpen(),s(!0),t(!0)}})});return()=>{u.unsubscribe()}},[n]),{isOpen:r,isDoubleClick:o,setIsDoubleClick:t}},te=n=>{const[e,r]=l();return a(()=>{const s=_(n),o=s.pipe(M(s.pipe(z(500))),O(t=>t.length>=2)).subscribe(()=>{r(!0)});return()=>{o.unsubscribe()}},[n]),{isDoubleClick:e,setIsDoubleClick:r}};export{V as ContainerOpenCloseProvider,C as containerOpenCloseSubjectMap,S as containerSpreadSubjectMap,N as useContainerSize,Z as useContainers,X as useDecompositionLayout,te as useDoubleClick,ee as useDoubleClickToggle,W as useLayoutName};
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var FlexLayoutHooks = require('./FlexLayoutHooks');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.keys(FlexLayoutHooks).forEach(function (k) {
|
|
8
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () { return FlexLayoutHooks[k]; }
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
//# sourceMappingURL=index.cjs.map
|
|
14
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(r,o,f,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of c(o))!d.call(r,e)&&e!==f&&a(r,e,{get:()=>o[e],enumerable:!(x=b(o,e))||x.enumerable});return r},t=(r,o,f)=>(p(r,o,"default"),f&&p(f,o,"default"));var g=r=>p(a({},"__esModule",{value:!0}),r);var m={};module.exports=g(m);t(m,require("./FlexLayoutHooks"),module.exports);0&&(module.exports={...require("./FlexLayoutHooks")});
|
|
@@ -1,203 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var equal = require('fast-deep-equal');
|
|
4
|
-
var rxjs = require('rxjs');
|
|
5
|
-
var operators = require('rxjs/operators');
|
|
6
|
-
|
|
7
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
-
|
|
9
|
-
var equal__default = /*#__PURE__*/_interopDefault(equal);
|
|
10
|
-
|
|
11
|
-
function updateScrollStore(subject, newValue) {
|
|
12
|
-
const currentValue = subject.getValue();
|
|
13
|
-
if (!equal__default.default(currentValue, newValue)) {
|
|
14
|
-
subject.next(newValue);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function updateRefStore(store, newState) {
|
|
18
|
-
const prevState = store.getValue();
|
|
19
|
-
if (!equal__default.default(prevState, newState)) {
|
|
20
|
-
store.next(newState);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function updateSplitScreenStore(newValue) {
|
|
24
|
-
const prevValue = layoutSplitScreenStore.getValue();
|
|
25
|
-
if (!equal__default.default(prevValue, newValue)) {
|
|
26
|
-
layoutSplitScreenStore.next(newValue);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
const scrollPositions = {};
|
|
30
|
-
const scrollPositionsSubject = new rxjs.BehaviorSubject(scrollPositions);
|
|
31
|
-
const setScrollPosition = (layoutName, position) => {
|
|
32
|
-
const current = scrollPositionsSubject.getValue();
|
|
33
|
-
const prevPos = current[layoutName];
|
|
34
|
-
if (prevPos && prevPos.x === position.x && prevPos.y === position.y) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const newPositions = {
|
|
38
|
-
...current,
|
|
39
|
-
[layoutName]: position
|
|
40
|
-
};
|
|
41
|
-
updateScrollStore(scrollPositionsSubject, newPositions);
|
|
42
|
-
};
|
|
43
|
-
const getScrollPosition = (layoutName) => {
|
|
44
|
-
return scrollPositionsSubject.pipe(
|
|
45
|
-
// 해당 layoutName이 정의되지 않았을 때는 제외
|
|
46
|
-
operators.filter((e) => e[layoutName] !== void 0),
|
|
47
|
-
operators.map((positions) => positions[layoutName]),
|
|
48
|
-
operators.distinctUntilChanged(
|
|
49
|
-
(prev, curr) => prev?.x === curr?.x && prev?.y === curr?.y
|
|
50
|
-
)
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
const removeScrollPosition = (layoutName) => {
|
|
54
|
-
const current = scrollPositionsSubject.getValue();
|
|
55
|
-
delete current[layoutName];
|
|
56
|
-
const newPositions = { ...current };
|
|
57
|
-
updateScrollStore(scrollPositionsSubject, newPositions);
|
|
58
|
-
};
|
|
59
|
-
const layoutSplitScreenStore = new rxjs.BehaviorSubject({});
|
|
60
|
-
const setSplitScreen = (rootName, layoutName, newComponents) => {
|
|
61
|
-
const current = layoutSplitScreenStore.getValue();
|
|
62
|
-
const updatedLayout = { ...current[rootName] || {} };
|
|
63
|
-
updatedLayout[layoutName] = newComponents;
|
|
64
|
-
const newStoreValue = {
|
|
65
|
-
...current,
|
|
66
|
-
[rootName]: updatedLayout
|
|
67
|
-
};
|
|
68
|
-
updateSplitScreenStore(newStoreValue);
|
|
69
|
-
};
|
|
70
|
-
const resetRootSplitScreen = (rootName) => {
|
|
71
|
-
const current = layoutSplitScreenStore.getValue();
|
|
72
|
-
const newStoreValue = {
|
|
73
|
-
...current,
|
|
74
|
-
[rootName]: {}
|
|
75
|
-
};
|
|
76
|
-
updateSplitScreenStore(newStoreValue);
|
|
77
|
-
};
|
|
78
|
-
const removeSplitScreenChild = (rootName, layoutName) => {
|
|
79
|
-
const current = layoutSplitScreenStore.getValue();
|
|
80
|
-
if (!current[rootName]) return;
|
|
81
|
-
const updatedLayout = { ...current[rootName] };
|
|
82
|
-
delete updatedLayout[layoutName];
|
|
83
|
-
const newStoreValue = {
|
|
84
|
-
...current,
|
|
85
|
-
[rootName]: updatedLayout
|
|
86
|
-
};
|
|
87
|
-
updateSplitScreenStore(newStoreValue);
|
|
88
|
-
};
|
|
89
|
-
const getCurrentSplitScreenComponents = (rootName, layoutName) => {
|
|
90
|
-
const current = layoutSplitScreenStore.getValue();
|
|
91
|
-
if (!current[rootName]) return;
|
|
92
|
-
return current[rootName][layoutName];
|
|
93
|
-
};
|
|
94
|
-
const getSplitScreen = (rootName, layoutName) => {
|
|
95
|
-
return layoutSplitScreenStore.pipe(
|
|
96
|
-
operators.map((splitScreen) => splitScreen[rootName][layoutName]),
|
|
97
|
-
operators.distinctUntilChanged((prev, curr) => {
|
|
98
|
-
const filterChildren = (obj) => {
|
|
99
|
-
const { children, component, targetComponent, x, y, ...rest } = obj || {};
|
|
100
|
-
return rest;
|
|
101
|
-
};
|
|
102
|
-
return equal__default.default(filterChildren(prev), filterChildren(curr));
|
|
103
|
-
})
|
|
104
|
-
);
|
|
105
|
-
};
|
|
106
|
-
const flexContainerStore = new rxjs.BehaviorSubject({});
|
|
107
|
-
const flexResizePanelStore = new rxjs.BehaviorSubject({});
|
|
108
|
-
const setContainerRef = (layoutName, containerName, ref) => {
|
|
109
|
-
const currentRefs = flexContainerStore.getValue();
|
|
110
|
-
const updatedLayoutRefs = { ...currentRefs[layoutName] || {} };
|
|
111
|
-
if (ref === null) {
|
|
112
|
-
delete updatedLayoutRefs[containerName];
|
|
113
|
-
} else {
|
|
114
|
-
updatedLayoutRefs[containerName] = ref;
|
|
115
|
-
}
|
|
116
|
-
const newRefs = {
|
|
117
|
-
...currentRefs,
|
|
118
|
-
[layoutName]: updatedLayoutRefs
|
|
119
|
-
};
|
|
120
|
-
updateRefStore(flexContainerStore, newRefs);
|
|
121
|
-
};
|
|
122
|
-
const setResizePanelRef = (layoutName, containerName, ref) => {
|
|
123
|
-
const currentRefs = flexResizePanelStore.getValue();
|
|
124
|
-
const updatedLayoutRefs = { ...currentRefs[layoutName] || {} };
|
|
125
|
-
if (ref === null) {
|
|
126
|
-
delete updatedLayoutRefs[containerName];
|
|
127
|
-
} else {
|
|
128
|
-
updatedLayoutRefs[containerName] = ref;
|
|
129
|
-
}
|
|
130
|
-
const newRefs = {
|
|
131
|
-
...currentRefs,
|
|
132
|
-
[layoutName]: updatedLayoutRefs
|
|
133
|
-
};
|
|
134
|
-
updateRefStore(flexResizePanelStore, newRefs);
|
|
135
|
-
};
|
|
136
|
-
const getLayoutInfos = (layoutName) => {
|
|
137
|
-
return rxjs.combineLatest([flexContainerStore, flexResizePanelStore]).pipe(
|
|
138
|
-
operators.map(([containerRefs, resizePanelRefs]) => {
|
|
139
|
-
const containerData = containerRefs[layoutName] || {};
|
|
140
|
-
const resizePanelData = resizePanelRefs[layoutName] || {};
|
|
141
|
-
return {
|
|
142
|
-
container: containerData,
|
|
143
|
-
resizePanel: resizePanelData
|
|
144
|
-
};
|
|
145
|
-
}),
|
|
146
|
-
operators.filter((result) => result.container !== null)
|
|
147
|
-
// 빈 객체 제외
|
|
148
|
-
);
|
|
149
|
-
};
|
|
150
|
-
const getContainerRef = ({
|
|
151
|
-
containerName,
|
|
152
|
-
layoutName
|
|
153
|
-
}) => {
|
|
154
|
-
return flexContainerStore.pipe(
|
|
155
|
-
operators.map((refs) => {
|
|
156
|
-
if (layoutName) {
|
|
157
|
-
return refs[layoutName]?.[containerName] || null;
|
|
158
|
-
} else {
|
|
159
|
-
return Object.entries(refs).find(
|
|
160
|
-
([key, value]) => refs[key][containerName]
|
|
161
|
-
)?.[1][containerName];
|
|
162
|
-
}
|
|
163
|
-
}),
|
|
164
|
-
operators.filter((ref) => ref !== null)
|
|
165
|
-
);
|
|
166
|
-
};
|
|
167
|
-
const getResizePanelRef = ({
|
|
168
|
-
containerName,
|
|
169
|
-
layoutName
|
|
170
|
-
}) => {
|
|
171
|
-
return flexResizePanelStore.pipe(
|
|
172
|
-
operators.map((refs) => {
|
|
173
|
-
if (layoutName) {
|
|
174
|
-
return refs[layoutName]?.[containerName] || null;
|
|
175
|
-
} else {
|
|
176
|
-
return Object.entries(refs).find(
|
|
177
|
-
([key, value]) => refs[key][containerName]
|
|
178
|
-
)?.[1][containerName];
|
|
179
|
-
}
|
|
180
|
-
}),
|
|
181
|
-
operators.filter((ref) => ref !== null)
|
|
182
|
-
);
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
exports.flexContainerStore = flexContainerStore;
|
|
186
|
-
exports.flexResizePanelStore = flexResizePanelStore;
|
|
187
|
-
exports.getContainerRef = getContainerRef;
|
|
188
|
-
exports.getCurrentSplitScreenComponents = getCurrentSplitScreenComponents;
|
|
189
|
-
exports.getLayoutInfos = getLayoutInfos;
|
|
190
|
-
exports.getResizePanelRef = getResizePanelRef;
|
|
191
|
-
exports.getScrollPosition = getScrollPosition;
|
|
192
|
-
exports.getSplitScreen = getSplitScreen;
|
|
193
|
-
exports.layoutSplitScreenStore = layoutSplitScreenStore;
|
|
194
|
-
exports.removeScrollPosition = removeScrollPosition;
|
|
195
|
-
exports.removeSplitScreenChild = removeSplitScreenChild;
|
|
196
|
-
exports.resetRootSplitScreen = resetRootSplitScreen;
|
|
197
|
-
exports.scrollPositions = scrollPositions;
|
|
198
|
-
exports.setContainerRef = setContainerRef;
|
|
199
|
-
exports.setResizePanelRef = setResizePanelRef;
|
|
200
|
-
exports.setScrollPosition = setScrollPosition;
|
|
201
|
-
exports.setSplitScreen = setSplitScreen;
|
|
202
|
-
//# sourceMappingURL=FlexLayoutContainerStore.cjs.map
|
|
203
|
-
//# sourceMappingURL=FlexLayoutContainerStore.cjs.map
|
|
1
|
+
"use strict";"use client";var m=Object.create;var a=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var D=(t,e)=>{for(var n in e)a(t,n,{get:e[n],enumerable:!0})},T=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of L(e))!h.call(t,o)&&o!==n&&a(t,o,{get:()=>e[o],enumerable:!(r=V(e,o))||r.enumerable});return t};var O=(t,e,n)=>(n=t!=null?m(j(t)):{},T(e||!t||!t.__esModule?a(n,"default",{value:t,enumerable:!0}):n,t)),w=t=>T(a({},"__esModule",{value:!0}),t);var J={};D(J,{flexContainerStore:()=>u,flexResizePanelStore:()=>p,getContainerRef:()=>F,getCurrentSplitScreenComponents:()=>B,getLayoutInfos:()=>A,getResizePanelRef:()=>G,getScrollPosition:()=>v,getSplitScreen:()=>q,layoutSplitScreenStore:()=>i,removeRootSplitScreen:()=>H,removeScrollPosition:()=>z,removeSplitScreenChild:()=>M,resetRootSplitScreen:()=>E,scrollPositions:()=>P,setContainerRef:()=>I,setResizePanelRef:()=>U,setScrollPosition:()=>_,setSplitScreen:()=>k});module.exports=w(J);var d=O(require("fast-deep-equal"),1),c=require("rxjs"),s=require("rxjs/operators");function y(t,e){const n=t.getValue();(0,d.default)(n,e)||t.next(e)}function R(t){i.next(t)}const P={},S=new c.BehaviorSubject(P),_=(t,e)=>{const n=S.getValue(),r=n[t];if(r&&r.x===e.x&&r.y===e.y)return;const o={...n,[t]:e};y(S,o)},v=t=>S.pipe((0,s.filter)(e=>e[t]!==void 0),(0,s.map)(e=>e[t]),(0,s.distinctUntilChanged)((e,n)=>e?.x===n?.x&&e?.y===n?.y)),z=t=>{const e=S.getValue(),{[t]:n,...r}=e;y(S,r)},i=new c.BehaviorSubject({}),k=(t,e,n)=>{const r=i.getValue(),o={...r[t]||{}};o[e]=n;const g={...r,[t]:o};R(g)},E=t=>{const n={...i.getValue(),[t]:{}};R(n)},H=t=>{const e=i.getValue();if(!e[t])return;const{[t]:n,...r}=e;R(r)},M=(t,e)=>{const n=i.getValue();if(!n[t])return;const r={...n[t]};delete r[e];const o={...n,[t]:r};R(o)},B=(t,e)=>{const n=i.getValue();if(n[t])return n[t][e]},q=(t,e)=>i.pipe((0,s.map)(n=>n[t]?.[e]),(0,s.distinctUntilChanged)((n,r)=>{const o=g=>{const{children:l,component:f,targetComponent:C,x,y:K,...b}=g||{};return b};return(0,d.default)(o(n),o(r))})),u=new c.BehaviorSubject({}),p=new c.BehaviorSubject({}),I=(t,e,n)=>{const r=u.getValue(),o=r[t]||{};if(n===null){if(!(e in o))return;const{[e]:g,...l}=o,f=Object.keys(l).length===0?(()=>{const{[t]:C,...x}=r;return x})():{...r,[t]:l};u.next(f);return}o[e]!==n&&u.next({...r,[t]:{...o,[e]:n}})},U=(t,e,n)=>{const r=p.getValue(),o=r[t]||{};if(n===null){if(!(e in o))return;const{[e]:g,...l}=o,f=Object.keys(l).length===0?(()=>{const{[t]:C,...x}=r;return x})():{...r,[t]:l};p.next(f);return}o[e]!==n&&p.next({...r,[t]:{...o,[e]:n}})},A=t=>(0,c.combineLatest)([u,p]).pipe((0,s.map)(([e,n])=>{const r=e[t]||{},o=n[t]||{};return{container:r,resizePanel:o}}),(0,s.filter)(e=>e.container!==null&&Object.keys(e.container).length>0)),F=({containerName:t,layoutName:e})=>u.pipe((0,s.map)(n=>e?n[e]?.[t]||null:Object.entries(n).find(([r,o])=>n[r][t])?.[1][t]),(0,s.filter)(n=>n!==null)),G=({containerName:t,layoutName:e})=>p.pipe((0,s.map)(n=>e?n[e]?.[t]||null:Object.entries(n).find(([r,o])=>n[r][t])?.[1][t]),(0,s.filter)(n=>n!==null));0&&(module.exports={flexContainerStore,flexResizePanelStore,getContainerRef,getCurrentSplitScreenComponents,getLayoutInfos,getResizePanelRef,getScrollPosition,getSplitScreen,layoutSplitScreenStore,removeRootSplitScreen,removeScrollPosition,removeSplitScreenChild,resetRootSplitScreen,scrollPositions,setContainerRef,setResizePanelRef,setScrollPosition,setSplitScreen});
|
|
@@ -27,6 +27,7 @@ export type LayoutSplitScreenState = Record<string, Record<string, SplitScreenCo
|
|
|
27
27
|
export declare const layoutSplitScreenStore: BehaviorSubject<LayoutSplitScreenState>;
|
|
28
28
|
export declare const setSplitScreen: (rootName: string, layoutName: string, newComponents: SplitScreenComponents) => void;
|
|
29
29
|
export declare const resetRootSplitScreen: (rootName: string) => void;
|
|
30
|
+
export declare const removeRootSplitScreen: (rootName: string) => void;
|
|
30
31
|
export declare const removeSplitScreenChild: (rootName: string, layoutName: string) => void;
|
|
31
32
|
export declare const getCurrentSplitScreenComponents: (rootName: string, layoutName: string) => SplitScreenComponents | undefined;
|
|
32
33
|
export declare const getSplitScreen: (rootName: string, layoutName: string) => import("rxjs").Observable<SplitScreenComponents>;
|
|
@@ -1,181 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { BehaviorSubject, combineLatest } from 'rxjs';
|
|
3
|
-
import { filter, map, distinctUntilChanged } from 'rxjs/operators';
|
|
4
|
-
|
|
5
|
-
function updateScrollStore(subject, newValue) {
|
|
6
|
-
const currentValue = subject.getValue();
|
|
7
|
-
if (!equal(currentValue, newValue)) {
|
|
8
|
-
subject.next(newValue);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
function updateRefStore(store, newState) {
|
|
12
|
-
const prevState = store.getValue();
|
|
13
|
-
if (!equal(prevState, newState)) {
|
|
14
|
-
store.next(newState);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function updateSplitScreenStore(newValue) {
|
|
18
|
-
const prevValue = layoutSplitScreenStore.getValue();
|
|
19
|
-
if (!equal(prevValue, newValue)) {
|
|
20
|
-
layoutSplitScreenStore.next(newValue);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
const scrollPositions = {};
|
|
24
|
-
const scrollPositionsSubject = new BehaviorSubject(scrollPositions);
|
|
25
|
-
const setScrollPosition = (layoutName, position) => {
|
|
26
|
-
const current = scrollPositionsSubject.getValue();
|
|
27
|
-
const prevPos = current[layoutName];
|
|
28
|
-
if (prevPos && prevPos.x === position.x && prevPos.y === position.y) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const newPositions = {
|
|
32
|
-
...current,
|
|
33
|
-
[layoutName]: position
|
|
34
|
-
};
|
|
35
|
-
updateScrollStore(scrollPositionsSubject, newPositions);
|
|
36
|
-
};
|
|
37
|
-
const getScrollPosition = (layoutName) => {
|
|
38
|
-
return scrollPositionsSubject.pipe(
|
|
39
|
-
// 해당 layoutName이 정의되지 않았을 때는 제외
|
|
40
|
-
filter((e) => e[layoutName] !== void 0),
|
|
41
|
-
map((positions) => positions[layoutName]),
|
|
42
|
-
distinctUntilChanged(
|
|
43
|
-
(prev, curr) => prev?.x === curr?.x && prev?.y === curr?.y
|
|
44
|
-
)
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
const removeScrollPosition = (layoutName) => {
|
|
48
|
-
const current = scrollPositionsSubject.getValue();
|
|
49
|
-
delete current[layoutName];
|
|
50
|
-
const newPositions = { ...current };
|
|
51
|
-
updateScrollStore(scrollPositionsSubject, newPositions);
|
|
52
|
-
};
|
|
53
|
-
const layoutSplitScreenStore = new BehaviorSubject({});
|
|
54
|
-
const setSplitScreen = (rootName, layoutName, newComponents) => {
|
|
55
|
-
const current = layoutSplitScreenStore.getValue();
|
|
56
|
-
const updatedLayout = { ...current[rootName] || {} };
|
|
57
|
-
updatedLayout[layoutName] = newComponents;
|
|
58
|
-
const newStoreValue = {
|
|
59
|
-
...current,
|
|
60
|
-
[rootName]: updatedLayout
|
|
61
|
-
};
|
|
62
|
-
updateSplitScreenStore(newStoreValue);
|
|
63
|
-
};
|
|
64
|
-
const resetRootSplitScreen = (rootName) => {
|
|
65
|
-
const current = layoutSplitScreenStore.getValue();
|
|
66
|
-
const newStoreValue = {
|
|
67
|
-
...current,
|
|
68
|
-
[rootName]: {}
|
|
69
|
-
};
|
|
70
|
-
updateSplitScreenStore(newStoreValue);
|
|
71
|
-
};
|
|
72
|
-
const removeSplitScreenChild = (rootName, layoutName) => {
|
|
73
|
-
const current = layoutSplitScreenStore.getValue();
|
|
74
|
-
if (!current[rootName]) return;
|
|
75
|
-
const updatedLayout = { ...current[rootName] };
|
|
76
|
-
delete updatedLayout[layoutName];
|
|
77
|
-
const newStoreValue = {
|
|
78
|
-
...current,
|
|
79
|
-
[rootName]: updatedLayout
|
|
80
|
-
};
|
|
81
|
-
updateSplitScreenStore(newStoreValue);
|
|
82
|
-
};
|
|
83
|
-
const getCurrentSplitScreenComponents = (rootName, layoutName) => {
|
|
84
|
-
const current = layoutSplitScreenStore.getValue();
|
|
85
|
-
if (!current[rootName]) return;
|
|
86
|
-
return current[rootName][layoutName];
|
|
87
|
-
};
|
|
88
|
-
const getSplitScreen = (rootName, layoutName) => {
|
|
89
|
-
return layoutSplitScreenStore.pipe(
|
|
90
|
-
map((splitScreen) => splitScreen[rootName][layoutName]),
|
|
91
|
-
distinctUntilChanged((prev, curr) => {
|
|
92
|
-
const filterChildren = (obj) => {
|
|
93
|
-
const { children, component, targetComponent, x, y, ...rest } = obj || {};
|
|
94
|
-
return rest;
|
|
95
|
-
};
|
|
96
|
-
return equal(filterChildren(prev), filterChildren(curr));
|
|
97
|
-
})
|
|
98
|
-
);
|
|
99
|
-
};
|
|
100
|
-
const flexContainerStore = new BehaviorSubject({});
|
|
101
|
-
const flexResizePanelStore = new BehaviorSubject({});
|
|
102
|
-
const setContainerRef = (layoutName, containerName, ref) => {
|
|
103
|
-
const currentRefs = flexContainerStore.getValue();
|
|
104
|
-
const updatedLayoutRefs = { ...currentRefs[layoutName] || {} };
|
|
105
|
-
if (ref === null) {
|
|
106
|
-
delete updatedLayoutRefs[containerName];
|
|
107
|
-
} else {
|
|
108
|
-
updatedLayoutRefs[containerName] = ref;
|
|
109
|
-
}
|
|
110
|
-
const newRefs = {
|
|
111
|
-
...currentRefs,
|
|
112
|
-
[layoutName]: updatedLayoutRefs
|
|
113
|
-
};
|
|
114
|
-
updateRefStore(flexContainerStore, newRefs);
|
|
115
|
-
};
|
|
116
|
-
const setResizePanelRef = (layoutName, containerName, ref) => {
|
|
117
|
-
const currentRefs = flexResizePanelStore.getValue();
|
|
118
|
-
const updatedLayoutRefs = { ...currentRefs[layoutName] || {} };
|
|
119
|
-
if (ref === null) {
|
|
120
|
-
delete updatedLayoutRefs[containerName];
|
|
121
|
-
} else {
|
|
122
|
-
updatedLayoutRefs[containerName] = ref;
|
|
123
|
-
}
|
|
124
|
-
const newRefs = {
|
|
125
|
-
...currentRefs,
|
|
126
|
-
[layoutName]: updatedLayoutRefs
|
|
127
|
-
};
|
|
128
|
-
updateRefStore(flexResizePanelStore, newRefs);
|
|
129
|
-
};
|
|
130
|
-
const getLayoutInfos = (layoutName) => {
|
|
131
|
-
return combineLatest([flexContainerStore, flexResizePanelStore]).pipe(
|
|
132
|
-
map(([containerRefs, resizePanelRefs]) => {
|
|
133
|
-
const containerData = containerRefs[layoutName] || {};
|
|
134
|
-
const resizePanelData = resizePanelRefs[layoutName] || {};
|
|
135
|
-
return {
|
|
136
|
-
container: containerData,
|
|
137
|
-
resizePanel: resizePanelData
|
|
138
|
-
};
|
|
139
|
-
}),
|
|
140
|
-
filter((result) => result.container !== null)
|
|
141
|
-
// 빈 객체 제외
|
|
142
|
-
);
|
|
143
|
-
};
|
|
144
|
-
const getContainerRef = ({
|
|
145
|
-
containerName,
|
|
146
|
-
layoutName
|
|
147
|
-
}) => {
|
|
148
|
-
return flexContainerStore.pipe(
|
|
149
|
-
map((refs) => {
|
|
150
|
-
if (layoutName) {
|
|
151
|
-
return refs[layoutName]?.[containerName] || null;
|
|
152
|
-
} else {
|
|
153
|
-
return Object.entries(refs).find(
|
|
154
|
-
([key, value]) => refs[key][containerName]
|
|
155
|
-
)?.[1][containerName];
|
|
156
|
-
}
|
|
157
|
-
}),
|
|
158
|
-
filter((ref) => ref !== null)
|
|
159
|
-
);
|
|
160
|
-
};
|
|
161
|
-
const getResizePanelRef = ({
|
|
162
|
-
containerName,
|
|
163
|
-
layoutName
|
|
164
|
-
}) => {
|
|
165
|
-
return flexResizePanelStore.pipe(
|
|
166
|
-
map((refs) => {
|
|
167
|
-
if (layoutName) {
|
|
168
|
-
return refs[layoutName]?.[containerName] || null;
|
|
169
|
-
} else {
|
|
170
|
-
return Object.entries(refs).find(
|
|
171
|
-
([key, value]) => refs[key][containerName]
|
|
172
|
-
)?.[1][containerName];
|
|
173
|
-
}
|
|
174
|
-
}),
|
|
175
|
-
filter((ref) => ref !== null)
|
|
176
|
-
);
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
export { flexContainerStore, flexResizePanelStore, getContainerRef, getCurrentSplitScreenComponents, getLayoutInfos, getResizePanelRef, getScrollPosition, getSplitScreen, layoutSplitScreenStore, removeScrollPosition, removeSplitScreenChild, resetRootSplitScreen, scrollPositions, setContainerRef, setResizePanelRef, setScrollPosition, setSplitScreen };
|
|
180
|
-
//# sourceMappingURL=FlexLayoutContainerStore.js.map
|
|
181
|
-
//# sourceMappingURL=FlexLayoutContainerStore.js.map
|
|
1
|
+
"use client";import C from"fast-deep-equal";import{BehaviorSubject as x,combineLatest as b}from"rxjs";import{distinctUntilChanged as T,filter as a,map as l}from"rxjs/operators";function y(t,e){const n=t.getValue();C(n,e)||t.next(e)}function R(t){s.next(t)}const m={},u=new x(m),v=(t,e)=>{const n=u.getValue(),r=n[t];if(r&&r.x===e.x&&r.y===e.y)return;const o={...n,[t]:e};y(u,o)},z=t=>u.pipe(a(e=>e[t]!==void 0),l(e=>e[t]),T((e,n)=>e?.x===n?.x&&e?.y===n?.y)),k=t=>{const e=u.getValue(),{[t]:n,...r}=e;y(u,r)},s=new x({}),E=(t,e,n)=>{const r=s.getValue(),o={...r[t]||{}};o[e]=n;const c={...r,[t]:o};R(c)},H=t=>{const n={...s.getValue(),[t]:{}};R(n)},M=t=>{const e=s.getValue();if(!e[t])return;const{[t]:n,...r}=e;R(r)},B=(t,e)=>{const n=s.getValue();if(!n[t])return;const r={...n[t]};delete r[e];const o={...n,[t]:r};R(o)},q=(t,e)=>{const n=s.getValue();if(n[t])return n[t][e]},I=(t,e)=>s.pipe(l(n=>n[t]?.[e]),T((n,r)=>{const o=c=>{const{children:i,component:S,targetComponent:d,x:f,y:V,...P}=c||{};return P};return C(o(n),o(r))})),p=new x({}),g=new x({}),U=(t,e,n)=>{const r=p.getValue(),o=r[t]||{};if(n===null){if(!(e in o))return;const{[e]:c,...i}=o,S=Object.keys(i).length===0?(()=>{const{[t]:d,...f}=r;return f})():{...r,[t]:i};p.next(S);return}o[e]!==n&&p.next({...r,[t]:{...o,[e]:n}})},A=(t,e,n)=>{const r=g.getValue(),o=r[t]||{};if(n===null){if(!(e in o))return;const{[e]:c,...i}=o,S=Object.keys(i).length===0?(()=>{const{[t]:d,...f}=r;return f})():{...r,[t]:i};g.next(S);return}o[e]!==n&&g.next({...r,[t]:{...o,[e]:n}})},F=t=>b([p,g]).pipe(l(([e,n])=>{const r=e[t]||{},o=n[t]||{};return{container:r,resizePanel:o}}),a(e=>e.container!==null&&Object.keys(e.container).length>0)),G=({containerName:t,layoutName:e})=>p.pipe(l(n=>e?n[e]?.[t]||null:Object.entries(n).find(([r,o])=>n[r][t])?.[1][t]),a(n=>n!==null)),J=({containerName:t,layoutName:e})=>g.pipe(l(n=>e?n[e]?.[t]||null:Object.entries(n).find(([r,o])=>n[r][t])?.[1][t]),a(n=>n!==null));export{p as flexContainerStore,g as flexResizePanelStore,G as getContainerRef,q as getCurrentSplitScreenComponents,F as getLayoutInfos,J as getResizePanelRef,z as getScrollPosition,I as getSplitScreen,s as layoutSplitScreenStore,M as removeRootSplitScreen,k as removeScrollPosition,B as removeSplitScreenChild,H as resetRootSplitScreen,m as scrollPositions,U as setContainerRef,A as setResizePanelRef,v as setScrollPosition,E as setSplitScreen};
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var FlexLayoutContainerStore = require('./FlexLayoutContainerStore');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.keys(FlexLayoutContainerStore).forEach(function (k) {
|
|
8
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () { return FlexLayoutContainerStore[k]; }
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
//# sourceMappingURL=index.cjs.map
|
|
14
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(r,o,f,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of c(o))!d.call(r,e)&&e!==f&&a(r,e,{get:()=>o[e],enumerable:!(x=b(o,e))||x.enumerable});return r},t=(r,o,f)=>(p(r,o,"default"),f&&p(f,o,"default"));var g=r=>p(a({},"__esModule",{value:!0}),r);var m={};module.exports=g(m);t(m,require("./FlexLayoutContainerStore"),module.exports);0&&(module.exports={...require("./FlexLayoutContainerStore")});
|