diff --git a/frontend/lib/registry/components/button-primary/ButtonPrimaryComponent.tsx b/frontend/lib/registry/components/button-primary/ButtonPrimaryComponent.tsx index d79d926f..f311c035 100644 --- a/frontend/lib/registry/components/button-primary/ButtonPrimaryComponent.tsx +++ b/frontend/lib/registry/components/button-primary/ButtonPrimaryComponent.tsx @@ -296,6 +296,32 @@ export const ButtonPrimaryComponent: React.FC = ({ return false; }, [component.componentConfig?.action, formData, vehicleStatus, statusLoading, component.label]); + // ๐Ÿ†• modalDataStore์—์„œ ์„ ํƒ๋œ ๋ฐ์ดํ„ฐ ํ™•์ธ (๋ถ„ํ•  ํŒจ๋„ ๋“ฑ์—์„œ ์ €์žฅ๋จ) + const [modalStoreData, setModalStoreData] = useState>({}); + + // modalDataStore ์ƒํƒœ ๊ตฌ๋… (์‹ค์‹œ๊ฐ„ ์—…๋ฐ์ดํŠธ) + useEffect(() => { + const actionConfig = component.componentConfig?.action; + if (!actionConfig?.requireRowSelection) return; + + // ๋™์  import๋กœ modalDataStore ๊ตฌ๋… + let unsubscribe: (() => void) | undefined; + + import("@/stores/modalDataStore").then(({ useModalDataStore }) => { + // ์ดˆ๊ธฐ๊ฐ’ ์„ค์ • + setModalStoreData(useModalDataStore.getState().dataRegistry); + + // ์ƒํƒœ ๋ณ€๊ฒฝ ๊ตฌ๋… + unsubscribe = useModalDataStore.subscribe((state) => { + setModalStoreData(state.dataRegistry); + }); + }); + + return () => { + unsubscribe?.(); + }; + }, [component.componentConfig?.action?.requireRowSelection]); + // ๐Ÿ†• ํ–‰ ์„ ํƒ ๊ธฐ๋ฐ˜ ๋น„ํ™œ์„ฑํ™” ์กฐ๊ฑด ๊ณ„์‚ฐ const isRowSelectionDisabled = useMemo(() => { const actionConfig = component.componentConfig?.action; @@ -311,43 +337,76 @@ export const ButtonPrimaryComponent: React.FC = ({ // ์„ ํƒ๋œ ๋ฐ์ดํ„ฐ ํ™•์ธ let hasSelection = false; let selectionCount = 0; + let selectionSource = ""; - // 1. ์ž๋™ ๊ฐ์ง€ ๋ชจ๋“œ ๋˜๋Š” ํŠน์ • ์†Œ์Šค ๋ชจ๋“œ + // 1. ์ž๋™ ๊ฐ์ง€ ๋ชจ๋“œ ๋˜๋Š” ํ…Œ์ด๋ธ” ๋ฆฌ์ŠคํŠธ ๋ชจ๋“œ if (rowSelectionSource === "auto" || rowSelectionSource === "tableList") { // TableList์—์„œ ์„ ํƒ๋œ ํ–‰ ํ™•์ธ (props๋กœ ์ „๋‹ฌ๋จ) if (selectedRowsData && selectedRowsData.length > 0) { hasSelection = true; selectionCount = selectedRowsData.length; + selectionSource = "tableList (selectedRowsData)"; } // ๋˜๋Š” selectedRows prop ํ™•์ธ else if (selectedRows && selectedRows.length > 0) { hasSelection = true; selectionCount = selectedRows.length; + selectionSource = "tableList (selectedRows)"; } } + // 2. ๋ถ„ํ•  ํŒจ๋„ ์ขŒ์ธก ์„ ํƒ ๋ฐ์ดํ„ฐ ํ™•์ธ if (rowSelectionSource === "auto" || rowSelectionSource === "splitPanelLeft") { - // ๋ถ„ํ•  ํŒจ๋„ ์ขŒ์ธก ์„ ํƒ ๋ฐ์ดํ„ฐ ํ™•์ธ - if (!hasSelection && splitPanelContext?.selectedLeftData) { - hasSelection = true; - selectionCount = 1; + // SplitPanelContext์—์„œ ํ™•์ธ + if (splitPanelContext?.selectedLeftData && Object.keys(splitPanelContext.selectedLeftData).length > 0) { + if (!hasSelection) { + hasSelection = true; + selectionCount = 1; + selectionSource = "splitPanelLeft (context)"; + } + } + + // ๐Ÿ†• modalDataStore์—์„œ๋„ ํ™•์ธ (SplitPanelLayoutComponent์—์„œ ์ €์žฅ) + if (!hasSelection && Object.keys(modalStoreData).length > 0) { + // modalDataStore์—์„œ ๋ฐ์ดํ„ฐ๊ฐ€ ์žˆ๋Š”์ง€ ํ™•์ธ + for (const [sourceId, items] of Object.entries(modalStoreData)) { + if (items && items.length > 0) { + hasSelection = true; + selectionCount = items.length; + selectionSource = `modalDataStore (${sourceId})`; + break; + } + } } } + // 3. ํ”Œ๋กœ์šฐ ์œ„์ ฏ ์„ ํƒ ๋ฐ์ดํ„ฐ ํ™•์ธ if (rowSelectionSource === "auto" || rowSelectionSource === "flowWidget") { // ํ”Œ๋กœ์šฐ ์œ„์ ฏ ์„ ํƒ ๋ฐ์ดํ„ฐ ํ™•์ธ if (!hasSelection && flowSelectedData && flowSelectedData.length > 0) { hasSelection = true; selectionCount = flowSelectedData.length; + selectionSource = "flowWidget"; } } + // ๋””๋ฒ„๊น… ๋กœ๊ทธ + console.log("๐Ÿ” [ButtonPrimary] ํ–‰ ์„ ํƒ ์ฒดํฌ:", component.label, { + rowSelectionSource, + hasSelection, + selectionCount, + selectionSource, + hasSplitPanelContext: !!splitPanelContext, + selectedLeftData: splitPanelContext?.selectedLeftData, + selectedRowsData: selectedRowsData?.length, + selectedRows: selectedRows?.length, + flowSelectedData: flowSelectedData?.length, + modalStoreDataKeys: Object.keys(modalStoreData), + }); + // ์„ ํƒ๋œ ๋ฐ์ดํ„ฐ๊ฐ€ ์—†์œผ๋ฉด ๋น„ํ™œ์„ฑํ™” if (!hasSelection) { - console.log("๐Ÿšซ [ButtonPrimary] ํ–‰ ์„ ํƒ ํ•„์š” โ†’ ๋น„ํ™œ์„ฑํ™”:", component.label, { - rowSelectionSource, - hasSelection, - }); + console.log("๐Ÿšซ [ButtonPrimary] ํ–‰ ์„ ํƒ ํ•„์š” โ†’ ๋น„ํ™œ์„ฑํ™”:", component.label); return true; } @@ -362,7 +421,7 @@ export const ButtonPrimaryComponent: React.FC = ({ console.log("โœ… [ButtonPrimary] ํ–‰ ์„ ํƒ ์กฐ๊ฑด ์ถฉ์กฑ:", component.label, { selectionCount, - rowSelectionSource, + selectionSource, }); return false; }, [ @@ -372,6 +431,8 @@ export const ButtonPrimaryComponent: React.FC = ({ selectedRowsData, splitPanelContext?.selectedLeftData, flowSelectedData, + splitPanelContext, + modalStoreData, ]); // ํ™•์ธ ๋‹ค์ด์–ผ๋กœ๊ทธ ์ƒํƒœ diff --git a/frontend/lib/registry/components/split-panel-layout/SplitPanelLayoutComponent.tsx b/frontend/lib/registry/components/split-panel-layout/SplitPanelLayoutComponent.tsx index ef91a23d..bfb26c90 100644 --- a/frontend/lib/registry/components/split-panel-layout/SplitPanelLayoutComponent.tsx +++ b/frontend/lib/registry/components/split-panel-layout/SplitPanelLayoutComponent.tsx @@ -2030,14 +2030,14 @@ export const SplitPanelLayoutComponent: React.FC className="border-border flex flex-shrink-0 flex-col border-r" > -
@@ -2521,14 +2521,14 @@ export const SplitPanelLayoutComponent: React.FC className="flex flex-shrink-0 flex-col" > -