@byeolnaerim/flex-layout 0.0.2 → 0.0.3
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/index.cjs +2600 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +209 -78
- package/dist/index.d.ts +209 -78
- package/dist/index.js +2594 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4,12 +4,13 @@ var react = require('react');
|
|
|
4
4
|
var equal = require('fast-deep-equal');
|
|
5
5
|
var rxjs = require('rxjs');
|
|
6
6
|
var operators = require('rxjs/operators');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
8
|
|
|
8
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
10
|
|
|
10
11
|
var equal__default = /*#__PURE__*/_interopDefault(equal);
|
|
11
12
|
|
|
12
|
-
// src/flex-layout/
|
|
13
|
+
// src/flex-layout/components/FlexLayout.tsx
|
|
13
14
|
function updateScrollStore(subject, newValue) {
|
|
14
15
|
const currentValue = subject.getValue();
|
|
15
16
|
if (!equal__default.default(currentValue, newValue)) {
|
|
@@ -606,6 +607,451 @@ var useDoubleClick = (containerName, opt) => {
|
|
|
606
607
|
}, [containerName]);
|
|
607
608
|
return { isOpen, isDoubleClick, setIsDoubleClick };
|
|
608
609
|
};
|
|
610
|
+
|
|
611
|
+
// src/flex-layout/styles/FlexLayout.module.css
|
|
612
|
+
var FlexLayout_default = {};
|
|
613
|
+
var FlexLayoutContext = react.createContext(null);
|
|
614
|
+
function useFlexLayoutContext() {
|
|
615
|
+
const context = react.useContext(FlexLayoutContext);
|
|
616
|
+
if (!context) {
|
|
617
|
+
throw new Error(
|
|
618
|
+
"useFlexLayoutContext must be used within FlexLayoutContext.Provider"
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
return context;
|
|
622
|
+
}
|
|
623
|
+
function FlexLayoutProvider({
|
|
624
|
+
value,
|
|
625
|
+
children
|
|
626
|
+
}) {
|
|
627
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FlexLayoutContext.Provider, { value, children });
|
|
628
|
+
}
|
|
629
|
+
var FlexLayout = ({
|
|
630
|
+
layoutName,
|
|
631
|
+
direction,
|
|
632
|
+
children,
|
|
633
|
+
ref,
|
|
634
|
+
className,
|
|
635
|
+
panelClassName,
|
|
636
|
+
panelMovementMode = "divorce",
|
|
637
|
+
...props
|
|
638
|
+
}) => {
|
|
639
|
+
const containerCount = react.Children.count(children);
|
|
640
|
+
const fitContent = direction === "row" ? "width" : "height";
|
|
641
|
+
const isFragmentElement = (node) => react.isValidElement(node) && node.type === react.Fragment;
|
|
642
|
+
const nodes = react.Children.toArray(children).flatMap(
|
|
643
|
+
(node) => isFragmentElement(node) ? react.Children.toArray(node.props.children) : [node]
|
|
644
|
+
);
|
|
645
|
+
const flattenedChildren = nodes.filter(
|
|
646
|
+
react.isValidElement
|
|
647
|
+
);
|
|
648
|
+
if (flattenedChildren.length === 0) {
|
|
649
|
+
return null;
|
|
650
|
+
}
|
|
651
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
652
|
+
FlexLayoutProvider,
|
|
653
|
+
{
|
|
654
|
+
value: {
|
|
655
|
+
layoutName,
|
|
656
|
+
direction,
|
|
657
|
+
panelMovementMode,
|
|
658
|
+
panelClassName,
|
|
659
|
+
containerCount,
|
|
660
|
+
fitContent
|
|
661
|
+
},
|
|
662
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
663
|
+
"div",
|
|
664
|
+
{
|
|
665
|
+
className: `${FlexLayout_default["flex-layout"]} ${className && className !== "" ? className : ""}`,
|
|
666
|
+
...ref ? { ref } : {},
|
|
667
|
+
...props,
|
|
668
|
+
"data-layout_name": layoutName,
|
|
669
|
+
"data-direction": direction,
|
|
670
|
+
children: flattenedChildren.map((child, index) => {
|
|
671
|
+
if (!child || !react.isValidElement(child)) return null;
|
|
672
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
673
|
+
child,
|
|
674
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
675
|
+
ContainerOpenCloseProvider,
|
|
676
|
+
{
|
|
677
|
+
layoutName,
|
|
678
|
+
containerName: child.props.containerName,
|
|
679
|
+
sizeName: fitContent
|
|
680
|
+
}
|
|
681
|
+
)
|
|
682
|
+
] }, index);
|
|
683
|
+
})
|
|
684
|
+
}
|
|
685
|
+
)
|
|
686
|
+
}
|
|
687
|
+
) });
|
|
688
|
+
};
|
|
689
|
+
var FlexLayout_default2 = FlexLayout;
|
|
690
|
+
var useSize = (sizeName) => {
|
|
691
|
+
const ref = react.useRef(null);
|
|
692
|
+
const [size, setSize] = react.useState(void 0);
|
|
693
|
+
react.useLayoutEffect(() => {
|
|
694
|
+
if (!ref.current) return;
|
|
695
|
+
const handleResize = () => {
|
|
696
|
+
if (ref.current) {
|
|
697
|
+
const newSize = ref.current.getBoundingClientRect()[sizeName];
|
|
698
|
+
setSize(newSize);
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
handleResize();
|
|
702
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
703
|
+
handleResize();
|
|
704
|
+
});
|
|
705
|
+
resizeObserver.observe(ref.current);
|
|
706
|
+
window.addEventListener("resize", handleResize);
|
|
707
|
+
return () => {
|
|
708
|
+
resizeObserver.disconnect();
|
|
709
|
+
window.removeEventListener("resize", handleResize);
|
|
710
|
+
};
|
|
711
|
+
}, [sizeName]);
|
|
712
|
+
return { ref, size };
|
|
713
|
+
};
|
|
714
|
+
var flexDirectionModel = {
|
|
715
|
+
row: {
|
|
716
|
+
xy: "x",
|
|
717
|
+
targetDirection: "left",
|
|
718
|
+
nextDirection: "right",
|
|
719
|
+
sizeName: "width",
|
|
720
|
+
resizeCursor: "ew-resize"
|
|
721
|
+
},
|
|
722
|
+
column: {
|
|
723
|
+
xy: "y",
|
|
724
|
+
targetDirection: "top",
|
|
725
|
+
nextDirection: "bottom",
|
|
726
|
+
sizeName: "height",
|
|
727
|
+
resizeCursor: "ns-resize"
|
|
728
|
+
}
|
|
729
|
+
};
|
|
730
|
+
var FlexLayoutResizePanel = ({
|
|
731
|
+
direction,
|
|
732
|
+
containerCount,
|
|
733
|
+
panelMode = "default",
|
|
734
|
+
containerName,
|
|
735
|
+
layoutName,
|
|
736
|
+
panelClassName,
|
|
737
|
+
panelMovementMode
|
|
738
|
+
}) => {
|
|
739
|
+
let isResizePanelClickRef = react.useRef(false);
|
|
740
|
+
let prevTouchEvent = null;
|
|
741
|
+
let parentSizeRef = react.useRef(0);
|
|
742
|
+
let totalMovementRef = react.useRef(0);
|
|
743
|
+
const containerCountRef = react.useRef(containerCount);
|
|
744
|
+
react.useEffect(() => {
|
|
745
|
+
return () => {
|
|
746
|
+
document.body.style.cursor = "";
|
|
747
|
+
};
|
|
748
|
+
}, []);
|
|
749
|
+
react.useEffect(() => {
|
|
750
|
+
containerCountRef.current = containerCount;
|
|
751
|
+
}, [containerCount]);
|
|
752
|
+
const panelRef = react.useRef(null);
|
|
753
|
+
const panelMouseDownEvent = (event) => {
|
|
754
|
+
if (!panelRef.current || !panelRef.current.parentElement) return;
|
|
755
|
+
isResizePanelClickRef.current = true;
|
|
756
|
+
containerCountRef.current = [
|
|
757
|
+
...panelRef.current.parentElement.children
|
|
758
|
+
].filter((e) => e.hasAttribute("data-container_name")).length;
|
|
759
|
+
const sizeName = flexDirectionModel[direction].sizeName;
|
|
760
|
+
parentSizeRef.current = panelRef.current.parentElement.getBoundingClientRect()[sizeName];
|
|
761
|
+
prevTouchEvent = null;
|
|
762
|
+
totalMovementRef.current = 0;
|
|
763
|
+
if (!parentSizeRef.current) return;
|
|
764
|
+
document.body.style.cursor = flexDirectionModel[direction].resizeCursor;
|
|
765
|
+
};
|
|
766
|
+
const panelMouseUpEvent = () => {
|
|
767
|
+
isResizePanelClickRef.current = false;
|
|
768
|
+
parentSizeRef.current = 0;
|
|
769
|
+
prevTouchEvent = null;
|
|
770
|
+
totalMovementRef.current = 0;
|
|
771
|
+
document.body.style.cursor = "";
|
|
772
|
+
};
|
|
773
|
+
function moveMouseFlex(originTarget, resizePanel, moveEvent) {
|
|
774
|
+
const model = flexDirectionModel[direction];
|
|
775
|
+
const movement = moveEvent["movement" + model.xy.toUpperCase()];
|
|
776
|
+
totalMovementRef.current += movement;
|
|
777
|
+
const minSizeName = "min-" + model.sizeName;
|
|
778
|
+
const maxSizeName = "max-" + model.sizeName;
|
|
779
|
+
let targetElement = findNotCloseFlexContent(
|
|
780
|
+
originTarget,
|
|
781
|
+
"previousElementSibling"
|
|
782
|
+
);
|
|
783
|
+
if (panelMovementMode === "divorce" && totalMovementRef.current > 0 || panelMovementMode === "bulldozer" && movement > 0 || !targetElement)
|
|
784
|
+
targetElement = originTarget;
|
|
785
|
+
let nextElement = findNotCloseFlexContent(
|
|
786
|
+
resizePanel.nextElementSibling,
|
|
787
|
+
"nextElementSibling"
|
|
788
|
+
);
|
|
789
|
+
if (panelMovementMode === "divorce" && totalMovementRef.current < 0 || panelMovementMode === "bulldozer" && movement < 0 || !nextElement)
|
|
790
|
+
nextElement = resizePanel.nextElementSibling;
|
|
791
|
+
if (!targetElement || !nextElement) return;
|
|
792
|
+
const targetRect = targetElement.getBoundingClientRect();
|
|
793
|
+
const targetStyle = window.getComputedStyle(targetElement);
|
|
794
|
+
const targetMinSize = parseFloat(targetStyle.getPropertyValue(minSizeName)) || 0;
|
|
795
|
+
const targetMaxSize = parseFloat(targetStyle.getPropertyValue(maxSizeName)) || 0;
|
|
796
|
+
const nextRect = nextElement.getBoundingClientRect();
|
|
797
|
+
const nextStyle = window.getComputedStyle(nextElement);
|
|
798
|
+
const nextMinSize = parseFloat(nextStyle.getPropertyValue(minSizeName)) || 0;
|
|
799
|
+
const nextMaxSize = parseFloat(nextStyle.getPropertyValue(maxSizeName)) || 0;
|
|
800
|
+
let targetSize = targetRect[model.sizeName] + movement;
|
|
801
|
+
let nextElementSize = nextRect[model.sizeName] - movement;
|
|
802
|
+
if (targetMaxSize > 0 && targetSize > targetMaxSize) {
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
if (nextMaxSize > 0 && nextElementSize > nextMaxSize) {
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
if (isOverMove(targetSize, targetMinSize)) {
|
|
809
|
+
targetSize = 0;
|
|
810
|
+
nextElementSize = nextRect[model.sizeName];
|
|
811
|
+
} else if (isOverMove(nextElementSize, nextMinSize)) {
|
|
812
|
+
nextElementSize = 0;
|
|
813
|
+
targetSize = targetRect[model.sizeName];
|
|
814
|
+
}
|
|
815
|
+
const targetFlexGrow = targetSize / (parentSizeRef.current - 1) * containerCountRef.current;
|
|
816
|
+
const nextElementFlexGrow = nextElementSize / (parentSizeRef.current - 1) * containerCountRef.current;
|
|
817
|
+
targetElement.style.flex = `${targetFlexGrow} 1 0%`;
|
|
818
|
+
nextElement.style.flex = `${nextElementFlexGrow} 1 0%`;
|
|
819
|
+
}
|
|
820
|
+
react.useEffect(() => {
|
|
821
|
+
const addGlobalMoveEvent = (event) => {
|
|
822
|
+
if (!isResizePanelClickRef.current || !panelRef.current) {
|
|
823
|
+
return;
|
|
824
|
+
}
|
|
825
|
+
event.preventDefault();
|
|
826
|
+
const targetElement = panelRef.current.previousElementSibling;
|
|
827
|
+
const targetPanel = panelRef.current;
|
|
828
|
+
if (!targetElement || !targetPanel) return;
|
|
829
|
+
let move = { movementX: 0, movementY: 0 };
|
|
830
|
+
if (window.TouchEvent && event instanceof window.TouchEvent) {
|
|
831
|
+
if (!prevTouchEvent) {
|
|
832
|
+
prevTouchEvent = event;
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
move.movementX = (prevTouchEvent.touches[0].pageX - event.touches[0].pageX) * -2;
|
|
836
|
+
move.movementY = (prevTouchEvent.touches[0].pageY - event.touches[0].pageY) * -2;
|
|
837
|
+
prevTouchEvent = event;
|
|
838
|
+
} else {
|
|
839
|
+
move.movementX = event.movementX;
|
|
840
|
+
move.movementY = event.movementY;
|
|
841
|
+
}
|
|
842
|
+
moveMouseFlex(targetElement, targetPanel, move);
|
|
843
|
+
};
|
|
844
|
+
["mousemove", "touchmove"].forEach((eventName) => {
|
|
845
|
+
window.addEventListener(eventName, addGlobalMoveEvent, {
|
|
846
|
+
passive: false
|
|
847
|
+
});
|
|
848
|
+
});
|
|
849
|
+
["mouseup", "touchend"].forEach((eventName) => {
|
|
850
|
+
window.addEventListener(eventName, panelMouseUpEvent);
|
|
851
|
+
});
|
|
852
|
+
return () => {
|
|
853
|
+
["mousemove", "touchmove"].forEach((eventName) => {
|
|
854
|
+
window.removeEventListener(eventName, addGlobalMoveEvent);
|
|
855
|
+
});
|
|
856
|
+
["mouseup", "touchend"].forEach((eventName) => {
|
|
857
|
+
window.removeEventListener(eventName, panelMouseUpEvent);
|
|
858
|
+
});
|
|
859
|
+
};
|
|
860
|
+
}, []);
|
|
861
|
+
react.useEffect(() => {
|
|
862
|
+
if (!panelRef.current) return;
|
|
863
|
+
setResizePanelRef(layoutName, containerName, panelRef);
|
|
864
|
+
}, [containerName, layoutName]);
|
|
865
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
866
|
+
"div",
|
|
867
|
+
{
|
|
868
|
+
id: containerName + "_resize_panel",
|
|
869
|
+
className: `${FlexLayout_default["flex-resize-panel"]} ${FlexLayout_default[panelMode]} ${panelClassName && panelClassName !== "" ? panelClassName : ""}`,
|
|
870
|
+
ref: panelRef,
|
|
871
|
+
onMouseDown: panelMouseDownEvent,
|
|
872
|
+
onTouchStart: panelMouseDownEvent,
|
|
873
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: FlexLayout_default.hover })
|
|
874
|
+
}
|
|
875
|
+
);
|
|
876
|
+
};
|
|
877
|
+
var FlexLayoutResizePanel_default = FlexLayoutResizePanel;
|
|
878
|
+
var FlexLayoutContainer = ({
|
|
879
|
+
isFitContent,
|
|
880
|
+
isFitResize,
|
|
881
|
+
// fitContent,
|
|
882
|
+
// containerCount,
|
|
883
|
+
// layoutName,
|
|
884
|
+
containerName,
|
|
885
|
+
grow: initialGrow,
|
|
886
|
+
prevGrow: initialPrevGrow,
|
|
887
|
+
isInitialResizable,
|
|
888
|
+
isResizePanel,
|
|
889
|
+
children,
|
|
890
|
+
className,
|
|
891
|
+
panelMode
|
|
892
|
+
}) => {
|
|
893
|
+
const {
|
|
894
|
+
direction,
|
|
895
|
+
panelMovementMode,
|
|
896
|
+
panelClassName,
|
|
897
|
+
layoutName,
|
|
898
|
+
fitContent,
|
|
899
|
+
containerCount
|
|
900
|
+
} = useFlexLayoutContext();
|
|
901
|
+
const { ref, size } = (
|
|
902
|
+
// isFitContent && fitContent
|
|
903
|
+
//?
|
|
904
|
+
useSize(fitContent)
|
|
905
|
+
);
|
|
906
|
+
const flexContainerNodeRef = react.useRef(null);
|
|
907
|
+
const flexContainerRef = react.useCallback(
|
|
908
|
+
(node) => {
|
|
909
|
+
flexContainerNodeRef.current = node;
|
|
910
|
+
if (node !== null) {
|
|
911
|
+
setContainerRef(layoutName, containerName, { current: node });
|
|
912
|
+
}
|
|
913
|
+
},
|
|
914
|
+
[layoutName, containerName]
|
|
915
|
+
);
|
|
916
|
+
const [growState, setGrowState] = react.useState(initialGrow);
|
|
917
|
+
react.useEffect(() => {
|
|
918
|
+
setGrowState(initialGrow);
|
|
919
|
+
}, [initialGrow]);
|
|
920
|
+
const [prevGrowState, setPrevGrowState] = react.useState(
|
|
921
|
+
initialPrevGrow
|
|
922
|
+
);
|
|
923
|
+
const [isFirstLoad, setIsFirstLoad] = react.useState(true);
|
|
924
|
+
react.useEffect(() => {
|
|
925
|
+
if (!flexContainerNodeRef.current) return;
|
|
926
|
+
setContainerRef(layoutName, containerName, flexContainerNodeRef);
|
|
927
|
+
return () => {
|
|
928
|
+
setContainerRef(layoutName, containerName, {
|
|
929
|
+
current: null
|
|
930
|
+
});
|
|
931
|
+
};
|
|
932
|
+
}, [containerName, layoutName]);
|
|
933
|
+
react.useEffect(() => {
|
|
934
|
+
if (typeof window == "undefined" || flexContainerNodeRef.current === null)
|
|
935
|
+
return;
|
|
936
|
+
const storedGrow = sessionStorage.getItem(containerName);
|
|
937
|
+
if (storedGrow !== null) {
|
|
938
|
+
const parsed = parseFloat(storedGrow);
|
|
939
|
+
if (!isNaN(parsed)) {
|
|
940
|
+
flexContainerNodeRef.current.style.flex = `${parsed} 1 0%`;
|
|
941
|
+
setGrowState(parsed);
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
}, [containerName]);
|
|
945
|
+
react.useEffect(() => {
|
|
946
|
+
if (!flexContainerNodeRef.current) return;
|
|
947
|
+
const targetNode = flexContainerNodeRef.current;
|
|
948
|
+
const observer = new MutationObserver((mutations) => {
|
|
949
|
+
for (const mutation of mutations) {
|
|
950
|
+
if (mutation.type === "attributes" && mutation.attributeName === "style" && targetNode.style.flex) {
|
|
951
|
+
const flexValue = targetNode.style.flex;
|
|
952
|
+
const parsedGrow = parseFloat(flexValue.split(" ")[0]);
|
|
953
|
+
if (!isNaN(parsedGrow)) {
|
|
954
|
+
setGrowState(parsedGrow);
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
});
|
|
959
|
+
observer.observe(targetNode, {
|
|
960
|
+
attributes: true,
|
|
961
|
+
attributeFilter: ["style"],
|
|
962
|
+
attributeOldValue: true
|
|
963
|
+
});
|
|
964
|
+
return () => {
|
|
965
|
+
observer.disconnect();
|
|
966
|
+
};
|
|
967
|
+
}, [containerName]);
|
|
968
|
+
react.useEffect(() => {
|
|
969
|
+
if (!flexContainerNodeRef.current || !ref || !ref.current || !size || !fitContent)
|
|
970
|
+
return;
|
|
971
|
+
requestAnimationFrame(() => {
|
|
972
|
+
if (!flexContainerNodeRef.current) return;
|
|
973
|
+
const sizeName = `${fitContent.charAt(0).toUpperCase() + fitContent.substring(1)}`;
|
|
974
|
+
const parentSize = flexContainerNodeRef.current.parentElement && flexContainerNodeRef.current.parentElement["client" + sizeName] || 0;
|
|
975
|
+
if (isFitContent) {
|
|
976
|
+
flexContainerNodeRef.current.style["max" + sizeName] = size + "px";
|
|
977
|
+
}
|
|
978
|
+
if (!isFitResize && isFirstLoad) {
|
|
979
|
+
setIsFirstLoad(false);
|
|
980
|
+
return;
|
|
981
|
+
}
|
|
982
|
+
if (getGrow(flexContainerNodeRef.current) != 0 && isFitResize) {
|
|
983
|
+
const newGrow = mathGrow(size, parentSize, containerCount);
|
|
984
|
+
setPrevGrowState(growState);
|
|
985
|
+
setGrowState(newGrow);
|
|
986
|
+
}
|
|
987
|
+
});
|
|
988
|
+
}, [size, containerCount, isFitResize, children]);
|
|
989
|
+
react.useEffect(() => {
|
|
990
|
+
if (!flexContainerNodeRef.current) return;
|
|
991
|
+
let notGrowList = [];
|
|
992
|
+
let containerList = [
|
|
993
|
+
...flexContainerNodeRef.current.parentElement?.children || []
|
|
994
|
+
].filter((e) => e.hasAttribute("data-container_name"));
|
|
995
|
+
let remainingGrow = containerList.reduce((t, e, i) => {
|
|
996
|
+
let item = e;
|
|
997
|
+
if (item.classList.contains(FlexLayout_default["flex-resize-panel"])) return t;
|
|
998
|
+
if (e.hasAttribute("data-grow") == false || e.getAttribute("data-is_resize") === "true") {
|
|
999
|
+
notGrowList.push(item);
|
|
1000
|
+
return t;
|
|
1001
|
+
}
|
|
1002
|
+
let grow = parseFloat(item.dataset.grow || "");
|
|
1003
|
+
item.style.flex = `${grow} 1 0%`;
|
|
1004
|
+
t -= grow;
|
|
1005
|
+
return t;
|
|
1006
|
+
}, containerList.length);
|
|
1007
|
+
if (notGrowList.length != 0) {
|
|
1008
|
+
let resizeWeight = mathWeight(notGrowList.length, remainingGrow);
|
|
1009
|
+
notGrowList.forEach((e) => {
|
|
1010
|
+
e.dataset.grow = resizeWeight.toString();
|
|
1011
|
+
e.style.flex = `${resizeWeight} 1 0%`;
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
}, []);
|
|
1015
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1016
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1017
|
+
"div",
|
|
1018
|
+
{
|
|
1019
|
+
id: containerName,
|
|
1020
|
+
"data-container_name": containerName,
|
|
1021
|
+
ref: flexContainerRef,
|
|
1022
|
+
className: `${FlexLayout_default["flex-container"]} ${className && className !== "" ? className : ""}`,
|
|
1023
|
+
...growState !== void 0 ? { ["data-grow"]: growState } : {},
|
|
1024
|
+
...prevGrowState != void 0 ? { ["data-prev_grow"]: prevGrowState } : {},
|
|
1025
|
+
"data-is_resize": isInitialResizable,
|
|
1026
|
+
"data-is_resize_panel": isResizePanel,
|
|
1027
|
+
style: growState !== void 0 && {
|
|
1028
|
+
flex: `${growState} 1 0%`
|
|
1029
|
+
} || {},
|
|
1030
|
+
children: isFitContent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1031
|
+
"div",
|
|
1032
|
+
{
|
|
1033
|
+
className: `${FlexLayout_default["flex-content-fit-wrapper"]}`,
|
|
1034
|
+
ref,
|
|
1035
|
+
children
|
|
1036
|
+
}
|
|
1037
|
+
) || children
|
|
1038
|
+
}
|
|
1039
|
+
),
|
|
1040
|
+
isResizePanel && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1041
|
+
FlexLayoutResizePanel_default,
|
|
1042
|
+
{
|
|
1043
|
+
containerName,
|
|
1044
|
+
layoutName,
|
|
1045
|
+
direction,
|
|
1046
|
+
containerCount,
|
|
1047
|
+
panelMode,
|
|
1048
|
+
panelClassName,
|
|
1049
|
+
panelMovementMode
|
|
1050
|
+
}
|
|
1051
|
+
)
|
|
1052
|
+
] });
|
|
1053
|
+
};
|
|
1054
|
+
var FlexLayoutContainer_default = FlexLayoutContainer;
|
|
609
1055
|
var dragState = new rxjs.Subject();
|
|
610
1056
|
var filterChildren = (obj) => {
|
|
611
1057
|
const { children, ...rest } = obj || {};
|
|
@@ -816,8 +1262,2158 @@ var useFolderEvent = () => {
|
|
|
816
1262
|
}, []);
|
|
817
1263
|
return { folderEvent };
|
|
818
1264
|
};
|
|
1265
|
+
function useFlexLayoutSplitScreen({
|
|
1266
|
+
isSplitInitial = false,
|
|
1267
|
+
parentDirection,
|
|
1268
|
+
directionInitial = "row",
|
|
1269
|
+
selfContainerName,
|
|
1270
|
+
parentLayoutName,
|
|
1271
|
+
layoutName
|
|
1272
|
+
}) {
|
|
1273
|
+
const [direction, setDirection] = react.useState(
|
|
1274
|
+
directionInitial
|
|
1275
|
+
);
|
|
1276
|
+
const [isSplit, setIsSplit] = react.useState(isSplitInitial);
|
|
1277
|
+
const [boundaryContainerSize, setBoundaryContainerSize] = react.useState(null);
|
|
1278
|
+
const [centerDropTargetComponent, setCenterDropTargetComponent] = react.useState([]);
|
|
1279
|
+
const [afterDropTargetComponent, setAfterDropTargetComponent] = react.useState([]);
|
|
1280
|
+
const [beforeDropTargetComponent, setBeforeDropTargetComponent] = react.useState([]);
|
|
1281
|
+
const layoutRef = react.useRef(null);
|
|
1282
|
+
const dragState2 = useDragCapture(layoutRef);
|
|
1283
|
+
react.useEffect(() => {
|
|
1284
|
+
if (!dragState2) {
|
|
1285
|
+
setBoundaryContainerSize(null);
|
|
1286
|
+
return;
|
|
1287
|
+
}
|
|
1288
|
+
const {
|
|
1289
|
+
isDrop,
|
|
1290
|
+
isDragging,
|
|
1291
|
+
positionName,
|
|
1292
|
+
containerName,
|
|
1293
|
+
children: dropComponent,
|
|
1294
|
+
isOver,
|
|
1295
|
+
navigationTitle,
|
|
1296
|
+
dropEndCallback,
|
|
1297
|
+
x,
|
|
1298
|
+
y,
|
|
1299
|
+
screenKey
|
|
1300
|
+
} = dragState2;
|
|
1301
|
+
const orderName = positionName === "leftBoundary" || positionName === "topBoundary" ? "before" : positionName === "rightBoundary" || positionName === "bottomBoundary" ? "after" : "center";
|
|
1302
|
+
if ((isOver || isDrop) && boundaryContainerSize) {
|
|
1303
|
+
setBoundaryContainerSize(null);
|
|
1304
|
+
}
|
|
1305
|
+
if (selfContainerName.startsWith(containerName)) {
|
|
1306
|
+
return;
|
|
1307
|
+
}
|
|
1308
|
+
if (isDrop && screenKey) {
|
|
1309
|
+
const dropDirection = positionName === "leftBoundary" || positionName === "rightBoundary" ? "row" : "column";
|
|
1310
|
+
if (!isSplit && !isOver) {
|
|
1311
|
+
if (positionName !== "centerBoundary" && dropDirection !== parentDirection) {
|
|
1312
|
+
setIsSplit(true);
|
|
1313
|
+
setDirection(dropDirection);
|
|
1314
|
+
}
|
|
1315
|
+
dropMovementEventSubject.next({
|
|
1316
|
+
state: "append",
|
|
1317
|
+
targetContainerName: containerName,
|
|
1318
|
+
targetParentLayoutName: parentLayoutName,
|
|
1319
|
+
targetLayoutName: layoutName,
|
|
1320
|
+
targetComponent: dropComponent,
|
|
1321
|
+
orderName,
|
|
1322
|
+
x,
|
|
1323
|
+
y,
|
|
1324
|
+
dropEndCallback,
|
|
1325
|
+
dropTargetComponentEvent: {
|
|
1326
|
+
navigationTitle,
|
|
1327
|
+
dropDocumentOutsideOption: dragState2?.dropDocumentOutsideOption,
|
|
1328
|
+
direction: dropDirection,
|
|
1329
|
+
screenKey
|
|
1330
|
+
}
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
if (isDragging && !isSplit && !isOver) {
|
|
1335
|
+
const newSize = {
|
|
1336
|
+
left: positionName === "rightBoundary" ? "50%" : "0",
|
|
1337
|
+
top: positionName === "bottomBoundary" ? "50%" : "0",
|
|
1338
|
+
width: positionName === "leftBoundary" || positionName === "rightBoundary" ? "50%" : "100%",
|
|
1339
|
+
height: positionName === "topBoundary" || positionName === "bottomBoundary" ? "50%" : "100%"
|
|
1340
|
+
};
|
|
1341
|
+
if (JSON.stringify(boundaryContainerSize) !== JSON.stringify(newSize)) {
|
|
1342
|
+
setBoundaryContainerSize(newSize);
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
}, [
|
|
1346
|
+
dragState2,
|
|
1347
|
+
isSplit,
|
|
1348
|
+
boundaryContainerSize,
|
|
1349
|
+
parentLayoutName,
|
|
1350
|
+
layoutName,
|
|
1351
|
+
selfContainerName,
|
|
1352
|
+
direction
|
|
1353
|
+
]);
|
|
1354
|
+
return {
|
|
1355
|
+
direction,
|
|
1356
|
+
setDirection,
|
|
1357
|
+
isSplit,
|
|
1358
|
+
setIsSplit,
|
|
1359
|
+
boundaryContainerSize,
|
|
1360
|
+
//setBoundaryContainerSize,
|
|
1361
|
+
centerDropTargetComponent,
|
|
1362
|
+
afterDropTargetComponent,
|
|
1363
|
+
beforeDropTargetComponent,
|
|
1364
|
+
setAfterDropTargetComponent,
|
|
1365
|
+
setBeforeDropTargetComponent,
|
|
1366
|
+
setCenterDropTargetComponent,
|
|
1367
|
+
//dropTargetComponent,
|
|
1368
|
+
//setDropTargetComponent,
|
|
1369
|
+
//setDropPosition,
|
|
1370
|
+
isOver: dragState2?.isOver,
|
|
1371
|
+
layoutRef
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
var MAX_STEP = 18;
|
|
1375
|
+
function edgeVelocity(x, y) {
|
|
1376
|
+
const w = window.innerWidth, h = window.innerHeight;
|
|
1377
|
+
const mx = w * 0.15, my = h * 0.15;
|
|
1378
|
+
let vx = 0;
|
|
1379
|
+
if (x < mx)
|
|
1380
|
+
vx = -((mx - x) / mx) * MAX_STEP;
|
|
1381
|
+
else if (x > w - mx)
|
|
1382
|
+
vx = (x - (w - mx)) / mx * MAX_STEP;
|
|
1383
|
+
let vy = 0;
|
|
1384
|
+
if (y < my)
|
|
1385
|
+
vy = -((my - y) / my) * MAX_STEP;
|
|
1386
|
+
else if (y > h - my)
|
|
1387
|
+
vy = (y - (h - my)) / my * MAX_STEP;
|
|
1388
|
+
return { vx, vy };
|
|
1389
|
+
}
|
|
1390
|
+
function FlexLayoutSplitScreenDragBox({
|
|
1391
|
+
onMouseDown,
|
|
1392
|
+
onTouchStart,
|
|
1393
|
+
dropEndCallback,
|
|
1394
|
+
style,
|
|
1395
|
+
navigationTitle,
|
|
1396
|
+
targetComponent,
|
|
1397
|
+
containerName,
|
|
1398
|
+
children,
|
|
1399
|
+
className,
|
|
1400
|
+
dropDocumentOutsideOption,
|
|
1401
|
+
screenKey = Array.from(
|
|
1402
|
+
window.crypto.getRandomValues(new Uint32Array(16)),
|
|
1403
|
+
(e) => e.toString(32).padStart(2, "0")
|
|
1404
|
+
).join(""),
|
|
1405
|
+
isBlockingActiveInput = false,
|
|
1406
|
+
customData = {},
|
|
1407
|
+
scrollTargetRef,
|
|
1408
|
+
...props
|
|
1409
|
+
}) {
|
|
1410
|
+
const scrollRAF = react.useRef(null);
|
|
1411
|
+
const velocity = react.useRef({ vx: 0, vy: 0 });
|
|
1412
|
+
const ref = react.useRef(null);
|
|
1413
|
+
const clonedNodeRef = react.useRef(null);
|
|
1414
|
+
const clonedWidth = react.useRef(null);
|
|
1415
|
+
const clonedHeight = react.useRef(null);
|
|
1416
|
+
const hrefUrlRef = react.useRef("");
|
|
1417
|
+
const { handleStart, handleMove, handleEnd } = useDragEvents({
|
|
1418
|
+
isBlockingActiveInput
|
|
1419
|
+
});
|
|
1420
|
+
const handleMoveWrapper = (event) => {
|
|
1421
|
+
let x = 0;
|
|
1422
|
+
let y = 0;
|
|
1423
|
+
if (event.type === "touchmove") {
|
|
1424
|
+
const t = event.touches[0];
|
|
1425
|
+
x = t.clientX;
|
|
1426
|
+
y = t.clientY;
|
|
1427
|
+
} else {
|
|
1428
|
+
const m = event;
|
|
1429
|
+
x = m.clientX;
|
|
1430
|
+
y = m.clientY;
|
|
1431
|
+
}
|
|
1432
|
+
const { vx, vy } = edgeVelocity(x, y);
|
|
1433
|
+
const inEdge = vx !== 0 || vy !== 0;
|
|
1434
|
+
if (clonedNodeRef.current?.isConnected && !inEdge) {
|
|
1435
|
+
event.preventDefault();
|
|
1436
|
+
if (scrollRAF.current) {
|
|
1437
|
+
cancelAnimationFrame(scrollRAF.current);
|
|
1438
|
+
scrollRAF.current = null;
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
if (clonedNodeRef.current?.isConnected && inEdge) {
|
|
1442
|
+
event.preventDefault();
|
|
1443
|
+
velocity.current = { vx, vy };
|
|
1444
|
+
if (!scrollRAF.current) {
|
|
1445
|
+
const step = () => {
|
|
1446
|
+
scrollTargetRef?.current?.scrollBy(
|
|
1447
|
+
velocity.current.vx,
|
|
1448
|
+
velocity.current.vy
|
|
1449
|
+
);
|
|
1450
|
+
if (velocity.current.vx === 0 && velocity.current.vy === 0) {
|
|
1451
|
+
scrollRAF.current = null;
|
|
1452
|
+
return;
|
|
1453
|
+
}
|
|
1454
|
+
scrollRAF.current = requestAnimationFrame(step);
|
|
1455
|
+
};
|
|
1456
|
+
scrollRAF.current = requestAnimationFrame(step);
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
if (event.type !== "touchmove") {
|
|
1460
|
+
event.preventDefault();
|
|
1461
|
+
}
|
|
1462
|
+
handleMove({
|
|
1463
|
+
event,
|
|
1464
|
+
notDragCallback: ({ x: x2, y: y2 }) => {
|
|
1465
|
+
if (clonedNodeRef.current) clonedNodeRef.current.remove();
|
|
1466
|
+
},
|
|
1467
|
+
dragStartCallback: ({ x: x2, y: y2 }) => {
|
|
1468
|
+
if (!clonedNodeRef.current) return;
|
|
1469
|
+
navigator.vibrate(100);
|
|
1470
|
+
clonedNodeRef.current.style.left = `${x2 - (clonedWidth.current || 0) / 2}px`;
|
|
1471
|
+
clonedNodeRef.current.style.top = `${y2 - (clonedHeight.current || 0) / 2}px`;
|
|
1472
|
+
},
|
|
1473
|
+
moveingCallback: ({ x: x2, y: y2 }) => {
|
|
1474
|
+
if (clonedNodeRef.current?.isConnected) {
|
|
1475
|
+
clonedNodeRef.current.style.left = `${x2 - (clonedWidth.current || 0) / 2}px`;
|
|
1476
|
+
clonedNodeRef.current.style.top = `${y2 - (clonedHeight.current || 0) / 2}px`;
|
|
1477
|
+
}
|
|
1478
|
+
dragState.next({
|
|
1479
|
+
isDragging: true,
|
|
1480
|
+
isDrop: false,
|
|
1481
|
+
navigationTitle,
|
|
1482
|
+
children: targetComponent,
|
|
1483
|
+
x: x2,
|
|
1484
|
+
y: y2,
|
|
1485
|
+
containerName,
|
|
1486
|
+
dropDocumentOutsideOption,
|
|
1487
|
+
customData
|
|
1488
|
+
});
|
|
1489
|
+
}
|
|
1490
|
+
});
|
|
1491
|
+
};
|
|
1492
|
+
const handleEndWrapper = (event) => {
|
|
1493
|
+
if (scrollRAF.current !== null) {
|
|
1494
|
+
cancelAnimationFrame(scrollRAF.current);
|
|
1495
|
+
scrollRAF.current = null;
|
|
1496
|
+
}
|
|
1497
|
+
velocity.current = { vx: 0, vy: 0 };
|
|
1498
|
+
handleEnd({
|
|
1499
|
+
event,
|
|
1500
|
+
dragEndCallback: ({ x, y }) => {
|
|
1501
|
+
const href = hrefUrlRef.current;
|
|
1502
|
+
if (clonedNodeRef.current) clonedNodeRef.current.remove();
|
|
1503
|
+
if (dropDocumentOutsideOption && isDocumentOut({ x, y })) {
|
|
1504
|
+
if (dropDocumentOutsideOption.isNewTap || !dropDocumentOutsideOption.widthRatio && !dropDocumentOutsideOption.heightRatio) {
|
|
1505
|
+
window.open(href, "_blank");
|
|
1506
|
+
} else {
|
|
1507
|
+
const width = window.innerWidth * (dropDocumentOutsideOption.widthRatio || 1);
|
|
1508
|
+
const height = window.innerHeight * (dropDocumentOutsideOption.heightRatio || 1);
|
|
1509
|
+
window.open(
|
|
1510
|
+
href,
|
|
1511
|
+
"_blank",
|
|
1512
|
+
`width=${width},height=${height},left=${window.screenLeft - x * -1 - width},top=${window.screenTop + y}`
|
|
1513
|
+
);
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
dragState.next({
|
|
1517
|
+
isDragging: false,
|
|
1518
|
+
isDrop: true,
|
|
1519
|
+
navigationTitle,
|
|
1520
|
+
children: targetComponent,
|
|
1521
|
+
x,
|
|
1522
|
+
y,
|
|
1523
|
+
containerName,
|
|
1524
|
+
dropDocumentOutsideOption,
|
|
1525
|
+
dropEndCallback,
|
|
1526
|
+
screenKey,
|
|
1527
|
+
customData
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
});
|
|
1531
|
+
};
|
|
1532
|
+
react.useEffect(() => {
|
|
1533
|
+
if (ref.current) {
|
|
1534
|
+
const clone = ref.current.cloneNode(true);
|
|
1535
|
+
const originRect = ref.current.getBoundingClientRect();
|
|
1536
|
+
clone.style.width = originRect.width + "px";
|
|
1537
|
+
clone.style.height = originRect.height + "px";
|
|
1538
|
+
clone.style.opacity = "0.3";
|
|
1539
|
+
clone.style.backdropFilter = "blur(6px)";
|
|
1540
|
+
clonedWidth.current = originRect.width;
|
|
1541
|
+
clonedHeight.current = originRect.height;
|
|
1542
|
+
if (dropDocumentOutsideOption?.openUrl) {
|
|
1543
|
+
hrefUrlRef.current = dropDocumentOutsideOption.openUrl;
|
|
1544
|
+
const href = document.createElement("span");
|
|
1545
|
+
href.textContent = hrefUrlRef.current;
|
|
1546
|
+
clone.prepend(href);
|
|
1547
|
+
}
|
|
1548
|
+
if (navigationTitle) {
|
|
1549
|
+
const title = document.createElement("span");
|
|
1550
|
+
title.textContent = navigationTitle;
|
|
1551
|
+
clone.prepend(title);
|
|
1552
|
+
}
|
|
1553
|
+
clone.style.position = "fixed";
|
|
1554
|
+
clonedNodeRef.current = clone;
|
|
1555
|
+
clonedNodeRef.current.classList.add(
|
|
1556
|
+
FlexLayout_default["flex-split-screen-drag-box-clone"]
|
|
1557
|
+
);
|
|
1558
|
+
}
|
|
1559
|
+
}, []);
|
|
1560
|
+
react.useEffect(() => {
|
|
1561
|
+
const moveEvents = [
|
|
1562
|
+
"mousemove",
|
|
1563
|
+
"touchmove"
|
|
1564
|
+
];
|
|
1565
|
+
const endEvents = ["mouseup", "touchend"];
|
|
1566
|
+
moveEvents.forEach((eventName) => {
|
|
1567
|
+
window.addEventListener(eventName, handleMoveWrapper, {
|
|
1568
|
+
passive: false
|
|
1569
|
+
});
|
|
1570
|
+
});
|
|
1571
|
+
endEvents.forEach((eventName) => {
|
|
1572
|
+
window.addEventListener(eventName, handleEndWrapper);
|
|
1573
|
+
});
|
|
1574
|
+
return () => {
|
|
1575
|
+
moveEvents.forEach((eventName) => {
|
|
1576
|
+
window.removeEventListener(eventName, handleMoveWrapper);
|
|
1577
|
+
});
|
|
1578
|
+
endEvents.forEach((eventName) => {
|
|
1579
|
+
window.removeEventListener(eventName, handleEndWrapper);
|
|
1580
|
+
});
|
|
1581
|
+
};
|
|
1582
|
+
}, [
|
|
1583
|
+
customData,
|
|
1584
|
+
targetComponent,
|
|
1585
|
+
dropDocumentOutsideOption,
|
|
1586
|
+
screenKey,
|
|
1587
|
+
isBlockingActiveInput,
|
|
1588
|
+
containerName,
|
|
1589
|
+
navigationTitle,
|
|
1590
|
+
dropEndCallback
|
|
1591
|
+
]);
|
|
1592
|
+
react.useEffect(() => {
|
|
1593
|
+
const el = ref.current;
|
|
1594
|
+
if (!el) return;
|
|
1595
|
+
const onCtx = (e) => e.preventDefault();
|
|
1596
|
+
el.addEventListener("contextmenu", onCtx);
|
|
1597
|
+
return () => {
|
|
1598
|
+
el.removeEventListener("contextmenu", onCtx);
|
|
1599
|
+
};
|
|
1600
|
+
}, []);
|
|
1601
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1602
|
+
"div",
|
|
1603
|
+
{
|
|
1604
|
+
className: `${className || ""} ${FlexLayout_default["flex-split-screen-drag-box"]}`,
|
|
1605
|
+
ref,
|
|
1606
|
+
onContextMenu: (e) => e.preventDefault(),
|
|
1607
|
+
onMouseDown: (ev) => {
|
|
1608
|
+
if (onMouseDown) {
|
|
1609
|
+
Promise.resolve().then(() => onMouseDown(ev));
|
|
1610
|
+
}
|
|
1611
|
+
handleStart({
|
|
1612
|
+
event: ev,
|
|
1613
|
+
dragStartCallback: ({ x, y }) => {
|
|
1614
|
+
if (clonedNodeRef.current) {
|
|
1615
|
+
document.body.appendChild(
|
|
1616
|
+
clonedNodeRef.current
|
|
1617
|
+
);
|
|
1618
|
+
if (ref.current) {
|
|
1619
|
+
const originRect = ref.current.getBoundingClientRect();
|
|
1620
|
+
clonedNodeRef.current.style.width = originRect.width + "px";
|
|
1621
|
+
clonedNodeRef.current.style.height = originRect.height + "px";
|
|
1622
|
+
clonedWidth.current = originRect.width;
|
|
1623
|
+
clonedHeight.current = originRect.height;
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
if (clonedNodeRef.current?.isConnected) {
|
|
1627
|
+
navigator.vibrate(100);
|
|
1628
|
+
clonedNodeRef.current.style.left = `${x - (clonedWidth.current || 0) / 2}px`;
|
|
1629
|
+
clonedNodeRef.current.style.top = `${y - (clonedHeight.current || 0) / 2}px`;
|
|
1630
|
+
}
|
|
1631
|
+
dragState.next({
|
|
1632
|
+
isDragging: true,
|
|
1633
|
+
isDrop: false,
|
|
1634
|
+
navigationTitle,
|
|
1635
|
+
children: targetComponent,
|
|
1636
|
+
x,
|
|
1637
|
+
y,
|
|
1638
|
+
containerName,
|
|
1639
|
+
dropDocumentOutsideOption,
|
|
1640
|
+
customData
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
});
|
|
1644
|
+
},
|
|
1645
|
+
onTouchStart: (ev) => {
|
|
1646
|
+
if (onTouchStart) {
|
|
1647
|
+
Promise.resolve().then(() => onTouchStart(ev));
|
|
1648
|
+
}
|
|
1649
|
+
handleStart({
|
|
1650
|
+
event: ev,
|
|
1651
|
+
dragStartCallback: ({ x, y }) => {
|
|
1652
|
+
if (clonedNodeRef.current) {
|
|
1653
|
+
document.body.appendChild(
|
|
1654
|
+
clonedNodeRef.current
|
|
1655
|
+
);
|
|
1656
|
+
if (ref.current) {
|
|
1657
|
+
const originRect = ref.current.getBoundingClientRect();
|
|
1658
|
+
clonedNodeRef.current.style.width = originRect.width + "px";
|
|
1659
|
+
clonedNodeRef.current.style.height = originRect.height + "px";
|
|
1660
|
+
clonedWidth.current = originRect.width;
|
|
1661
|
+
clonedHeight.current = originRect.height;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
if (clonedNodeRef.current?.isConnected) {
|
|
1665
|
+
navigator.vibrate(100);
|
|
1666
|
+
clonedNodeRef.current.style.left = `${x - (clonedWidth.current || 0) / 2}px`;
|
|
1667
|
+
clonedNodeRef.current.style.top = `${y - (clonedHeight.current || 0) / 2}px`;
|
|
1668
|
+
}
|
|
1669
|
+
dragState.next({
|
|
1670
|
+
isDragging: true,
|
|
1671
|
+
isDrop: false,
|
|
1672
|
+
navigationTitle,
|
|
1673
|
+
children: targetComponent,
|
|
1674
|
+
x,
|
|
1675
|
+
y,
|
|
1676
|
+
containerName,
|
|
1677
|
+
dropDocumentOutsideOption,
|
|
1678
|
+
customData
|
|
1679
|
+
});
|
|
1680
|
+
}
|
|
1681
|
+
});
|
|
1682
|
+
},
|
|
1683
|
+
style: { ...style },
|
|
1684
|
+
...props,
|
|
1685
|
+
children
|
|
1686
|
+
}
|
|
1687
|
+
) });
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
// src/flex-layout/styles/listScroll.module.css
|
|
1691
|
+
var listScroll_default = {};
|
|
1692
|
+
var FlexLayoutSplitScreenScrollBox = ({
|
|
1693
|
+
className,
|
|
1694
|
+
children,
|
|
1695
|
+
keyName,
|
|
1696
|
+
direction,
|
|
1697
|
+
isDefaultScrollStyle = false,
|
|
1698
|
+
...props
|
|
1699
|
+
}) => {
|
|
1700
|
+
const scrollRef = react.useRef(null);
|
|
1701
|
+
const [isMouseDown, setIsMouseDown] = react.useState(false);
|
|
1702
|
+
const scrollEventSubject = react.useRef(new rxjs.Subject());
|
|
1703
|
+
react.useEffect(() => {
|
|
1704
|
+
const mouseUpSubscribe = rxjs.fromEvent(
|
|
1705
|
+
window,
|
|
1706
|
+
"mouseup"
|
|
1707
|
+
).subscribe(() => {
|
|
1708
|
+
setIsMouseDown(false);
|
|
1709
|
+
});
|
|
1710
|
+
const scrollEventSubscribe = scrollEventSubject.current.pipe(operators.throttleTime(70)).subscribe((position) => {
|
|
1711
|
+
setScrollPosition(keyName, position);
|
|
1712
|
+
});
|
|
1713
|
+
const scrollSubscribe = getScrollPosition(keyName).pipe(operators.take(1)).subscribe((position) => {
|
|
1714
|
+
if (scrollRef.current && position) {
|
|
1715
|
+
scrollRef.current.scrollLeft = position.x;
|
|
1716
|
+
scrollRef.current.scrollTop = position.y;
|
|
1717
|
+
}
|
|
1718
|
+
});
|
|
1719
|
+
return () => {
|
|
1720
|
+
removeScrollPosition(keyName);
|
|
1721
|
+
mouseUpSubscribe.unsubscribe();
|
|
1722
|
+
scrollSubscribe.unsubscribe();
|
|
1723
|
+
scrollEventSubscribe.unsubscribe();
|
|
1724
|
+
};
|
|
1725
|
+
}, [keyName]);
|
|
1726
|
+
react.useEffect(() => {
|
|
1727
|
+
if (!scrollRef.current) return;
|
|
1728
|
+
let animationFrameId = null;
|
|
1729
|
+
const handleWheel = (event) => {
|
|
1730
|
+
if (!scrollRef.current || direction !== "x") return;
|
|
1731
|
+
if (scrollRef.current.matches(":hover")) {
|
|
1732
|
+
event.preventDefault();
|
|
1733
|
+
const { deltaY } = event;
|
|
1734
|
+
const newScrollLeft = scrollRef.current.scrollLeft + deltaY;
|
|
1735
|
+
if (animationFrameId) {
|
|
1736
|
+
cancelAnimationFrame(animationFrameId);
|
|
1737
|
+
}
|
|
1738
|
+
animationFrameId = requestAnimationFrame(() => {
|
|
1739
|
+
scrollRef.current.scrollLeft = newScrollLeft;
|
|
1740
|
+
scrollEventSubject.current.next({
|
|
1741
|
+
x: newScrollLeft,
|
|
1742
|
+
y: scrollRef.current.scrollTop
|
|
1743
|
+
});
|
|
1744
|
+
animationFrameId = null;
|
|
1745
|
+
});
|
|
1746
|
+
}
|
|
1747
|
+
};
|
|
1748
|
+
scrollRef.current.addEventListener("wheel", handleWheel, {
|
|
1749
|
+
passive: false
|
|
1750
|
+
});
|
|
1751
|
+
return () => {
|
|
1752
|
+
scrollRef.current?.removeEventListener("wheel", handleWheel);
|
|
1753
|
+
};
|
|
1754
|
+
}, []);
|
|
1755
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1756
|
+
"div",
|
|
1757
|
+
{
|
|
1758
|
+
ref: scrollRef,
|
|
1759
|
+
onMouseUp: () => setIsMouseDown(false),
|
|
1760
|
+
onMouseDown: () => setIsMouseDown(true),
|
|
1761
|
+
onMouseMove: (event) => {
|
|
1762
|
+
if (!scrollRef.current || !isMouseDown || direction !== "x")
|
|
1763
|
+
return;
|
|
1764
|
+
scrollRef.current.scrollLeft += event.movementX * -1;
|
|
1765
|
+
scrollEventSubject.current.next({
|
|
1766
|
+
x: scrollRef.current.scrollLeft,
|
|
1767
|
+
y: scrollRef.current.scrollTop
|
|
1768
|
+
});
|
|
1769
|
+
},
|
|
1770
|
+
onScroll: () => {
|
|
1771
|
+
if (!scrollRef.current) return;
|
|
1772
|
+
scrollEventSubject.current.next({
|
|
1773
|
+
x: scrollRef.current.scrollLeft,
|
|
1774
|
+
y: scrollRef.current.scrollTop
|
|
1775
|
+
});
|
|
1776
|
+
},
|
|
1777
|
+
className: `${className || ""} ${isDefaultScrollStyle ? listScroll_default["default-scroll"] : listScroll_default["list-scroll"]} ${direction ? listScroll_default[direction] : ""}`,
|
|
1778
|
+
...props,
|
|
1779
|
+
children
|
|
1780
|
+
}
|
|
1781
|
+
);
|
|
1782
|
+
};
|
|
1783
|
+
var FlexLayoutSplitScreenScrollBox_default = react.memo(FlexLayoutSplitScreenScrollBox);
|
|
1784
|
+
function FlexLayoutSplitScreenDragBoxContainer({
|
|
1785
|
+
className,
|
|
1786
|
+
children,
|
|
1787
|
+
layoutName,
|
|
1788
|
+
...props
|
|
1789
|
+
}) {
|
|
1790
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1791
|
+
FlexLayoutSplitScreenScrollBox_default,
|
|
1792
|
+
{
|
|
1793
|
+
keyName: layoutName,
|
|
1794
|
+
className: `${FlexLayout_default["flex-split-screen-drag-box-title-container"]} ${className && className !== "" && className || ""}`,
|
|
1795
|
+
direction: "x",
|
|
1796
|
+
...props,
|
|
1797
|
+
children
|
|
1798
|
+
}
|
|
1799
|
+
);
|
|
1800
|
+
}
|
|
1801
|
+
function FlexLayoutSplitScreenDragBoxItem({
|
|
1802
|
+
children,
|
|
1803
|
+
onClose,
|
|
1804
|
+
isActive,
|
|
1805
|
+
...props
|
|
1806
|
+
}) {
|
|
1807
|
+
react.useEffect(() => {
|
|
1808
|
+
allSplitScreenCount.next(allSplitScreenCount.value + 1);
|
|
1809
|
+
return () => {
|
|
1810
|
+
if (allSplitScreenCount.value <= 1) return;
|
|
1811
|
+
allSplitScreenCount.next(allSplitScreenCount.value - 1);
|
|
1812
|
+
};
|
|
1813
|
+
}, []);
|
|
1814
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1815
|
+
"div",
|
|
1816
|
+
{
|
|
1817
|
+
className: `${FlexLayout_default["flex-split-screen-drag-box-title-item"]} ${isActive ? FlexLayout_default["active"] : ""}`,
|
|
1818
|
+
...props,
|
|
1819
|
+
children: [
|
|
1820
|
+
children,
|
|
1821
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: (ev) => onClose(ev), children: "X" })
|
|
1822
|
+
]
|
|
1823
|
+
}
|
|
1824
|
+
);
|
|
1825
|
+
}
|
|
1826
|
+
function FlexLayoutSplitScreenDragBoxTitleMore({
|
|
1827
|
+
className,
|
|
1828
|
+
...props
|
|
1829
|
+
}) {
|
|
1830
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1831
|
+
"button",
|
|
1832
|
+
{
|
|
1833
|
+
...props,
|
|
1834
|
+
className: `${FlexLayout_default["flex-split-screen-drag-box-title-more"]} ${className || ""}`,
|
|
1835
|
+
children: [
|
|
1836
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "." }),
|
|
1837
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "." }),
|
|
1838
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "." })
|
|
1839
|
+
]
|
|
1840
|
+
}
|
|
1841
|
+
);
|
|
1842
|
+
}
|
|
1843
|
+
function isOverDrop({
|
|
1844
|
+
x,
|
|
1845
|
+
y,
|
|
1846
|
+
element
|
|
1847
|
+
}) {
|
|
1848
|
+
const {
|
|
1849
|
+
x: elementX,
|
|
1850
|
+
y: elementY,
|
|
1851
|
+
right: elementRight,
|
|
1852
|
+
bottom: elementBottom
|
|
1853
|
+
} = element.getBoundingClientRect();
|
|
1854
|
+
const isElementOver = x < elementX || x > elementRight || y < elementY || y > elementBottom;
|
|
1855
|
+
return isElementOver;
|
|
1856
|
+
}
|
|
1857
|
+
function isInnerDrop({
|
|
1858
|
+
x,
|
|
1859
|
+
y,
|
|
1860
|
+
element
|
|
1861
|
+
}) {
|
|
1862
|
+
const {
|
|
1863
|
+
x: elementX,
|
|
1864
|
+
y: elementY,
|
|
1865
|
+
right: elementRight,
|
|
1866
|
+
bottom: elementBottom
|
|
1867
|
+
} = element.getBoundingClientRect();
|
|
1868
|
+
const isElementInner = x >= elementX && x <= elementRight && y >= elementY && y <= elementBottom;
|
|
1869
|
+
return isElementInner;
|
|
1870
|
+
}
|
|
1871
|
+
var handleUpdateDropTargetComponents = ({
|
|
1872
|
+
orderName,
|
|
1873
|
+
parentOrderName,
|
|
1874
|
+
containerName,
|
|
1875
|
+
parentLayoutName,
|
|
1876
|
+
layoutName,
|
|
1877
|
+
dropComponent,
|
|
1878
|
+
navigationTitle,
|
|
1879
|
+
nextContainerName,
|
|
1880
|
+
isUsePrefix = true,
|
|
1881
|
+
beforeDropTargetComponent,
|
|
1882
|
+
afterDropTargetComponent,
|
|
1883
|
+
centerDropTargetComponent,
|
|
1884
|
+
dropDocumentOutsideOption,
|
|
1885
|
+
screenKey = Array.from(
|
|
1886
|
+
window.crypto.getRandomValues(new Uint32Array(16)),
|
|
1887
|
+
(e) => e.toString(32).padStart(2, "0")
|
|
1888
|
+
).join("")
|
|
1889
|
+
}) => {
|
|
1890
|
+
const nextContainerNameOrderName = parentOrderName ? parentOrderName : orderName;
|
|
1891
|
+
let listMap;
|
|
1892
|
+
let list;
|
|
1893
|
+
let key;
|
|
1894
|
+
if (nextContainerNameOrderName === orderName || nextContainerNameOrderName === "center") {
|
|
1895
|
+
listMap = orderName === "before" ? { beforeDropTargetComponent } : orderName === "after" ? { afterDropTargetComponent } : {
|
|
1896
|
+
centerDropTargetComponent: centerDropTargetComponent.filter(
|
|
1897
|
+
(e) => !e.containerName.split("_").at(0).startsWith(
|
|
1898
|
+
containerName.split("_").at(0)
|
|
1899
|
+
)
|
|
1900
|
+
)
|
|
1901
|
+
};
|
|
1902
|
+
} else {
|
|
1903
|
+
listMap = nextContainerNameOrderName === "before" ? { beforeDropTargetComponent } : { afterDropTargetComponent };
|
|
1904
|
+
}
|
|
1905
|
+
const entries = Object.entries(listMap)[0];
|
|
1906
|
+
key = entries[0];
|
|
1907
|
+
list = entries[1];
|
|
1908
|
+
const newComponent = {
|
|
1909
|
+
containerName: `${containerName + "_" + layoutName}${isUsePrefix ? "_" + orderName + "-" + list.length : ""}`,
|
|
1910
|
+
component: react.cloneElement(
|
|
1911
|
+
dropComponent,
|
|
1912
|
+
{ key: screenKey, screenKey }
|
|
1913
|
+
),
|
|
1914
|
+
navigationTitle,
|
|
1915
|
+
dropDocumentOutsideOption,
|
|
1916
|
+
screenKey: screenKey || Array.from(
|
|
1917
|
+
window.crypto.getRandomValues(new Uint32Array(16)),
|
|
1918
|
+
(e) => e.toString(32).padStart(2, "0")
|
|
1919
|
+
).join("")
|
|
1920
|
+
};
|
|
1921
|
+
let allComponents;
|
|
1922
|
+
if (nextContainerName) {
|
|
1923
|
+
const index = list.findIndex(
|
|
1924
|
+
(item) => item.containerName === nextContainerName
|
|
1925
|
+
);
|
|
1926
|
+
if (index !== -1) {
|
|
1927
|
+
if (nextContainerNameOrderName === orderName) {
|
|
1928
|
+
if (orderName === "before") {
|
|
1929
|
+
allComponents = [
|
|
1930
|
+
...list.slice(0, index),
|
|
1931
|
+
newComponent,
|
|
1932
|
+
...list.slice(index)
|
|
1933
|
+
];
|
|
1934
|
+
} else {
|
|
1935
|
+
allComponents = [
|
|
1936
|
+
...list.slice(0, index + 1),
|
|
1937
|
+
newComponent,
|
|
1938
|
+
...list.slice(index + 1)
|
|
1939
|
+
];
|
|
1940
|
+
}
|
|
1941
|
+
} else {
|
|
1942
|
+
if (nextContainerNameOrderName === "after" && orderName === "before") {
|
|
1943
|
+
allComponents = [
|
|
1944
|
+
...list.slice(0, index),
|
|
1945
|
+
newComponent,
|
|
1946
|
+
...list.slice(index)
|
|
1947
|
+
];
|
|
1948
|
+
} else if (nextContainerNameOrderName === "before" && orderName === "after") {
|
|
1949
|
+
allComponents = [
|
|
1950
|
+
...list.slice(0, index + 1),
|
|
1951
|
+
newComponent,
|
|
1952
|
+
...list.slice(index + 1)
|
|
1953
|
+
];
|
|
1954
|
+
} else {
|
|
1955
|
+
if (orderName === "before") {
|
|
1956
|
+
allComponents = [
|
|
1957
|
+
...list.slice(0, index),
|
|
1958
|
+
newComponent,
|
|
1959
|
+
...list.slice(index)
|
|
1960
|
+
];
|
|
1961
|
+
} else {
|
|
1962
|
+
allComponents = [
|
|
1963
|
+
...list.slice(0, index + 1),
|
|
1964
|
+
newComponent,
|
|
1965
|
+
...list.slice(index + 1)
|
|
1966
|
+
];
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
} else {
|
|
1971
|
+
if (nextContainerNameOrderName === "center" && orderName === "after") {
|
|
1972
|
+
allComponents = [newComponent, ...list];
|
|
1973
|
+
} else if (nextContainerNameOrderName === "center" && orderName === "before") {
|
|
1974
|
+
allComponents = [...list, newComponent];
|
|
1975
|
+
} else {
|
|
1976
|
+
allComponents = orderName === "before" ? [newComponent, ...list] : [...list, newComponent];
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
} else {
|
|
1980
|
+
allComponents = orderName === "before" ? [newComponent, ...list] : [...list, newComponent];
|
|
1981
|
+
}
|
|
1982
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1983
|
+
const result = allComponents.filter((item) => {
|
|
1984
|
+
if (seen.has(item.containerName)) {
|
|
1985
|
+
return false;
|
|
1986
|
+
}
|
|
1987
|
+
seen.add(item.containerName);
|
|
1988
|
+
return true;
|
|
1989
|
+
});
|
|
1990
|
+
dropMovementEventSubject.next({
|
|
1991
|
+
state: "append",
|
|
1992
|
+
targetParentLayoutName: parentLayoutName,
|
|
1993
|
+
targetLayoutName: layoutName,
|
|
1994
|
+
targetContainerName: containerName,
|
|
1995
|
+
orderName
|
|
1996
|
+
});
|
|
1997
|
+
return { [key]: result };
|
|
1998
|
+
};
|
|
1999
|
+
var handleRemove = (list, targetContainerName, orderNameSetter) => {
|
|
2000
|
+
const result = list.filter((e) => e.containerName !== targetContainerName);
|
|
2001
|
+
if (result.length != list.length)
|
|
2002
|
+
orderNameSetter(list.length - result.length);
|
|
2003
|
+
return result;
|
|
2004
|
+
};
|
|
2005
|
+
function getAdjacentItem(items, currentIndex) {
|
|
2006
|
+
if (currentIndex + 1 < items.length) {
|
|
2007
|
+
return {
|
|
2008
|
+
adjacentItem: items[currentIndex + 1],
|
|
2009
|
+
adjacentIndex: currentIndex + 1
|
|
2010
|
+
};
|
|
2011
|
+
} else if (currentIndex - 1 >= 0) {
|
|
2012
|
+
return {
|
|
2013
|
+
adjacentItem: items[currentIndex - 1],
|
|
2014
|
+
adjacentIndex: currentIndex - 1
|
|
2015
|
+
};
|
|
2016
|
+
}
|
|
2017
|
+
return { adjacentItem: null, adjacentIndex: currentIndex };
|
|
2018
|
+
}
|
|
2019
|
+
var getSelfOrderName = (containerName) => {
|
|
2020
|
+
const result = containerName.split("_").at(-1)?.split("-").at(0)?.split("=").at(0);
|
|
2021
|
+
if (["before", "center", "after"].some((e) => e === result)) {
|
|
2022
|
+
return result;
|
|
2023
|
+
} else {
|
|
2024
|
+
return;
|
|
2025
|
+
}
|
|
2026
|
+
};
|
|
2027
|
+
function FlexLayoutSplitScreen({
|
|
2028
|
+
children,
|
|
2029
|
+
containerName,
|
|
2030
|
+
layoutName,
|
|
2031
|
+
navigationTitle,
|
|
2032
|
+
dropDocumentOutsideOption,
|
|
2033
|
+
screenKey
|
|
2034
|
+
}) {
|
|
2035
|
+
const {
|
|
2036
|
+
direction,
|
|
2037
|
+
isSplit,
|
|
2038
|
+
boundaryContainerSize,
|
|
2039
|
+
afterDropTargetComponent,
|
|
2040
|
+
beforeDropTargetComponent,
|
|
2041
|
+
centerDropTargetComponent,
|
|
2042
|
+
setAfterDropTargetComponent,
|
|
2043
|
+
setBeforeDropTargetComponent,
|
|
2044
|
+
setCenterDropTargetComponent,
|
|
2045
|
+
layoutRef,
|
|
2046
|
+
setIsSplit,
|
|
2047
|
+
setDirection
|
|
2048
|
+
} = useFlexLayoutSplitScreen({
|
|
2049
|
+
isSplitInitial: false,
|
|
2050
|
+
directionInitial: "row",
|
|
2051
|
+
selfContainerName: containerName,
|
|
2052
|
+
parentLayoutName: "",
|
|
2053
|
+
layoutName
|
|
2054
|
+
});
|
|
2055
|
+
react.useEffect(() => {
|
|
2056
|
+
resetRootSplitScreen(layoutName);
|
|
2057
|
+
const subscribe = getSplitScreen(layoutName, layoutName).subscribe((layoutInfo) => {
|
|
2058
|
+
if (layoutInfo) {
|
|
2059
|
+
setBeforeDropTargetComponent([
|
|
2060
|
+
...layoutInfo.beforeDropTargetComponent
|
|
2061
|
+
]);
|
|
2062
|
+
setAfterDropTargetComponent([
|
|
2063
|
+
...layoutInfo.afterDropTargetComponent
|
|
2064
|
+
]);
|
|
2065
|
+
setCenterDropTargetComponent([
|
|
2066
|
+
...layoutInfo.centerDropTargetComponent
|
|
2067
|
+
]);
|
|
2068
|
+
setDirection(layoutInfo.direction);
|
|
2069
|
+
if (layoutInfo.beforeDropTargetComponent.length !== 0 || layoutInfo.afterDropTargetComponent.length !== 0) {
|
|
2070
|
+
setIsSplit(true);
|
|
2071
|
+
}
|
|
2072
|
+
} else {
|
|
2073
|
+
setSplitScreen(layoutName, layoutName, {
|
|
2074
|
+
afterDropTargetComponent: [],
|
|
2075
|
+
beforeDropTargetComponent: [],
|
|
2076
|
+
centerDropTargetComponent: [
|
|
2077
|
+
{
|
|
2078
|
+
containerName,
|
|
2079
|
+
component: children,
|
|
2080
|
+
navigationTitle,
|
|
2081
|
+
dropDocumentOutsideOption,
|
|
2082
|
+
screenKey: screenKey ? screenKey : Array.from(
|
|
2083
|
+
window.crypto.getRandomValues(
|
|
2084
|
+
new Uint32Array(16)
|
|
2085
|
+
),
|
|
2086
|
+
(e) => e.toString(32).padStart(2, "0")
|
|
2087
|
+
).join("")
|
|
2088
|
+
}
|
|
2089
|
+
],
|
|
2090
|
+
direction
|
|
2091
|
+
});
|
|
2092
|
+
}
|
|
2093
|
+
});
|
|
2094
|
+
return () => {
|
|
2095
|
+
subscribe.unsubscribe();
|
|
2096
|
+
resetRootSplitScreen(layoutName);
|
|
2097
|
+
};
|
|
2098
|
+
}, [layoutName]);
|
|
2099
|
+
react.useEffect(() => {
|
|
2100
|
+
const subscribe = dropMovementEventSubject.pipe(
|
|
2101
|
+
rxjs.distinctUntilChanged((prev, curr) => {
|
|
2102
|
+
const filterChildren2 = (obj) => {
|
|
2103
|
+
const {
|
|
2104
|
+
children: children2,
|
|
2105
|
+
component,
|
|
2106
|
+
targetComponent,
|
|
2107
|
+
x,
|
|
2108
|
+
y,
|
|
2109
|
+
...rest
|
|
2110
|
+
} = obj || {};
|
|
2111
|
+
return rest;
|
|
2112
|
+
};
|
|
2113
|
+
return equal__default.default(filterChildren2(prev), filterChildren2(curr));
|
|
2114
|
+
})
|
|
2115
|
+
).subscribe((event) => {
|
|
2116
|
+
if (event.state === "remove") {
|
|
2117
|
+
if (event.targetParentLayoutName === layoutName || event.targetParentLayoutName === "" && event.targetLayoutName === layoutName) {
|
|
2118
|
+
requestAnimationFrame(() => {
|
|
2119
|
+
let removeCallback = (removeOrderName) => {
|
|
2120
|
+
if (event.nextContainerName && event.dropTargetComponentEvent && event.targetComponent) {
|
|
2121
|
+
const targetComponentsMap = handleUpdateDropTargetComponents({
|
|
2122
|
+
orderName: removeOrderName,
|
|
2123
|
+
containerName: event.nextContainerName,
|
|
2124
|
+
parentLayoutName: "",
|
|
2125
|
+
layoutName,
|
|
2126
|
+
dropComponent: event.targetComponent,
|
|
2127
|
+
navigationTitle: event.dropTargetComponentEvent.navigationTitle,
|
|
2128
|
+
isUsePrefix: true,
|
|
2129
|
+
afterDropTargetComponent,
|
|
2130
|
+
beforeDropTargetComponent,
|
|
2131
|
+
centerDropTargetComponent,
|
|
2132
|
+
dropDocumentOutsideOption,
|
|
2133
|
+
screenKey: event.dropTargetComponentEvent.screenKey
|
|
2134
|
+
});
|
|
2135
|
+
setSplitScreen(layoutName, layoutName, {
|
|
2136
|
+
...getCurrentSplitScreenComponents(
|
|
2137
|
+
layoutName,
|
|
2138
|
+
layoutName
|
|
2139
|
+
) || {
|
|
2140
|
+
afterDropTargetComponent,
|
|
2141
|
+
beforeDropTargetComponent,
|
|
2142
|
+
centerDropTargetComponent,
|
|
2143
|
+
direction
|
|
2144
|
+
},
|
|
2145
|
+
...targetComponentsMap
|
|
2146
|
+
});
|
|
2147
|
+
Promise.resolve().then(
|
|
2148
|
+
() => event.dropEndCallback && event.dropEndCallback({
|
|
2149
|
+
x: event.x,
|
|
2150
|
+
y: event.y,
|
|
2151
|
+
containerName
|
|
2152
|
+
})
|
|
2153
|
+
);
|
|
2154
|
+
}
|
|
2155
|
+
};
|
|
2156
|
+
const currentComponents = getCurrentSplitScreenComponents(
|
|
2157
|
+
layoutName,
|
|
2158
|
+
layoutName
|
|
2159
|
+
);
|
|
2160
|
+
const afterList = handleRemove(
|
|
2161
|
+
currentComponents?.afterDropTargetComponent || afterDropTargetComponent,
|
|
2162
|
+
event.targetContainerName,
|
|
2163
|
+
() => removeCallback("after")
|
|
2164
|
+
);
|
|
2165
|
+
const beforList = handleRemove(
|
|
2166
|
+
currentComponents?.beforeDropTargetComponent || beforeDropTargetComponent,
|
|
2167
|
+
event.targetContainerName,
|
|
2168
|
+
() => removeCallback("before")
|
|
2169
|
+
);
|
|
2170
|
+
const centerList = handleRemove(
|
|
2171
|
+
currentComponents?.centerDropTargetComponent || centerDropTargetComponent,
|
|
2172
|
+
event.targetContainerName,
|
|
2173
|
+
() => removeCallback("center")
|
|
2174
|
+
);
|
|
2175
|
+
setSplitScreen(layoutName, layoutName, {
|
|
2176
|
+
afterDropTargetComponent: afterList,
|
|
2177
|
+
beforeDropTargetComponent: beforList,
|
|
2178
|
+
centerDropTargetComponent: centerList,
|
|
2179
|
+
direction
|
|
2180
|
+
});
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
2183
|
+
} else if (event.state === "append") {
|
|
2184
|
+
const {
|
|
2185
|
+
x,
|
|
2186
|
+
y,
|
|
2187
|
+
dropEndCallback,
|
|
2188
|
+
dropTargetComponentEvent,
|
|
2189
|
+
orderName,
|
|
2190
|
+
parentOrderName,
|
|
2191
|
+
targetLayoutName,
|
|
2192
|
+
targetParentLayoutName,
|
|
2193
|
+
targetContainerName,
|
|
2194
|
+
targetComponent,
|
|
2195
|
+
nextContainerName
|
|
2196
|
+
} = event;
|
|
2197
|
+
if (layoutRef.current && orderName && x && y && targetComponent && dropTargetComponentEvent && targetLayoutName === layoutName && isInnerDrop({ x, y, element: layoutRef.current })) {
|
|
2198
|
+
const {
|
|
2199
|
+
direction: dropDirection,
|
|
2200
|
+
navigationTitle: navigationTitle2,
|
|
2201
|
+
dropDocumentOutsideOption: dropDocumentOutsideOption2
|
|
2202
|
+
} = dropTargetComponentEvent;
|
|
2203
|
+
const isOrderNameNotCenter = orderName !== "center";
|
|
2204
|
+
const isOrderNameCenterAndFirstScreen = orderName === "center" && centerDropTargetComponent.length <= 1;
|
|
2205
|
+
if (isOrderNameNotCenter || isOrderNameCenterAndFirstScreen) {
|
|
2206
|
+
setIsSplit(true);
|
|
2207
|
+
if (isOrderNameNotCenter) {
|
|
2208
|
+
setDirection(dropDirection);
|
|
2209
|
+
const targetComponentsMap = handleUpdateDropTargetComponents({
|
|
2210
|
+
orderName,
|
|
2211
|
+
parentOrderName,
|
|
2212
|
+
containerName: targetContainerName,
|
|
2213
|
+
nextContainerName,
|
|
2214
|
+
dropComponent: targetComponent,
|
|
2215
|
+
parentLayoutName: "",
|
|
2216
|
+
layoutName,
|
|
2217
|
+
navigationTitle: navigationTitle2,
|
|
2218
|
+
isUsePrefix: true,
|
|
2219
|
+
afterDropTargetComponent,
|
|
2220
|
+
beforeDropTargetComponent,
|
|
2221
|
+
centerDropTargetComponent,
|
|
2222
|
+
dropDocumentOutsideOption: dropDocumentOutsideOption2
|
|
2223
|
+
});
|
|
2224
|
+
setSplitScreen(layoutName, layoutName, {
|
|
2225
|
+
...{
|
|
2226
|
+
afterDropTargetComponent,
|
|
2227
|
+
beforeDropTargetComponent,
|
|
2228
|
+
centerDropTargetComponent,
|
|
2229
|
+
direction: dropDirection
|
|
2230
|
+
},
|
|
2231
|
+
...targetComponentsMap,
|
|
2232
|
+
...{ direction: dropDirection }
|
|
2233
|
+
});
|
|
2234
|
+
Promise.resolve().then(
|
|
2235
|
+
() => dropEndCallback && dropEndCallback({
|
|
2236
|
+
x: event.x,
|
|
2237
|
+
y: event.y,
|
|
2238
|
+
containerName
|
|
2239
|
+
})
|
|
2240
|
+
);
|
|
2241
|
+
} else {
|
|
2242
|
+
const childScreenInfo = getCurrentSplitScreenComponents(
|
|
2243
|
+
layoutName,
|
|
2244
|
+
`${layoutName}_center=${centerDropTargetComponent[0].screenKey}`
|
|
2245
|
+
) || {
|
|
2246
|
+
afterDropTargetComponent: [],
|
|
2247
|
+
beforeDropTargetComponent: [],
|
|
2248
|
+
centerDropTargetComponent: [],
|
|
2249
|
+
direction
|
|
2250
|
+
};
|
|
2251
|
+
setSplitScreen(
|
|
2252
|
+
layoutName,
|
|
2253
|
+
`${layoutName}_center=${centerDropTargetComponent[0].screenKey}`,
|
|
2254
|
+
{
|
|
2255
|
+
...childScreenInfo,
|
|
2256
|
+
...{
|
|
2257
|
+
centerDropTargetComponent: [
|
|
2258
|
+
centerDropTargetComponent[0],
|
|
2259
|
+
{
|
|
2260
|
+
containerName: `${targetContainerName}_${layoutName}_${orderName}`,
|
|
2261
|
+
component: targetComponent,
|
|
2262
|
+
dropDocumentOutsideOption: dropDocumentOutsideOption2,
|
|
2263
|
+
screenKey: centerDropTargetComponent[0].screenKey,
|
|
2264
|
+
navigationTitle: navigationTitle2
|
|
2265
|
+
}
|
|
2266
|
+
]
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
);
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
});
|
|
2275
|
+
return () => {
|
|
2276
|
+
subscribe.unsubscribe();
|
|
2277
|
+
};
|
|
2278
|
+
}, [
|
|
2279
|
+
direction,
|
|
2280
|
+
layoutName,
|
|
2281
|
+
isSplit,
|
|
2282
|
+
beforeDropTargetComponent,
|
|
2283
|
+
afterDropTargetComponent,
|
|
2284
|
+
centerDropTargetComponent
|
|
2285
|
+
]);
|
|
2286
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${FlexLayout_default["flex-split-screen"]}`, ref: layoutRef, children: [
|
|
2287
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2288
|
+
FlexLayout_default2,
|
|
2289
|
+
{
|
|
2290
|
+
direction,
|
|
2291
|
+
layoutName,
|
|
2292
|
+
"data-is_split": isSplit,
|
|
2293
|
+
panelMovementMode: "bulldozer",
|
|
2294
|
+
children: [
|
|
2295
|
+
beforeDropTargetComponent.length != 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: beforeDropTargetComponent.map(
|
|
2296
|
+
({
|
|
2297
|
+
containerName: cName,
|
|
2298
|
+
component,
|
|
2299
|
+
navigationTitle: navigationTitle2,
|
|
2300
|
+
dropDocumentOutsideOption: dropDocumentOutsideOption2,
|
|
2301
|
+
screenKey: screenKey2
|
|
2302
|
+
}, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2303
|
+
FlexLayoutContainer_default,
|
|
2304
|
+
{
|
|
2305
|
+
containerName: cName,
|
|
2306
|
+
isInitialResizable: true,
|
|
2307
|
+
isResizePanel: true,
|
|
2308
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2309
|
+
FlexLayoutSplitScreenChild,
|
|
2310
|
+
{
|
|
2311
|
+
parentDirection: direction,
|
|
2312
|
+
layoutName: `${layoutName}_before`,
|
|
2313
|
+
parentLayoutName: layoutName,
|
|
2314
|
+
containerName: cName,
|
|
2315
|
+
depth: 1,
|
|
2316
|
+
rootRef: layoutRef,
|
|
2317
|
+
screenKey: screenKey2,
|
|
2318
|
+
initialCenterComponents: [
|
|
2319
|
+
{
|
|
2320
|
+
navigationTitle: navigationTitle2,
|
|
2321
|
+
component,
|
|
2322
|
+
containerName: cName,
|
|
2323
|
+
dropDocumentOutsideOption: dropDocumentOutsideOption2,
|
|
2324
|
+
screenKey: screenKey2
|
|
2325
|
+
}
|
|
2326
|
+
],
|
|
2327
|
+
rootName: layoutName
|
|
2328
|
+
}
|
|
2329
|
+
)
|
|
2330
|
+
},
|
|
2331
|
+
cName
|
|
2332
|
+
)
|
|
2333
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx("div", {}),
|
|
2334
|
+
centerDropTargetComponent.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", {}) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2335
|
+
FlexLayoutContainer_default,
|
|
2336
|
+
{
|
|
2337
|
+
containerName: `${centerDropTargetComponent[0].containerName}`,
|
|
2338
|
+
isInitialResizable: true,
|
|
2339
|
+
isResizePanel: isSplit,
|
|
2340
|
+
children: isSplit ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2341
|
+
FlexLayoutSplitScreenChild,
|
|
2342
|
+
{
|
|
2343
|
+
parentDirection: direction,
|
|
2344
|
+
layoutName: `${layoutName}_center`,
|
|
2345
|
+
parentLayoutName: layoutName,
|
|
2346
|
+
containerName: `${centerDropTargetComponent[0].containerName}`,
|
|
2347
|
+
depth: 0,
|
|
2348
|
+
rootRef: layoutRef,
|
|
2349
|
+
screenKey: centerDropTargetComponent[0].screenKey,
|
|
2350
|
+
initialCenterComponents: [
|
|
2351
|
+
{
|
|
2352
|
+
navigationTitle: centerDropTargetComponent[0].navigationTitle,
|
|
2353
|
+
component: centerDropTargetComponent[0].component,
|
|
2354
|
+
containerName: centerDropTargetComponent[0].containerName,
|
|
2355
|
+
dropDocumentOutsideOption: centerDropTargetComponent[0].dropDocumentOutsideOption,
|
|
2356
|
+
screenKey: centerDropTargetComponent[0].screenKey
|
|
2357
|
+
}
|
|
2358
|
+
],
|
|
2359
|
+
rootName: layoutName
|
|
2360
|
+
}
|
|
2361
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2362
|
+
FlexLayoutSplitScreenScrollBox_default,
|
|
2363
|
+
{
|
|
2364
|
+
keyName: centerDropTargetComponent[0].containerName,
|
|
2365
|
+
isDefaultScrollStyle: true,
|
|
2366
|
+
children: centerDropTargetComponent[0].component
|
|
2367
|
+
}
|
|
2368
|
+
)
|
|
2369
|
+
}
|
|
2370
|
+
),
|
|
2371
|
+
afterDropTargetComponent.length != 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: afterDropTargetComponent.map(
|
|
2372
|
+
({
|
|
2373
|
+
containerName: cName,
|
|
2374
|
+
component,
|
|
2375
|
+
navigationTitle: navigationTitle2,
|
|
2376
|
+
dropDocumentOutsideOption: dropDocumentOutsideOption2,
|
|
2377
|
+
screenKey: screenKey2
|
|
2378
|
+
}, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2379
|
+
FlexLayoutContainer_default,
|
|
2380
|
+
{
|
|
2381
|
+
containerName: cName,
|
|
2382
|
+
isInitialResizable: true,
|
|
2383
|
+
isResizePanel: afterDropTargetComponent.length - 1 !== i,
|
|
2384
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2385
|
+
FlexLayoutSplitScreenChild,
|
|
2386
|
+
{
|
|
2387
|
+
parentDirection: direction,
|
|
2388
|
+
layoutName: `${layoutName}_after`,
|
|
2389
|
+
parentLayoutName: layoutName,
|
|
2390
|
+
containerName: cName,
|
|
2391
|
+
depth: 1,
|
|
2392
|
+
rootRef: layoutRef,
|
|
2393
|
+
screenKey: screenKey2,
|
|
2394
|
+
initialCenterComponents: [
|
|
2395
|
+
{
|
|
2396
|
+
navigationTitle: navigationTitle2,
|
|
2397
|
+
component,
|
|
2398
|
+
containerName: cName,
|
|
2399
|
+
dropDocumentOutsideOption: dropDocumentOutsideOption2,
|
|
2400
|
+
screenKey: screenKey2
|
|
2401
|
+
}
|
|
2402
|
+
],
|
|
2403
|
+
rootName: layoutName
|
|
2404
|
+
}
|
|
2405
|
+
)
|
|
2406
|
+
},
|
|
2407
|
+
cName
|
|
2408
|
+
)
|
|
2409
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx("div", {})
|
|
2410
|
+
]
|
|
2411
|
+
}
|
|
2412
|
+
),
|
|
2413
|
+
boundaryContainerSize && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2414
|
+
"div",
|
|
2415
|
+
{
|
|
2416
|
+
className: `${FlexLayout_default["flex-split-screen-boundary-container"]}`,
|
|
2417
|
+
style: { ...boundaryContainerSize },
|
|
2418
|
+
children: "\u2B07\uFE0F\uB4DC\uB86D\uD558\uBA74 \uD654\uBA74\uC774 \uBD84\uD560\uB429\uB2C8\uB2E4."
|
|
2419
|
+
}
|
|
2420
|
+
)
|
|
2421
|
+
] });
|
|
2422
|
+
}
|
|
2423
|
+
function FlexLayoutSplitScreenChild({
|
|
2424
|
+
containerName,
|
|
2425
|
+
layoutName,
|
|
2426
|
+
parentLayoutName,
|
|
2427
|
+
parentDirection,
|
|
2428
|
+
depth,
|
|
2429
|
+
//isSplit: isSplitInitial,
|
|
2430
|
+
rootRef,
|
|
2431
|
+
rootName,
|
|
2432
|
+
initialCenterComponents,
|
|
2433
|
+
screenKey
|
|
2434
|
+
}) {
|
|
2435
|
+
const {
|
|
2436
|
+
direction,
|
|
2437
|
+
isSplit,
|
|
2438
|
+
boundaryContainerSize,
|
|
2439
|
+
afterDropTargetComponent,
|
|
2440
|
+
beforeDropTargetComponent,
|
|
2441
|
+
centerDropTargetComponent,
|
|
2442
|
+
setAfterDropTargetComponent,
|
|
2443
|
+
setBeforeDropTargetComponent,
|
|
2444
|
+
setCenterDropTargetComponent,
|
|
2445
|
+
layoutRef,
|
|
2446
|
+
setIsSplit,
|
|
2447
|
+
setDirection
|
|
2448
|
+
} = useFlexLayoutSplitScreen({
|
|
2449
|
+
isSplitInitial: false,
|
|
2450
|
+
directionInitial: "row",
|
|
2451
|
+
parentDirection,
|
|
2452
|
+
selfContainerName: containerName,
|
|
2453
|
+
parentLayoutName,
|
|
2454
|
+
layoutName
|
|
2455
|
+
});
|
|
2456
|
+
const [isEmptyContent, setIsEmptyContent] = react.useState(false);
|
|
2457
|
+
const [activeIndex, setActiveIndex] = react.useState(0);
|
|
2458
|
+
const centerDropTargetComponentRef = react.useRef(centerDropTargetComponent);
|
|
2459
|
+
const activeIndexRef = react.useRef(activeIndex);
|
|
2460
|
+
react.useEffect(() => {
|
|
2461
|
+
const subscribe = getSplitScreen(rootName, `${layoutName}=${screenKey}`).pipe(rxjs.take(1)).subscribe((layoutInfo) => {
|
|
2462
|
+
setSplitScreen(rootName, `${layoutName}=${screenKey}`, {
|
|
2463
|
+
afterDropTargetComponent: layoutInfo?.afterDropTargetComponent || [],
|
|
2464
|
+
beforeDropTargetComponent: layoutInfo?.beforeDropTargetComponent || [],
|
|
2465
|
+
centerDropTargetComponent: layoutInfo?.centerDropTargetComponent || initialCenterComponents || [],
|
|
2466
|
+
direction: layoutInfo?.direction || direction
|
|
2467
|
+
});
|
|
2468
|
+
});
|
|
2469
|
+
return () => {
|
|
2470
|
+
removeSplitScreenChild(rootName, layoutName);
|
|
2471
|
+
subscribe.unsubscribe();
|
|
2472
|
+
};
|
|
2473
|
+
}, [rootName, layoutName, initialCenterComponents]);
|
|
2474
|
+
react.useEffect(() => {
|
|
2475
|
+
const subscribe = getSplitScreen(rootName, `${layoutName}=${screenKey}`).subscribe((layoutInfo) => {
|
|
2476
|
+
if (layoutInfo) {
|
|
2477
|
+
setBeforeDropTargetComponent([
|
|
2478
|
+
...layoutInfo.beforeDropTargetComponent
|
|
2479
|
+
]);
|
|
2480
|
+
setAfterDropTargetComponent([
|
|
2481
|
+
...layoutInfo.afterDropTargetComponent
|
|
2482
|
+
]);
|
|
2483
|
+
setCenterDropTargetComponent([
|
|
2484
|
+
...layoutInfo.centerDropTargetComponent
|
|
2485
|
+
]);
|
|
2486
|
+
setDirection(layoutInfo.direction);
|
|
2487
|
+
if (layoutInfo.beforeDropTargetComponent.length !== 0 || layoutInfo.afterDropTargetComponent.length !== 0) {
|
|
2488
|
+
setIsSplit(true);
|
|
2489
|
+
} else if (layoutInfo.beforeDropTargetComponent.length === 0 && layoutInfo.centerDropTargetComponent.length === 0 && layoutInfo.afterDropTargetComponent.length === 0) {
|
|
2490
|
+
dropMovementEventSubject.next({
|
|
2491
|
+
state: "remove",
|
|
2492
|
+
targetContainerName: containerName,
|
|
2493
|
+
targetParentLayoutName: "",
|
|
2494
|
+
targetLayoutName: parentLayoutName
|
|
2495
|
+
});
|
|
2496
|
+
setIsEmptyContent(true);
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
});
|
|
2500
|
+
return () => {
|
|
2501
|
+
subscribe.unsubscribe();
|
|
2502
|
+
};
|
|
2503
|
+
}, [rootName, layoutName]);
|
|
2504
|
+
react.useEffect(() => {
|
|
2505
|
+
const subscribe = dropMovementEventSubject.pipe(
|
|
2506
|
+
rxjs.distinctUntilChanged((prev, curr) => {
|
|
2507
|
+
const filterChildren2 = (obj) => {
|
|
2508
|
+
const {
|
|
2509
|
+
children,
|
|
2510
|
+
component,
|
|
2511
|
+
targetComponent,
|
|
2512
|
+
x,
|
|
2513
|
+
y,
|
|
2514
|
+
...rest
|
|
2515
|
+
} = obj || {};
|
|
2516
|
+
return rest;
|
|
2517
|
+
};
|
|
2518
|
+
return equal__default.default(filterChildren2(prev), filterChildren2(curr));
|
|
2519
|
+
})
|
|
2520
|
+
).subscribe((event) => {
|
|
2521
|
+
if (event.state === "remove") {
|
|
2522
|
+
if (event.targetParentLayoutName === layoutName || event.targetParentLayoutName === "" && event.targetLayoutName === layoutName) {
|
|
2523
|
+
requestAnimationFrame(() => {
|
|
2524
|
+
let removeCallback = (removeOrderName) => {
|
|
2525
|
+
if (event.nextContainerName && event.dropTargetComponentEvent && event.targetComponent) {
|
|
2526
|
+
const targetComponentsMap = handleUpdateDropTargetComponents({
|
|
2527
|
+
orderName: removeOrderName,
|
|
2528
|
+
containerName: event.nextContainerName,
|
|
2529
|
+
parentLayoutName,
|
|
2530
|
+
layoutName,
|
|
2531
|
+
dropComponent: event.targetComponent,
|
|
2532
|
+
navigationTitle: event.dropTargetComponentEvent.navigationTitle,
|
|
2533
|
+
isUsePrefix: true,
|
|
2534
|
+
afterDropTargetComponent,
|
|
2535
|
+
beforeDropTargetComponent,
|
|
2536
|
+
centerDropTargetComponent,
|
|
2537
|
+
dropDocumentOutsideOption: event.dropTargetComponentEvent?.dropDocumentOutsideOption,
|
|
2538
|
+
screenKey: event.dropTargetComponentEvent.screenKey
|
|
2539
|
+
});
|
|
2540
|
+
setSplitScreen(
|
|
2541
|
+
rootName,
|
|
2542
|
+
`${layoutName}=${screenKey}`,
|
|
2543
|
+
{
|
|
2544
|
+
...getCurrentSplitScreenComponents(
|
|
2545
|
+
rootName,
|
|
2546
|
+
`${layoutName}=${screenKey}`
|
|
2547
|
+
) || {
|
|
2548
|
+
afterDropTargetComponent,
|
|
2549
|
+
beforeDropTargetComponent,
|
|
2550
|
+
centerDropTargetComponent,
|
|
2551
|
+
direction
|
|
2552
|
+
},
|
|
2553
|
+
...targetComponentsMap
|
|
2554
|
+
}
|
|
2555
|
+
);
|
|
2556
|
+
Promise.resolve().then(
|
|
2557
|
+
() => event.dropEndCallback && event.dropEndCallback({
|
|
2558
|
+
x: event.x,
|
|
2559
|
+
y: event.y,
|
|
2560
|
+
containerName
|
|
2561
|
+
})
|
|
2562
|
+
);
|
|
2563
|
+
}
|
|
2564
|
+
};
|
|
2565
|
+
const currentComponents = getCurrentSplitScreenComponents(
|
|
2566
|
+
rootName,
|
|
2567
|
+
`${layoutName}=${screenKey}`
|
|
2568
|
+
);
|
|
2569
|
+
const afterList = handleRemove(
|
|
2570
|
+
currentComponents?.afterDropTargetComponent || afterDropTargetComponent,
|
|
2571
|
+
event.targetContainerName,
|
|
2572
|
+
() => removeCallback("after")
|
|
2573
|
+
);
|
|
2574
|
+
const beforList = handleRemove(
|
|
2575
|
+
currentComponents?.beforeDropTargetComponent || beforeDropTargetComponent,
|
|
2576
|
+
event.targetContainerName,
|
|
2577
|
+
() => removeCallback("before")
|
|
2578
|
+
);
|
|
2579
|
+
const centerList = handleRemove(
|
|
2580
|
+
currentComponents?.centerDropTargetComponent || centerDropTargetComponent,
|
|
2581
|
+
event.targetContainerName,
|
|
2582
|
+
() => removeCallback("center")
|
|
2583
|
+
);
|
|
2584
|
+
setSplitScreen(
|
|
2585
|
+
rootName,
|
|
2586
|
+
`${layoutName}=${screenKey}`,
|
|
2587
|
+
{
|
|
2588
|
+
afterDropTargetComponent: afterList,
|
|
2589
|
+
beforeDropTargetComponent: beforList,
|
|
2590
|
+
centerDropTargetComponent: centerList,
|
|
2591
|
+
direction
|
|
2592
|
+
}
|
|
2593
|
+
);
|
|
2594
|
+
});
|
|
2595
|
+
}
|
|
2596
|
+
} else if (event.state === "append") {
|
|
2597
|
+
const {
|
|
2598
|
+
x,
|
|
2599
|
+
y,
|
|
2600
|
+
dropEndCallback,
|
|
2601
|
+
dropTargetComponentEvent,
|
|
2602
|
+
orderName,
|
|
2603
|
+
targetLayoutName,
|
|
2604
|
+
targetParentLayoutName,
|
|
2605
|
+
targetContainerName,
|
|
2606
|
+
targetComponent,
|
|
2607
|
+
nextContainerName,
|
|
2608
|
+
parentOrderName
|
|
2609
|
+
} = event;
|
|
2610
|
+
if (layoutRef.current && orderName && x && y && dropTargetComponentEvent && isInnerDrop({ x, y, element: layoutRef.current })) {
|
|
2611
|
+
const {
|
|
2612
|
+
direction: dropDirection,
|
|
2613
|
+
navigationTitle,
|
|
2614
|
+
dropDocumentOutsideOption,
|
|
2615
|
+
screenKey: containerScreenKey
|
|
2616
|
+
} = dropTargetComponentEvent;
|
|
2617
|
+
if (
|
|
2618
|
+
//orderName !== 'center' &&
|
|
2619
|
+
targetLayoutName === layoutName && targetComponent
|
|
2620
|
+
) {
|
|
2621
|
+
if (dropDirection === parentDirection && orderName !== "center") {
|
|
2622
|
+
dropMovementEventSubject.next({
|
|
2623
|
+
state: "append",
|
|
2624
|
+
targetContainerName,
|
|
2625
|
+
targetParentLayoutName: "",
|
|
2626
|
+
targetLayoutName: parentLayoutName,
|
|
2627
|
+
targetComponent,
|
|
2628
|
+
nextContainerName: containerName,
|
|
2629
|
+
parentOrderName: getSelfOrderName(layoutName) || orderName,
|
|
2630
|
+
orderName,
|
|
2631
|
+
x,
|
|
2632
|
+
y,
|
|
2633
|
+
dropEndCallback,
|
|
2634
|
+
dropTargetComponentEvent: {
|
|
2635
|
+
navigationTitle,
|
|
2636
|
+
dropDocumentOutsideOption,
|
|
2637
|
+
direction: parentDirection,
|
|
2638
|
+
screenKey
|
|
2639
|
+
}
|
|
2640
|
+
});
|
|
2641
|
+
} else {
|
|
2642
|
+
if (orderName !== "center") {
|
|
2643
|
+
setDirection(dropDirection);
|
|
2644
|
+
setIsSplit(true);
|
|
2645
|
+
}
|
|
2646
|
+
const targetComponentsMap = handleUpdateDropTargetComponents({
|
|
2647
|
+
orderName,
|
|
2648
|
+
parentOrderName,
|
|
2649
|
+
containerName: targetContainerName,
|
|
2650
|
+
nextContainerName,
|
|
2651
|
+
parentLayoutName,
|
|
2652
|
+
layoutName,
|
|
2653
|
+
dropComponent: targetComponent,
|
|
2654
|
+
navigationTitle,
|
|
2655
|
+
isUsePrefix: orderName !== "center",
|
|
2656
|
+
afterDropTargetComponent,
|
|
2657
|
+
beforeDropTargetComponent,
|
|
2658
|
+
centerDropTargetComponent,
|
|
2659
|
+
dropDocumentOutsideOption
|
|
2660
|
+
});
|
|
2661
|
+
setSplitScreen(
|
|
2662
|
+
rootName,
|
|
2663
|
+
`${layoutName}=${screenKey}`,
|
|
2664
|
+
{
|
|
2665
|
+
...getCurrentSplitScreenComponents(
|
|
2666
|
+
rootName,
|
|
2667
|
+
`${layoutName}=${screenKey}`
|
|
2668
|
+
) || {
|
|
2669
|
+
afterDropTargetComponent,
|
|
2670
|
+
beforeDropTargetComponent,
|
|
2671
|
+
centerDropTargetComponent,
|
|
2672
|
+
direction
|
|
2673
|
+
},
|
|
2674
|
+
...targetComponentsMap,
|
|
2675
|
+
...{ direction: dropDirection }
|
|
2676
|
+
}
|
|
2677
|
+
);
|
|
2678
|
+
Promise.resolve().then(
|
|
2679
|
+
() => event.dropEndCallback && event.dropEndCallback({
|
|
2680
|
+
x: event.x,
|
|
2681
|
+
y: event.y,
|
|
2682
|
+
containerName
|
|
2683
|
+
})
|
|
2684
|
+
);
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2689
|
+
});
|
|
2690
|
+
return () => {
|
|
2691
|
+
subscribe.unsubscribe();
|
|
2692
|
+
};
|
|
2693
|
+
}, [
|
|
2694
|
+
direction,
|
|
2695
|
+
parentDirection,
|
|
2696
|
+
parentLayoutName,
|
|
2697
|
+
layoutName,
|
|
2698
|
+
beforeDropTargetComponent,
|
|
2699
|
+
afterDropTargetComponent,
|
|
2700
|
+
centerDropTargetComponent
|
|
2701
|
+
]);
|
|
2702
|
+
react.useEffect(() => {
|
|
2703
|
+
centerDropTargetComponentRef.current = centerDropTargetComponent;
|
|
2704
|
+
}, [centerDropTargetComponent]);
|
|
2705
|
+
react.useEffect(() => {
|
|
2706
|
+
activeIndexRef.current = activeIndex;
|
|
2707
|
+
}, [activeIndex]);
|
|
2708
|
+
const [isOnlyOneScreen, setIsOnlyOneScreen] = react.useState(false);
|
|
2709
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: !isEmptyContent && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2710
|
+
"div",
|
|
2711
|
+
{
|
|
2712
|
+
className: `${FlexLayout_default["flex-split-screen"]}`,
|
|
2713
|
+
ref: layoutRef,
|
|
2714
|
+
children: [
|
|
2715
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2716
|
+
FlexLayout_default2,
|
|
2717
|
+
{
|
|
2718
|
+
direction,
|
|
2719
|
+
layoutName: `${layoutName}`,
|
|
2720
|
+
panelMovementMode: "bulldozer",
|
|
2721
|
+
children: [
|
|
2722
|
+
beforeDropTargetComponent.length != 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: beforeDropTargetComponent.map(
|
|
2723
|
+
({
|
|
2724
|
+
containerName: cName,
|
|
2725
|
+
component,
|
|
2726
|
+
navigationTitle,
|
|
2727
|
+
dropDocumentOutsideOption,
|
|
2728
|
+
screenKey: screenKey2
|
|
2729
|
+
}, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2730
|
+
FlexLayoutContainer_default,
|
|
2731
|
+
{
|
|
2732
|
+
containerName: cName,
|
|
2733
|
+
isInitialResizable: true,
|
|
2734
|
+
isResizePanel: true,
|
|
2735
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2736
|
+
FlexLayoutSplitScreenChild,
|
|
2737
|
+
{
|
|
2738
|
+
parentDirection: direction,
|
|
2739
|
+
layoutName: `${layoutName}_before-${depth}`,
|
|
2740
|
+
parentLayoutName: layoutName,
|
|
2741
|
+
containerName: cName,
|
|
2742
|
+
depth: depth + 1,
|
|
2743
|
+
rootRef,
|
|
2744
|
+
screenKey: screenKey2,
|
|
2745
|
+
initialCenterComponents: [
|
|
2746
|
+
{
|
|
2747
|
+
navigationTitle,
|
|
2748
|
+
component,
|
|
2749
|
+
containerName: cName,
|
|
2750
|
+
dropDocumentOutsideOption,
|
|
2751
|
+
screenKey: screenKey2
|
|
2752
|
+
}
|
|
2753
|
+
],
|
|
2754
|
+
rootName
|
|
2755
|
+
}
|
|
2756
|
+
)
|
|
2757
|
+
},
|
|
2758
|
+
cName
|
|
2759
|
+
)
|
|
2760
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx("div", {}),
|
|
2761
|
+
centerDropTargetComponent.length != 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2762
|
+
FlexLayoutContainer_default,
|
|
2763
|
+
{
|
|
2764
|
+
containerName: `${(centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName}`,
|
|
2765
|
+
isInitialResizable: true,
|
|
2766
|
+
isResizePanel: isSplit,
|
|
2767
|
+
children: isSplit ? /* @__PURE__ */ jsxRuntime.jsx("div", { "data-key": screenKey, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2768
|
+
FlexLayoutSplitScreenChild,
|
|
2769
|
+
{
|
|
2770
|
+
parentDirection: direction,
|
|
2771
|
+
layoutName: `${layoutName}_center-${depth}`,
|
|
2772
|
+
parentLayoutName: layoutName,
|
|
2773
|
+
containerName: `${(centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName}`,
|
|
2774
|
+
depth: depth + 1,
|
|
2775
|
+
rootRef,
|
|
2776
|
+
initialCenterComponents: centerDropTargetComponent.map(
|
|
2777
|
+
({
|
|
2778
|
+
navigationTitle,
|
|
2779
|
+
component,
|
|
2780
|
+
containerName: cName,
|
|
2781
|
+
dropDocumentOutsideOption,
|
|
2782
|
+
screenKey: centerScreenKey
|
|
2783
|
+
}) => ({
|
|
2784
|
+
navigationTitle,
|
|
2785
|
+
component,
|
|
2786
|
+
containerName: cName,
|
|
2787
|
+
dropDocumentOutsideOption,
|
|
2788
|
+
screenKey: centerScreenKey
|
|
2789
|
+
})
|
|
2790
|
+
),
|
|
2791
|
+
screenKey,
|
|
2792
|
+
rootName
|
|
2793
|
+
}
|
|
2794
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2795
|
+
FlexLayoutSplitScreenScrollBox_default,
|
|
2796
|
+
{
|
|
2797
|
+
keyName: (centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName,
|
|
2798
|
+
isDefaultScrollStyle: true,
|
|
2799
|
+
children: [
|
|
2800
|
+
!isOnlyOneScreen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2801
|
+
"div",
|
|
2802
|
+
{
|
|
2803
|
+
className: `${FlexLayout_default["flex-split-screen-drag-box-title-wrapper-sticky"]}`,
|
|
2804
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2805
|
+
"div",
|
|
2806
|
+
{
|
|
2807
|
+
"data-is_split": isSplit,
|
|
2808
|
+
"data-layout_name": layoutName,
|
|
2809
|
+
"data-parent_layout_name": parentLayoutName,
|
|
2810
|
+
"data-container_name": `${(centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName}`,
|
|
2811
|
+
className: `${FlexLayout_default["flex-split-screen-drag-box-title-wrapper"]}`,
|
|
2812
|
+
children: [
|
|
2813
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2814
|
+
FlexLayoutSplitScreenDragBoxContainer,
|
|
2815
|
+
{
|
|
2816
|
+
"data-layout_name": layoutName,
|
|
2817
|
+
layoutName,
|
|
2818
|
+
children: centerDropTargetComponent.map(
|
|
2819
|
+
(item, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2820
|
+
FlexLayoutSplitScreenDragBoxItem,
|
|
2821
|
+
{
|
|
2822
|
+
onClose: (ev) => {
|
|
2823
|
+
if (activeIndexRef.current === index && centerDropTargetComponent.length === 1) {
|
|
2824
|
+
dropMovementEventSubject.next(
|
|
2825
|
+
{
|
|
2826
|
+
state: "remove",
|
|
2827
|
+
targetContainerName: containerName,
|
|
2828
|
+
targetParentLayoutName: parentLayoutName,
|
|
2829
|
+
targetLayoutName: layoutName
|
|
2830
|
+
}
|
|
2831
|
+
);
|
|
2832
|
+
} else {
|
|
2833
|
+
if (centerDropTargetComponent.length === activeIndexRef.current + 1) {
|
|
2834
|
+
setActiveIndex(
|
|
2835
|
+
activeIndexRef.current - 1
|
|
2836
|
+
);
|
|
2837
|
+
}
|
|
2838
|
+
setCenterDropTargetComponent(
|
|
2839
|
+
(prev) => {
|
|
2840
|
+
const result = handleRemove(
|
|
2841
|
+
prev,
|
|
2842
|
+
item.containerName,
|
|
2843
|
+
() => {
|
|
2844
|
+
}
|
|
2845
|
+
);
|
|
2846
|
+
return result;
|
|
2847
|
+
}
|
|
2848
|
+
);
|
|
2849
|
+
}
|
|
2850
|
+
},
|
|
2851
|
+
isActive: activeIndex === index,
|
|
2852
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2853
|
+
FlexLayoutSplitScreenDragBox,
|
|
2854
|
+
{
|
|
2855
|
+
onClick: () => {
|
|
2856
|
+
setActiveIndex(
|
|
2857
|
+
index
|
|
2858
|
+
);
|
|
2859
|
+
},
|
|
2860
|
+
containerName: item.containerName,
|
|
2861
|
+
dropDocumentOutsideOption: item.dropDocumentOutsideOption,
|
|
2862
|
+
targetComponent: item.component,
|
|
2863
|
+
navigationTitle: item.navigationTitle,
|
|
2864
|
+
"data-container-name": item.containerName,
|
|
2865
|
+
"data-layout-name": layoutName,
|
|
2866
|
+
"data-parent-layout-name": parentLayoutName,
|
|
2867
|
+
dropEndCallback: ({
|
|
2868
|
+
x,
|
|
2869
|
+
y,
|
|
2870
|
+
containerName: appendContainerName
|
|
2871
|
+
}) => {
|
|
2872
|
+
if (!rootRef.current || !layoutRef.current)
|
|
2873
|
+
return;
|
|
2874
|
+
const isRootOver = isOverDrop(
|
|
2875
|
+
{
|
|
2876
|
+
x,
|
|
2877
|
+
y,
|
|
2878
|
+
element: rootRef.current
|
|
2879
|
+
}
|
|
2880
|
+
);
|
|
2881
|
+
const isLayoutInner = isInnerDrop(
|
|
2882
|
+
{
|
|
2883
|
+
x,
|
|
2884
|
+
y,
|
|
2885
|
+
element: layoutRef.current
|
|
2886
|
+
}
|
|
2887
|
+
);
|
|
2888
|
+
if (!isRootOver && !isLayoutInner || !isRootOver && isLayoutInner && centerDropTargetComponentRef.current.length > 1) {
|
|
2889
|
+
const option = {};
|
|
2890
|
+
if (centerDropTargetComponentRef.current.length > 1) {
|
|
2891
|
+
const {
|
|
2892
|
+
adjacentItem,
|
|
2893
|
+
adjacentIndex
|
|
2894
|
+
} = getAdjacentItem(
|
|
2895
|
+
centerDropTargetComponentRef.current,
|
|
2896
|
+
activeIndexRef.current
|
|
2897
|
+
);
|
|
2898
|
+
if (adjacentItem && activeIndexRef.current === index) {
|
|
2899
|
+
Object.assign(
|
|
2900
|
+
option,
|
|
2901
|
+
{
|
|
2902
|
+
x,
|
|
2903
|
+
y,
|
|
2904
|
+
targetComponent: adjacentItem.component,
|
|
2905
|
+
nextContainerName: adjacentItem.containerName,
|
|
2906
|
+
orderName: "center",
|
|
2907
|
+
dropTargetComponentEvent: {
|
|
2908
|
+
navigationTitle: adjacentItem.navigationTitle,
|
|
2909
|
+
dropDocumentOutsideOption: adjacentItem.dropDocumentOutsideOption,
|
|
2910
|
+
direction,
|
|
2911
|
+
screenKey
|
|
2912
|
+
}
|
|
2913
|
+
}
|
|
2914
|
+
);
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
if (index === 0) {
|
|
2918
|
+
dropMovementEventSubject.next(
|
|
2919
|
+
{
|
|
2920
|
+
state: "remove",
|
|
2921
|
+
targetContainerName: item.containerName,
|
|
2922
|
+
targetParentLayoutName: parentLayoutName,
|
|
2923
|
+
targetLayoutName: layoutName,
|
|
2924
|
+
...option
|
|
2925
|
+
}
|
|
2926
|
+
);
|
|
2927
|
+
} else {
|
|
2928
|
+
dropMovementEventSubject.next(
|
|
2929
|
+
{
|
|
2930
|
+
state: "remove",
|
|
2931
|
+
targetContainerName: item.containerName,
|
|
2932
|
+
targetParentLayoutName: "",
|
|
2933
|
+
targetLayoutName: layoutName,
|
|
2934
|
+
...option
|
|
2935
|
+
}
|
|
2936
|
+
);
|
|
2937
|
+
}
|
|
2938
|
+
}
|
|
2939
|
+
},
|
|
2940
|
+
children: item.navigationTitle
|
|
2941
|
+
}
|
|
2942
|
+
)
|
|
2943
|
+
},
|
|
2944
|
+
item.navigationTitle + layoutName + item.containerName
|
|
2945
|
+
)
|
|
2946
|
+
)
|
|
2947
|
+
},
|
|
2948
|
+
layoutName
|
|
2949
|
+
),
|
|
2950
|
+
/* @__PURE__ */ jsxRuntime.jsx(FlexLayoutSplitScreenDragBoxTitleMore, {})
|
|
2951
|
+
]
|
|
2952
|
+
}
|
|
2953
|
+
)
|
|
2954
|
+
}
|
|
2955
|
+
),
|
|
2956
|
+
(() => {
|
|
2957
|
+
const target = centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0];
|
|
2958
|
+
return target.component;
|
|
2959
|
+
})()
|
|
2960
|
+
]
|
|
2961
|
+
}
|
|
2962
|
+
)
|
|
2963
|
+
},
|
|
2964
|
+
(centerDropTargetComponent[activeIndex] || centerDropTargetComponent[0]).containerName
|
|
2965
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx("div", {}),
|
|
2966
|
+
afterDropTargetComponent.length != 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: afterDropTargetComponent.map(
|
|
2967
|
+
({
|
|
2968
|
+
containerName: cName,
|
|
2969
|
+
component,
|
|
2970
|
+
navigationTitle,
|
|
2971
|
+
dropDocumentOutsideOption,
|
|
2972
|
+
screenKey: screenKey2
|
|
2973
|
+
}, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2974
|
+
FlexLayoutContainer_default,
|
|
2975
|
+
{
|
|
2976
|
+
containerName: cName,
|
|
2977
|
+
isInitialResizable: true,
|
|
2978
|
+
isResizePanel: i !== afterDropTargetComponent.length - 1,
|
|
2979
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2980
|
+
FlexLayoutSplitScreenChild,
|
|
2981
|
+
{
|
|
2982
|
+
parentDirection: direction,
|
|
2983
|
+
layoutName: `${layoutName}_after-${depth}`,
|
|
2984
|
+
parentLayoutName: layoutName,
|
|
2985
|
+
containerName: cName,
|
|
2986
|
+
depth: depth + 1,
|
|
2987
|
+
rootRef,
|
|
2988
|
+
screenKey: screenKey2,
|
|
2989
|
+
initialCenterComponents: [
|
|
2990
|
+
{
|
|
2991
|
+
navigationTitle,
|
|
2992
|
+
component,
|
|
2993
|
+
containerName: cName,
|
|
2994
|
+
dropDocumentOutsideOption,
|
|
2995
|
+
screenKey: screenKey2
|
|
2996
|
+
}
|
|
2997
|
+
],
|
|
2998
|
+
rootName
|
|
2999
|
+
}
|
|
3000
|
+
)
|
|
3001
|
+
},
|
|
3002
|
+
cName
|
|
3003
|
+
)
|
|
3004
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx("div", {})
|
|
3005
|
+
]
|
|
3006
|
+
}
|
|
3007
|
+
),
|
|
3008
|
+
boundaryContainerSize && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3009
|
+
"div",
|
|
3010
|
+
{
|
|
3011
|
+
className: `${FlexLayout_default["flex-split-screen-boundary-container"]}`,
|
|
3012
|
+
style: { ...boundaryContainerSize },
|
|
3013
|
+
children: "\u2B07\uFE0F\uB4DC\uB86D\uD558\uBA74 \uD654\uBA74\uC774 \uBD84\uD560\uB429\uB2C8\uB2E4."
|
|
3014
|
+
}
|
|
3015
|
+
)
|
|
3016
|
+
]
|
|
3017
|
+
}
|
|
3018
|
+
) });
|
|
3019
|
+
}
|
|
3020
|
+
FlexLayoutSplitScreen.displayName = "FlexLayoutSplitScreen";
|
|
3021
|
+
var FlexLayoutSplitScreen_default = FlexLayoutSplitScreen;
|
|
3022
|
+
function clamp(n, min, max) {
|
|
3023
|
+
return Math.max(min, Math.min(max, n));
|
|
3024
|
+
}
|
|
3025
|
+
function pickDefaultScrollRoot() {
|
|
3026
|
+
if (typeof document === "undefined") return null;
|
|
3027
|
+
let el = document.body;
|
|
3028
|
+
while (el && el !== document.documentElement && el !== document.body) {
|
|
3029
|
+
const style = getComputedStyle(el);
|
|
3030
|
+
const oy = style.overflowY;
|
|
3031
|
+
const ox = style.overflowX;
|
|
3032
|
+
const scrollable = oy === "auto" || oy === "scroll" || ox === "auto" || ox === "scroll";
|
|
3033
|
+
if (scrollable) return el;
|
|
3034
|
+
el = el.parentElement;
|
|
3035
|
+
}
|
|
3036
|
+
return null;
|
|
3037
|
+
}
|
|
3038
|
+
function isVerticalScroll(root) {
|
|
3039
|
+
if (typeof window == "undefined") return true;
|
|
3040
|
+
if (!root) {
|
|
3041
|
+
return document.documentElement.scrollHeight > window.innerHeight + 1;
|
|
3042
|
+
}
|
|
3043
|
+
const el = root;
|
|
3044
|
+
return el.scrollHeight > el.clientHeight + 1;
|
|
3045
|
+
}
|
|
3046
|
+
var dpr = typeof window != "undefined" ? window.devicePixelRatio || 1 : 1;
|
|
3047
|
+
function quantizeToDevicePixel(n) {
|
|
3048
|
+
return Math.round(n * dpr) / dpr;
|
|
3049
|
+
}
|
|
3050
|
+
var FlexLayoutStickyBox = ({
|
|
3051
|
+
edge = "auto",
|
|
3052
|
+
offset = 16,
|
|
3053
|
+
scrollRoot = null,
|
|
3054
|
+
debug = false,
|
|
3055
|
+
children,
|
|
3056
|
+
style,
|
|
3057
|
+
className,
|
|
3058
|
+
onTranslateChange = () => {
|
|
3059
|
+
},
|
|
3060
|
+
...rest
|
|
3061
|
+
}) => {
|
|
3062
|
+
const offsetRef = react.useRef(offset);
|
|
3063
|
+
const rootRef = react.useRef(null);
|
|
3064
|
+
const contentRef = react.useRef(null);
|
|
3065
|
+
const mutatingRef = react.useRef(false);
|
|
3066
|
+
const lastOffsetRef = react.useRef(0);
|
|
3067
|
+
const [resolvedEdge, setResolvedEdge] = react.useState("top");
|
|
3068
|
+
const rafId = react.useRef(null);
|
|
3069
|
+
const [contentDynamicStyle, setContentDynamicStyle] = react.useState({});
|
|
3070
|
+
react.useEffect(() => {
|
|
3071
|
+
setContentDynamicStyle({
|
|
3072
|
+
willChange: "transform",
|
|
3073
|
+
transition: "transform 50ms linear"
|
|
3074
|
+
});
|
|
3075
|
+
}, []);
|
|
3076
|
+
react.useEffect(() => {
|
|
3077
|
+
offsetRef.current = offset;
|
|
3078
|
+
scheduleUpdate();
|
|
3079
|
+
}, [offset]);
|
|
3080
|
+
const [ioRoot, setIoRoot] = react.useState(null);
|
|
3081
|
+
react.useEffect(() => {
|
|
3082
|
+
const root = scrollRoot ?? pickDefaultScrollRoot();
|
|
3083
|
+
setResolvedEdge(
|
|
3084
|
+
edge === "auto" ? isVerticalScroll(root) ? "top" : "left" : edge
|
|
3085
|
+
);
|
|
3086
|
+
setIoRoot(root);
|
|
3087
|
+
}, [edge, scrollRoot]);
|
|
3088
|
+
react.useEffect(() => {
|
|
3089
|
+
if (edge !== "auto") {
|
|
3090
|
+
setResolvedEdge(edge);
|
|
3091
|
+
return;
|
|
3092
|
+
}
|
|
3093
|
+
const vertical = isVerticalScroll(ioRoot);
|
|
3094
|
+
setResolvedEdge(vertical ? "top" : "left");
|
|
3095
|
+
}, [edge, ioRoot]);
|
|
3096
|
+
react.useEffect(() => {
|
|
3097
|
+
}, []);
|
|
3098
|
+
const scheduleUpdate = () => {
|
|
3099
|
+
if (rafId.current != null) return;
|
|
3100
|
+
rafId.current = requestAnimationFrame(() => {
|
|
3101
|
+
rafId.current = null;
|
|
3102
|
+
doUpdate();
|
|
3103
|
+
});
|
|
3104
|
+
};
|
|
3105
|
+
const doUpdate = () => {
|
|
3106
|
+
if (mutatingRef.current) return;
|
|
3107
|
+
mutatingRef.current = true;
|
|
3108
|
+
const rootEl = rootRef.current;
|
|
3109
|
+
const contentEl = contentRef.current;
|
|
3110
|
+
if (!rootEl || !contentEl) {
|
|
3111
|
+
mutatingRef.current = false;
|
|
3112
|
+
return;
|
|
3113
|
+
}
|
|
3114
|
+
const parentEl = rootEl.parentElement;
|
|
3115
|
+
if (!parentEl) {
|
|
3116
|
+
mutatingRef.current = false;
|
|
3117
|
+
return;
|
|
3118
|
+
}
|
|
3119
|
+
const rootBounds = ioRoot && "getBoundingClientRect" in ioRoot ? ioRoot.getBoundingClientRect() : new DOMRect(0, 0, window.innerWidth, window.innerHeight);
|
|
3120
|
+
const parentRect = parentEl.getBoundingClientRect();
|
|
3121
|
+
const contentRect = contentEl.getBoundingClientRect();
|
|
3122
|
+
let newOffset = 0;
|
|
3123
|
+
if (resolvedEdge === "top" || resolvedEdge === "bottom") {
|
|
3124
|
+
const maxTranslate = Math.max(
|
|
3125
|
+
0,
|
|
3126
|
+
parentRect.height - contentRect.height
|
|
3127
|
+
);
|
|
3128
|
+
let desiredTop = 0;
|
|
3129
|
+
if (resolvedEdge === "top") {
|
|
3130
|
+
desiredTop = rootBounds.top + offsetRef.current - parentRect.top;
|
|
3131
|
+
} else {
|
|
3132
|
+
const targetBottomFromParentTop = Math.min(
|
|
3133
|
+
parentRect.bottom,
|
|
3134
|
+
rootBounds.bottom - offsetRef.current
|
|
3135
|
+
) - parentRect.top;
|
|
3136
|
+
desiredTop = targetBottomFromParentTop - contentRect.height;
|
|
3137
|
+
}
|
|
3138
|
+
newOffset = clamp(desiredTop, 0, maxTranslate);
|
|
3139
|
+
} else {
|
|
3140
|
+
const maxTranslate = Math.max(
|
|
3141
|
+
0,
|
|
3142
|
+
parentRect.width - contentRect.width
|
|
3143
|
+
);
|
|
3144
|
+
let desiredLeft = 0;
|
|
3145
|
+
if (resolvedEdge === "left") {
|
|
3146
|
+
desiredLeft = rootBounds.left + offsetRef.current - parentRect.left;
|
|
3147
|
+
} else {
|
|
3148
|
+
const targetRightFromParentLeft = Math.min(
|
|
3149
|
+
parentRect.right,
|
|
3150
|
+
rootBounds.right - offsetRef.current
|
|
3151
|
+
) - parentRect.left;
|
|
3152
|
+
desiredLeft = targetRightFromParentLeft - contentRect.width;
|
|
3153
|
+
}
|
|
3154
|
+
newOffset = clamp(desiredLeft, 0, maxTranslate);
|
|
3155
|
+
}
|
|
3156
|
+
const nextOffset = quantizeToDevicePixel(newOffset);
|
|
3157
|
+
if (Math.abs(lastOffsetRef.current - nextOffset) > 0.5) {
|
|
3158
|
+
if (resolvedEdge === "top" || resolvedEdge === "bottom") {
|
|
3159
|
+
contentEl.style.transform = `translateY(${nextOffset}px)`;
|
|
3160
|
+
} else {
|
|
3161
|
+
contentEl.style.transform = `translateX(${nextOffset}px)`;
|
|
3162
|
+
}
|
|
3163
|
+
lastOffsetRef.current = nextOffset;
|
|
3164
|
+
onTranslateChange(nextOffset, rootRef, contentRef);
|
|
3165
|
+
}
|
|
3166
|
+
if (debug) {
|
|
3167
|
+
rootEl.style.outline = "1px dashed rgba(0,0,0,.2)";
|
|
3168
|
+
contentEl.style.outline = "1px solid rgba(0,128,255,.35)";
|
|
3169
|
+
}
|
|
3170
|
+
queueMicrotask(() => {
|
|
3171
|
+
mutatingRef.current = false;
|
|
3172
|
+
});
|
|
3173
|
+
};
|
|
3174
|
+
react.useEffect(() => {
|
|
3175
|
+
if (typeof window == "undefined") return;
|
|
3176
|
+
const rootEl = rootRef.current;
|
|
3177
|
+
if (!rootEl) return;
|
|
3178
|
+
const parentEl = rootEl.parentElement;
|
|
3179
|
+
console.log(parentEl);
|
|
3180
|
+
if (!parentEl) return;
|
|
3181
|
+
const targets = [parentEl];
|
|
3182
|
+
const observerCallback = () => {
|
|
3183
|
+
if (!mutatingRef.current) scheduleUpdate();
|
|
3184
|
+
};
|
|
3185
|
+
const io = new IntersectionObserver(observerCallback, {
|
|
3186
|
+
root: ioRoot instanceof Element ? ioRoot : null,
|
|
3187
|
+
threshold: 0,
|
|
3188
|
+
rootMargin: "1px"
|
|
3189
|
+
});
|
|
3190
|
+
const ro = new ResizeObserver(observerCallback);
|
|
3191
|
+
targets.forEach((t) => io.observe(t));
|
|
3192
|
+
ro.observe(parentEl);
|
|
3193
|
+
if (contentRef.current) {
|
|
3194
|
+
ro.observe(contentRef.current);
|
|
3195
|
+
}
|
|
3196
|
+
const scrollTarget = ioRoot || window;
|
|
3197
|
+
scrollTarget.addEventListener("scroll", scheduleUpdate, {
|
|
3198
|
+
passive: true
|
|
3199
|
+
});
|
|
3200
|
+
window.addEventListener("resize", scheduleUpdate);
|
|
3201
|
+
scheduleUpdate();
|
|
3202
|
+
return () => {
|
|
3203
|
+
io.disconnect();
|
|
3204
|
+
ro.disconnect();
|
|
3205
|
+
scrollTarget.removeEventListener("scroll", scheduleUpdate);
|
|
3206
|
+
window.removeEventListener("resize", scheduleUpdate);
|
|
3207
|
+
if (rafId.current != null) {
|
|
3208
|
+
cancelAnimationFrame(rafId.current);
|
|
3209
|
+
rafId.current = null;
|
|
3210
|
+
}
|
|
3211
|
+
};
|
|
3212
|
+
}, [ioRoot, resolvedEdge, offset, debug]);
|
|
3213
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3214
|
+
"div",
|
|
3215
|
+
{
|
|
3216
|
+
ref: rootRef,
|
|
3217
|
+
className,
|
|
3218
|
+
style: {
|
|
3219
|
+
display: "block",
|
|
3220
|
+
minWidth: 0,
|
|
3221
|
+
minHeight: 0,
|
|
3222
|
+
height: "100%",
|
|
3223
|
+
// 부모 높이를 채우도록 설정
|
|
3224
|
+
...style
|
|
3225
|
+
},
|
|
3226
|
+
...rest,
|
|
3227
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3228
|
+
"div",
|
|
3229
|
+
{
|
|
3230
|
+
ref: contentRef,
|
|
3231
|
+
style: contentDynamicStyle,
|
|
3232
|
+
children
|
|
3233
|
+
}
|
|
3234
|
+
)
|
|
3235
|
+
}
|
|
3236
|
+
);
|
|
3237
|
+
};
|
|
3238
|
+
var FlexLayoutStickyBox_default = FlexLayoutStickyBox;
|
|
3239
|
+
var useListPagingForSentinel = ({
|
|
3240
|
+
//initPageNumber,
|
|
3241
|
+
//initPageSize,
|
|
3242
|
+
onReachTerminal
|
|
3243
|
+
}) => {
|
|
3244
|
+
const [firstChildNode, setFirstChildNode] = react.useState(null);
|
|
3245
|
+
const [lastChildNode, setLastChildNode] = react.useState(null);
|
|
3246
|
+
const observerRef = react.useRef(null);
|
|
3247
|
+
const firstChildRef = react.useCallback((node) => {
|
|
3248
|
+
setFirstChildNode(node);
|
|
3249
|
+
}, []);
|
|
3250
|
+
const lastChildRef = react.useCallback((node) => {
|
|
3251
|
+
setLastChildNode(node);
|
|
3252
|
+
}, []);
|
|
3253
|
+
react.useEffect(() => {
|
|
3254
|
+
if (firstChildNode && observerRef.current)
|
|
3255
|
+
observerRef.current.unobserve(firstChildNode);
|
|
3256
|
+
if (lastChildNode && observerRef.current)
|
|
3257
|
+
observerRef.current.unobserve(lastChildNode);
|
|
3258
|
+
const handleIntersect = (entries, observer2) => {
|
|
3259
|
+
entries.forEach((entry) => {
|
|
3260
|
+
if (entry.isIntersecting) {
|
|
3261
|
+
if (entry.target === firstChildNode) {
|
|
3262
|
+
if (onReachTerminal)
|
|
3263
|
+
onReachTerminal({
|
|
3264
|
+
isFirst: true,
|
|
3265
|
+
isLast: false,
|
|
3266
|
+
observer: observer2
|
|
3267
|
+
});
|
|
3268
|
+
}
|
|
3269
|
+
if (entry.target === lastChildNode) {
|
|
3270
|
+
if (onReachTerminal)
|
|
3271
|
+
onReachTerminal({
|
|
3272
|
+
isFirst: false,
|
|
3273
|
+
isLast: true,
|
|
3274
|
+
observer: observer2
|
|
3275
|
+
});
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
});
|
|
3279
|
+
};
|
|
3280
|
+
const observer = new IntersectionObserver(handleIntersect, {
|
|
3281
|
+
threshold: 0.1
|
|
3282
|
+
});
|
|
3283
|
+
observerRef.current = observer;
|
|
3284
|
+
if (firstChildNode) observer.observe(firstChildNode);
|
|
3285
|
+
if (lastChildNode) observer.observe(lastChildNode);
|
|
3286
|
+
return () => {
|
|
3287
|
+
if (observerRef.current) {
|
|
3288
|
+
observerRef.current.disconnect();
|
|
3289
|
+
}
|
|
3290
|
+
};
|
|
3291
|
+
}, [firstChildNode, lastChildNode]);
|
|
3292
|
+
return {
|
|
3293
|
+
firstChildRef,
|
|
3294
|
+
lastChildRef
|
|
3295
|
+
};
|
|
3296
|
+
};
|
|
3297
|
+
var usePaginationViewNumber = ({
|
|
3298
|
+
initPageNumber
|
|
3299
|
+
}) => {
|
|
3300
|
+
const [showCurrentPageNumber, setShowCurrentPageNumber] = react.useState(initPageNumber);
|
|
3301
|
+
const observerRef = react.useRef(null);
|
|
3302
|
+
const showCurrentPageObserveTarget = react.useCallback(
|
|
3303
|
+
(node) => {
|
|
3304
|
+
if (!node) return;
|
|
3305
|
+
if (!observerRef.current) {
|
|
3306
|
+
observerRef.current = new IntersectionObserver(
|
|
3307
|
+
(entries) => {
|
|
3308
|
+
entries.forEach((entry) => {
|
|
3309
|
+
if (entry.isIntersecting) {
|
|
3310
|
+
const pageIndexAttr = entry.target.getAttribute(
|
|
3311
|
+
"data-page-index"
|
|
3312
|
+
);
|
|
3313
|
+
if (!pageIndexAttr) return;
|
|
3314
|
+
const pageIndex = parseInt(pageIndexAttr, 10);
|
|
3315
|
+
setShowCurrentPageNumber(pageIndex);
|
|
3316
|
+
}
|
|
3317
|
+
});
|
|
3318
|
+
},
|
|
3319
|
+
{
|
|
3320
|
+
threshold: 0.1
|
|
3321
|
+
// 예: 10% 이상 보여야 intersect로 판단
|
|
3322
|
+
}
|
|
3323
|
+
);
|
|
3324
|
+
}
|
|
3325
|
+
observerRef.current.observe(node);
|
|
3326
|
+
},
|
|
3327
|
+
[]
|
|
3328
|
+
);
|
|
3329
|
+
react.useEffect(() => {
|
|
3330
|
+
const currentObserver = observerRef.current;
|
|
3331
|
+
return () => {
|
|
3332
|
+
if (currentObserver) {
|
|
3333
|
+
currentObserver.disconnect();
|
|
3334
|
+
}
|
|
3335
|
+
};
|
|
3336
|
+
}, []);
|
|
3337
|
+
return {
|
|
3338
|
+
showCurrentPageNumber,
|
|
3339
|
+
showCurrentPageObserveTarget
|
|
3340
|
+
};
|
|
3341
|
+
};
|
|
3342
|
+
var usePagingHandler = ({
|
|
3343
|
+
lastCallPageNumber,
|
|
3344
|
+
dataListRef
|
|
3345
|
+
}) => {
|
|
3346
|
+
const jumpingPageNumberRef = react.useRef(lastCallPageNumber);
|
|
3347
|
+
react.useEffect(() => {
|
|
3348
|
+
if (jumpingPageNumberRef.current) {
|
|
3349
|
+
setTimeout(() => {
|
|
3350
|
+
jumpingPageNumberRef.current = null;
|
|
3351
|
+
}, 1e3);
|
|
3352
|
+
}
|
|
3353
|
+
}, [jumpingPageNumberRef]);
|
|
3354
|
+
const paginationScrollIntoViewTarget = react.useRef({});
|
|
3355
|
+
const pageNumberRef = react.useRef(lastCallPageNumber);
|
|
3356
|
+
const setPaginationRef = react.useCallback(
|
|
3357
|
+
(i) => (node) => {
|
|
3358
|
+
if (!node) return;
|
|
3359
|
+
paginationScrollIntoViewTarget.current[i] = node;
|
|
3360
|
+
if (jumpingPageNumberRef.current !== null && i === jumpingPageNumberRef.current) {
|
|
3361
|
+
node.scrollIntoView({
|
|
3362
|
+
behavior: "instant",
|
|
3363
|
+
// 필요한 경우 'smooth' 등으로 수정 가능
|
|
3364
|
+
block: "start"
|
|
3365
|
+
});
|
|
3366
|
+
jumpingPageNumberRef.current = null;
|
|
3367
|
+
}
|
|
3368
|
+
},
|
|
3369
|
+
[]
|
|
3370
|
+
);
|
|
3371
|
+
const handleReachTerminal = ({ isFirst, isLast, observer }, dataCallFetch) => {
|
|
3372
|
+
if (dataListRef.current.length === 0) return;
|
|
3373
|
+
if (jumpingPageNumberRef.current != null) return;
|
|
3374
|
+
if (!isFirst && !isLast) return;
|
|
3375
|
+
const callPageNumber = isFirst ? Math.max(pageNumberRef.current - 1, 0) : pageNumberRef.current + 1;
|
|
3376
|
+
if (dataListRef.current[callPageNumber] != null && (dataListRef.current[callPageNumber]?.length || 0) > 0)
|
|
3377
|
+
return;
|
|
3378
|
+
jumpingPageNumberRef.current = callPageNumber;
|
|
3379
|
+
setTimeout(() => {
|
|
3380
|
+
jumpingPageNumberRef.current = null;
|
|
3381
|
+
}, 1e3);
|
|
3382
|
+
dataCallFetch(callPageNumber);
|
|
3383
|
+
};
|
|
3384
|
+
const handleClickPageChange = (page, dataCallFetch) => {
|
|
3385
|
+
const pageData = dataListRef.current[page];
|
|
3386
|
+
if (pageData != null && Array.isArray(pageData) && pageData.length > 0) {
|
|
3387
|
+
paginationScrollIntoViewTarget.current[page]?.scrollIntoView({
|
|
3388
|
+
behavior: "smooth",
|
|
3389
|
+
block: "start"
|
|
3390
|
+
});
|
|
3391
|
+
return;
|
|
3392
|
+
}
|
|
3393
|
+
jumpingPageNumberRef.current = page;
|
|
3394
|
+
setTimeout(() => {
|
|
3395
|
+
jumpingPageNumberRef.current = null;
|
|
3396
|
+
}, 1e3);
|
|
3397
|
+
dataCallFetch(page);
|
|
3398
|
+
};
|
|
3399
|
+
return {
|
|
3400
|
+
jumpingPageNumberRef,
|
|
3401
|
+
paginationScrollIntoViewTarget,
|
|
3402
|
+
pageNumberRef,
|
|
3403
|
+
setPaginationRef,
|
|
3404
|
+
handleReachTerminal,
|
|
3405
|
+
handleClickPageChange
|
|
3406
|
+
};
|
|
3407
|
+
};
|
|
819
3408
|
|
|
820
3409
|
exports.ContainerOpenCloseProvider = ContainerOpenCloseProvider;
|
|
3410
|
+
exports.FlexLayout = FlexLayout_default2;
|
|
3411
|
+
exports.FlexLayoutContainer = FlexLayoutContainer_default;
|
|
3412
|
+
exports.FlexLayoutResizePanel = FlexLayoutResizePanel_default;
|
|
3413
|
+
exports.FlexLayoutSplitScreen = FlexLayoutSplitScreen_default;
|
|
3414
|
+
exports.FlexLayoutSplitScreenDragBox = FlexLayoutSplitScreenDragBox;
|
|
3415
|
+
exports.FlexLayoutSplitScreenScrollBox = FlexLayoutSplitScreenScrollBox_default;
|
|
3416
|
+
exports.FlexLayoutStickyBox = FlexLayoutStickyBox_default;
|
|
821
3417
|
exports.allSplitScreenCount = allSplitScreenCount;
|
|
822
3418
|
exports.closeFlex = closeFlex;
|
|
823
3419
|
exports.containerOpenCloseSubjectMap = containerOpenCloseSubjectMap;
|
|
@@ -861,5 +3457,8 @@ exports.useDragCapture = useDragCapture;
|
|
|
861
3457
|
exports.useDragEvents = useDragEvents;
|
|
862
3458
|
exports.useFolderEvent = useFolderEvent;
|
|
863
3459
|
exports.useLayoutName = useLayoutName;
|
|
3460
|
+
exports.useListPagingForSentinel = useListPagingForSentinel;
|
|
3461
|
+
exports.usePaginationViewNumber = usePaginationViewNumber;
|
|
3462
|
+
exports.usePagingHandler = usePagingHandler;
|
|
864
3463
|
//# sourceMappingURL=index.cjs.map
|
|
865
3464
|
//# sourceMappingURL=index.cjs.map
|