feat(repeat-screen-modal): 자유 레이아웃 구현 및 데이터 전달 버그 수정

- contentRows 기반 자유 레이아웃 지원 (header/aggregation/table/fields 타입)
- aggregationFields, tableColumns 직접 참조하도록 렌더링 로직 수정
- groupByField 없어도 grouping.enabled면 그룹핑 모드로 처리
- buttonActions에서 selectedRowsData를 모달 이벤트로 전달
- ScreenModal에서 selectedData를 groupedData props로 컴포넌트에 전달
- types.ts에 CardContentRowConfig, AggregationDisplayConfig 인터페이스 추가
This commit is contained in:
SeongHyun Kim
2025-11-28 16:02:29 +09:00
parent c94b9da813
commit 36ab484029
11 changed files with 2035 additions and 868 deletions

View File

@@ -1,132 +1 @@
/**
* SimpleRepeaterTable 컴포넌트 타입 정의
* 데이터 검색/추가 없이 주어진 데이터를 표시하고 편집하는 경량 테이블
*/
export interface SimpleRepeaterTableProps {
// 데이터
value?: any[]; // 현재 표시할 데이터
onChange?: (newData: any[]) => void; // 데이터 변경 콜백
// 테이블 설정
columns: SimpleRepeaterColumnConfig[]; // 테이블 컬럼 설정
// 🆕 초기 데이터 로드 설정
initialDataConfig?: InitialDataConfig;
// 계산 규칙
calculationRules?: CalculationRule[]; // 자동 계산 규칙 (수량 * 단가 = 금액)
// 옵션
readOnly?: boolean; // 읽기 전용 모드 (편집 불가)
showRowNumber?: boolean; // 행 번호 표시 (기본: true)
allowDelete?: boolean; // 삭제 버튼 표시 (기본: true)
maxHeight?: string; // 테이블 최대 높이 (기본: "240px")
// 스타일
className?: string;
}
export interface SimpleRepeaterColumnConfig {
field: string; // 필드명 (화면에 표시용 임시 키)
label: string; // 컬럼 헤더 라벨
type?: "text" | "number" | "date" | "select"; // 입력 타입
editable?: boolean; // 편집 가능 여부
calculated?: boolean; // 계산 필드 여부 (자동 계산되는 필드)
width?: string; // 컬럼 너비
required?: boolean; // 필수 입력 여부
defaultValue?: any; // 기본값
selectOptions?: { value: string; label: string }[]; // select일 때 옵션
// 🆕 데이터 조회 설정 (어디서 가져올지)
sourceConfig?: ColumnSourceConfig;
// 🆕 데이터 저장 설정 (어디에 저장할지)
targetConfig?: ColumnTargetConfig;
}
/**
* 🆕 데이터 조회 설정
* 어떤 테이블에서 어떤 컬럼을 어떤 조건으로 조회할지 정의
*/
export interface ColumnSourceConfig {
/** 조회 타입 */
type: "direct" | "join" | "manual";
// type: "direct" - 직접 조회 (단일 테이블에서 바로 가져오기)
sourceTable?: string; // 조회할 테이블 (예: "sales_order_mng")
sourceColumn?: string; // 조회할 컬럼 (예: "item_name")
// type: "join" - 조인 조회 (다른 테이블과 조인하여 가져오기)
joinTable?: string; // 조인할 테이블 (예: "customer_item_mapping")
joinColumn?: string; // 조인 테이블에서 가져올 컬럼 (예: "basic_price")
joinKey?: string; // 🆕 조인 키 (현재 테이블의 컬럼, 예: "sales_order_id")
joinRefKey?: string; // 🆕 참조 키 (조인 테이블의 컬럼, 예: "id")
joinConditions?: SourceJoinCondition[]; // 조인 조건 (어떤 키로 조인할지)
// type: "manual" - 사용자 직접 입력 (조회 안 함)
}
/**
* 🆕 데이터 저장 설정
* 어떤 테이블의 어떤 컬럼에 저장할지 정의
*/
export interface ColumnTargetConfig {
targetTable?: string; // 저장할 테이블 (예: "shipment_plan")
targetColumn?: string; // 저장할 컬럼 (예: "plan_qty")
saveEnabled?: boolean; // 저장 활성화 여부 (false면 읽기 전용)
}
/**
* 🆕 소스 조인 조건
* 데이터를 조회할 때 어떤 키로 조인할지 정의
*/
export interface SourceJoinCondition {
/** 기준 테이블 */
baseTable: string; // 기준이 되는 테이블 (예: "sales_order_mng")
/** 기준 컬럼 */
baseColumn: string; // 기준 테이블의 컬럼 (예: "item_code")
/** 조인 테이블의 컬럼 */
joinColumn: string; // 조인 테이블에서 매칭할 컬럼 (예: "item_code")
/** 비교 연산자 */
operator?: "=" | "!=" | ">" | "<" | ">=" | "<=";
}
/**
* 🆕 초기 데이터 로드 설정
* 컴포넌트가 로드될 때 어떤 데이터를 가져올지
*/
export interface InitialDataConfig {
/** 로드할 테이블 */
sourceTable: string; // 예: "sales_order_mng"
/** 필터 조건 */
filterConditions?: DataFilterCondition[];
/** 선택할 컬럼 목록 */
selectColumns?: string[];
}
/**
* 데이터 필터 조건
*/
export interface DataFilterCondition {
/** 필드명 */
field: string;
/** 연산자 */
operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "LIKE" | "IN";
/** 값 (또는 다른 필드 참조) */
value: any;
/** 값을 다른 필드에서 가져올지 */
valueFromField?: string; // 예: "order_no" (formData에서 가져오기)
}
/**
* 계산 규칙 (자동 계산)
*/
export interface CalculationRule {
result: string; // 결과를 저장할 필드 (예: "total_amount")
formula: string; // 계산 공식 (예: "quantity * unit_price")
dependencies: string[]; // 의존하는 필드들 (예: ["quantity", "unit_price"])
}