Files
vexplor_dev/frontend/lib/registry/components/v2-input/V2InputRenderer.tsx
kjs 3e19218382 feat: 테이블 관리 페이지의 컬럼 설정 저장 로직 개선
- 컬럼의 detailSettings을 동적으로 계산하여 다양한 입력 타입에 맞는 설정을 포함하도록 수정하였습니다.
- Numbering, Entity, Code 타입에 대한 추가 설정을 detailSettings에 포함시켜 데이터 저장 시 유연성을 높였습니다.
- V2Input 컴포넌트에서 채번 규칙 ID를 formData에 저장하는 기능을 추가하여 데이터 처리의 일관성을 강화하였습니다.
- 레이아웃 변환 함수에 메타데이터를 포함하여 레이아웃 정보를 더욱 풍부하게 하였습니다.
2026-02-03 11:02:13 +09:00

79 lines
2.6 KiB
TypeScript

"use client";
import React from "react";
import { AutoRegisteringComponentRenderer } from "../../AutoRegisteringComponentRenderer";
import { V2InputDefinition } from "./index";
import { V2Input } from "@/components/v2/V2Input";
/**
* V2Input 렌더러
* 자동 등록 시스템을 사용하여 컴포넌트를 레지스트리에 등록
*/
export class V2InputRenderer extends AutoRegisteringComponentRenderer {
static componentDefinition = V2InputDefinition;
render(): React.ReactElement {
const { component, formData, onFormDataChange, isDesignMode, isSelected, isInteractive, ...restProps } = this.props;
// 컴포넌트 설정 추출
const config = component.componentConfig || component.config || {};
const columnName = component.columnName;
const tableName = component.tableName || this.props.tableName;
// formData에서 현재 값 가져오기
const currentValue = formData?.[columnName] ?? component.value ?? "";
// 값 변경 핸들러
const handleChange = (value: any) => {
if (isInteractive && onFormDataChange && columnName) {
onFormDataChange(columnName, value);
}
};
// 라벨: style.labelText 우선, 없으면 component.label 사용
// style.labelDisplay가 false면 라벨 숨김
const style = component.style || {};
const effectiveLabel = style.labelDisplay === false ? undefined : (style.labelText || component.label);
return (
<V2Input
id={component.id}
label={effectiveLabel}
required={component.required}
readonly={config.readonly || component.readonly}
disabled={config.disabled || component.disabled}
value={currentValue}
onChange={handleChange}
onFormDataChange={onFormDataChange}
config={{
type: config.inputType || config.webType || "text",
inputType: config.inputType || config.webType || "text",
placeholder: config.placeholder,
format: config.format,
min: config.min,
max: config.max,
step: config.step,
rows: config.rows,
autoGeneration: config.autoGeneration || component.autoGeneration,
}}
style={component.style}
size={component.size}
formData={formData}
columnName={columnName}
tableName={tableName}
autoGeneration={config.autoGeneration || component.autoGeneration}
originalData={(this.props as any).originalData}
{...restProps}
/>
);
}
}
// 자동 등록 실행
V2InputRenderer.registerSelf();
// Hot Reload 지원 (개발 모드)
if (process.env.NODE_ENV === "development") {
V2InputRenderer.enableHotReload();
}