feat: enhance split panel and tab component interactions

- Improved the drop handling logic for split panels and tabs, prioritizing the innermost container during drag-and-drop operations.
- Added internal state management for selected components within split panels to enhance user experience.
- Updated the rendering logic to ensure proper data attributes are set for design mode, facilitating better component identification.
- Enhanced the dynamic component rendering to support updates and selections for nested components within tabs and split panels.

Made-with: Cursor
This commit is contained in:
kjs
2026-03-12 09:49:17 +09:00
parent b1e50f2e0a
commit 014979bebf
9 changed files with 481 additions and 400 deletions

View File

@@ -20,7 +20,6 @@ import {
GeneratedLocation,
RackStructureContext,
} from "./types";
import { applyLocationPattern, DEFAULT_CODE_PATTERN, DEFAULT_NAME_PATTERN } from "./patternUtils";
// 기존 위치 데이터 타입
interface ExistingLocation {
@@ -513,27 +512,23 @@ export const RackStructureComponent: React.FC<RackStructureComponentProps> = ({
return { totalLocations, totalRows, maxLevel };
}, [conditions]);
// 위치 코드 생성 (패턴 기반)
// 위치 코드 생성
const generateLocationCode = useCallback(
(row: number, level: number): { code: string; name: string } => {
const vars = {
warehouse: context?.warehouseCode || "WH001",
warehouseName: context?.warehouseName || "",
floor: context?.floor || "1",
zone: context?.zone || "A",
row,
level,
};
const warehouseCode = context?.warehouseCode || "WH001";
const floor = context?.floor || "1";
const zone = context?.zone || "A";
const codePattern = config.codePattern || DEFAULT_CODE_PATTERN;
const namePattern = config.namePattern || DEFAULT_NAME_PATTERN;
// 코드 생성 (예: WH001-1층D구역-01-1)
const code = `${warehouseCode}-${floor}${zone}-${row.toString().padStart(2, "0")}-${level}`;
return {
code: applyLocationPattern(codePattern, vars),
name: applyLocationPattern(namePattern, vars),
};
// 이름 생성 - zone에 이미 "구역"이 포함되어 있으면 그대로 사용
const zoneName = zone.includes("구역") ? zone : `${zone}구역`;
const name = `${zoneName}-${row.toString().padStart(2, "0")}열-${level}`;
return { code, name };
},
[context, config.codePattern, config.namePattern],
[context],
);
// 미리보기 생성