화면 분할 패널 기능
This commit is contained in:
@@ -27,6 +27,8 @@ export function ConditionalSectionViewer({
|
||||
onFormDataChange,
|
||||
groupedData, // 🆕 그룹 데이터
|
||||
onSave, // 🆕 EditModal의 handleSave 콜백
|
||||
controlField, // 🆕 조건부 컨테이너의 제어 필드명
|
||||
selectedCondition, // 🆕 현재 선택된 조건 값
|
||||
}: ConditionalSectionViewerProps) {
|
||||
const { userId, userName, user } = useAuth();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
@@ -34,6 +36,24 @@ export function ConditionalSectionViewer({
|
||||
const [screenInfo, setScreenInfo] = useState<{ id: number; tableName?: string } | null>(null);
|
||||
const [screenResolution, setScreenResolution] = useState<{ width: number; height: number } | null>(null);
|
||||
|
||||
// 🆕 조건 값을 포함한 formData 생성
|
||||
const enhancedFormData = React.useMemo(() => {
|
||||
const base = formData || {};
|
||||
|
||||
// 조건부 컨테이너의 현재 선택 값을 formData에 포함
|
||||
if (controlField && selectedCondition) {
|
||||
return {
|
||||
...base,
|
||||
[controlField]: selectedCondition,
|
||||
__conditionalContainerValue: selectedCondition,
|
||||
__conditionalContainerLabel: label,
|
||||
__conditionalContainerControlField: controlField, // 🆕 제어 필드명도 포함
|
||||
};
|
||||
}
|
||||
|
||||
return base;
|
||||
}, [formData, controlField, selectedCondition, label]);
|
||||
|
||||
// 화면 로드
|
||||
useEffect(() => {
|
||||
if (!screenId) {
|
||||
@@ -154,18 +174,18 @@ export function ConditionalSectionViewer({
|
||||
}}
|
||||
>
|
||||
<DynamicComponentRenderer
|
||||
component={component}
|
||||
component={component}
|
||||
isInteractive={true}
|
||||
screenId={screenInfo?.id}
|
||||
tableName={screenInfo?.tableName}
|
||||
userId={userId}
|
||||
userName={userName}
|
||||
companyCode={user?.companyCode}
|
||||
formData={formData}
|
||||
onFormDataChange={onFormDataChange}
|
||||
screenId={screenInfo?.id}
|
||||
tableName={screenInfo?.tableName}
|
||||
userId={userId}
|
||||
userName={userName}
|
||||
companyCode={user?.companyCode}
|
||||
formData={enhancedFormData}
|
||||
onFormDataChange={onFormDataChange}
|
||||
groupedData={groupedData}
|
||||
onSave={onSave}
|
||||
/>
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user