Merge branch 'jskim-node' of http://39.117.244.52:3000/kjs/ERP-node into gbpark-node
; Please enter a commit message to explain why this merge is necessary, ; especially if it merges an updated upstream into a topic branch. ; ; Lines starting with ';' will be ignored, and an empty message aborts ; the commit.
This commit is contained in:
@@ -2062,6 +2062,7 @@ export default function ScreenDesigner({
|
||||
await screenApi.saveLayoutV2(selectedScreen.screenId, {
|
||||
...v2Layout,
|
||||
layerId: currentLayerId,
|
||||
mainTableName: currentMainTableName, // 화면의 기본 테이블 (DB 업데이트용)
|
||||
});
|
||||
} else {
|
||||
await screenApi.saveLayout(selectedScreen.screenId, layoutWithResolution);
|
||||
|
||||
@@ -114,8 +114,7 @@ export function ComponentsPanel({
|
||||
"image-display", // → v2-media (image)
|
||||
// 공통코드관리로 통합 예정
|
||||
"category-manager", // → 공통코드관리 기능으로 통합 예정
|
||||
// 분할 패널 정리 (split-panel-layout v1 유지)
|
||||
"split-panel-layout2", // → split-panel-layout로 통합
|
||||
// 분할 패널 정리
|
||||
"screen-split-panel", // 화면 임베딩 방식은 사용하지 않음
|
||||
// 미완성/미사용 컴포넌트 (기존 화면 호환성 유지, 새 추가만 막음)
|
||||
"accordion-basic", // 아코디언 컴포넌트
|
||||
|
||||
@@ -44,6 +44,11 @@ interface EntityJoinTable {
|
||||
tableName: string;
|
||||
currentDisplayColumn: string;
|
||||
availableColumns: EntityJoinColumn[];
|
||||
// 같은 테이블이 여러 FK로 조인될 수 있으므로 소스 컬럼으로 구분
|
||||
joinConfig?: {
|
||||
sourceColumn: string;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
}
|
||||
|
||||
interface TablesPanelProps {
|
||||
@@ -414,7 +419,11 @@ export const TablesPanel: React.FC<TablesPanelProps> = ({
|
||||
</Badge>
|
||||
</div>
|
||||
|
||||
{entityJoinTables.map((joinTable) => {
|
||||
{entityJoinTables.map((joinTable, idx) => {
|
||||
// 같은 테이블이 여러 FK로 조인될 수 있으므로 sourceColumn으로 고유 키 생성
|
||||
const uniqueKey = joinTable.joinConfig?.sourceColumn
|
||||
? `entity-join-${joinTable.tableName}-${joinTable.joinConfig.sourceColumn}`
|
||||
: `entity-join-${joinTable.tableName}-${idx}`;
|
||||
const isExpanded = expandedJoinTables.has(joinTable.tableName);
|
||||
// 검색어로 필터링
|
||||
const filteredColumns = searchTerm
|
||||
@@ -431,8 +440,7 @@ export const TablesPanel: React.FC<TablesPanelProps> = ({
|
||||
}
|
||||
|
||||
return (
|
||||
// 엔티티 조인 테이블에 고유 접두사 추가 (메인 테이블과 키 중복 방지)
|
||||
<div key={`entity-join-${joinTable.tableName}`} className="space-y-1">
|
||||
<div key={uniqueKey} className="space-y-1">
|
||||
{/* 조인 테이블 헤더 */}
|
||||
<div
|
||||
className="flex cursor-pointer items-center justify-between rounded-md bg-cyan-50 p-2 hover:bg-cyan-100"
|
||||
|
||||
@@ -135,8 +135,27 @@ export function TabsWidget({
|
||||
const [screenLayouts, setScreenLayouts] = useState<Record<string, ComponentData[]>>({});
|
||||
const [screenLoadingStates, setScreenLoadingStates] = useState<Record<string, boolean>>({});
|
||||
const [screenErrors, setScreenErrors] = useState<Record<string, string>>({});
|
||||
// 탭별 화면 정보 (screenId, tableName) 저장
|
||||
const [screenInfoMap, setScreenInfoMap] = useState<Record<string, { id: number; tableName?: string }>>({});
|
||||
// 탭별 화면 정보 (screenId, tableName) - 인라인 컴포넌트의 테이블 설정에서 추출
|
||||
const screenInfoMap = React.useMemo(() => {
|
||||
const map: Record<string, { id?: number; tableName?: string }> = {};
|
||||
for (const tab of tabs as ExtendedTabItem[]) {
|
||||
const inlineComponents = tab.components || [];
|
||||
if (inlineComponents.length > 0) {
|
||||
// 인라인 컴포넌트에서 테이블 컴포넌트의 selectedTable 추출
|
||||
const tableComp = inlineComponents.find(
|
||||
(c) => c.componentType === "v2-table-list" || c.componentType === "table-list",
|
||||
);
|
||||
const selectedTable = tableComp?.componentConfig?.selectedTable;
|
||||
if (selectedTable || tab.screenId) {
|
||||
map[tab.id] = {
|
||||
id: tab.screenId,
|
||||
tableName: selectedTable,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}, [tabs]);
|
||||
|
||||
// 컴포넌트 탭 목록 변경 시 동기화
|
||||
useEffect(() => {
|
||||
@@ -157,21 +176,10 @@ export function TabsWidget({
|
||||
) {
|
||||
setScreenLoadingStates((prev) => ({ ...prev, [tab.id]: true }));
|
||||
try {
|
||||
// 레이아웃과 화면 정보를 병렬로 로드
|
||||
const [layoutData, screenDef] = await Promise.all([
|
||||
screenApi.getLayout(extTab.screenId),
|
||||
screenApi.getScreen(extTab.screenId),
|
||||
]);
|
||||
const layoutData = await screenApi.getLayout(extTab.screenId);
|
||||
if (layoutData && layoutData.components) {
|
||||
setScreenLayouts((prev) => ({ ...prev, [tab.id]: layoutData.components }));
|
||||
}
|
||||
// 탭의 화면 정보 저장 (tableName 포함)
|
||||
if (screenDef) {
|
||||
setScreenInfoMap((prev) => ({
|
||||
...prev,
|
||||
[tab.id]: { id: extTab.screenId!, tableName: screenDef.tableName },
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`탭 "${tab.label}" 화면 로드 실패:`, error);
|
||||
setScreenErrors((prev) => ({ ...prev, [tab.id]: "화면을 불러올 수 없습니다." }));
|
||||
@@ -185,31 +193,6 @@ export function TabsWidget({
|
||||
loadScreenLayouts();
|
||||
}, [visibleTabs, screenLayouts, screenLoadingStates]);
|
||||
|
||||
// screenInfoMap이 없는 탭의 화면 정보 보충 로드
|
||||
// screenId가 있지만 screenInfoMap에 아직 없는 탭의 화면 정보를 로드
|
||||
useEffect(() => {
|
||||
const loadMissingScreenInfo = async () => {
|
||||
for (const tab of visibleTabs) {
|
||||
const extTab = tab as ExtendedTabItem;
|
||||
// screenId가 있고 screenInfoMap에 아직 없는 경우 로드
|
||||
if (extTab.screenId && !screenInfoMap[tab.id]) {
|
||||
try {
|
||||
const screenDef = await screenApi.getScreen(extTab.screenId);
|
||||
if (screenDef) {
|
||||
setScreenInfoMap((prev) => ({
|
||||
...prev,
|
||||
[tab.id]: { id: extTab.screenId!, tableName: screenDef.tableName },
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`탭 "${tab.label}" 화면 정보 로드 실패:`, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
loadMissingScreenInfo();
|
||||
}, [visibleTabs, screenInfoMap]);
|
||||
|
||||
// 선택된 탭 변경 시 localStorage에 저장 + ActiveTab Context 업데이트
|
||||
useEffect(() => {
|
||||
if (persistSelection && typeof window !== "undefined") {
|
||||
|
||||
Reference in New Issue
Block a user