렉 구조등록 컴포넌트
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { AutoRegisteringComponentRenderer } from "../../AutoRegisteringComponentRenderer";
|
||||
import { RackStructureDefinition } from "./index";
|
||||
import { RackStructureComponent } from "./RackStructureComponent";
|
||||
import { GeneratedLocation } from "./types";
|
||||
|
||||
/**
|
||||
* 렉 구조 설정 렌더러
|
||||
* 자동 등록 시스템을 사용하여 컴포넌트를 레지스트리에 등록
|
||||
*/
|
||||
export class RackStructureRenderer extends AutoRegisteringComponentRenderer {
|
||||
static componentDefinition = RackStructureDefinition;
|
||||
|
||||
render(): React.ReactElement {
|
||||
const { formData, isPreview, config } = this.props as any;
|
||||
|
||||
return (
|
||||
<RackStructureComponent
|
||||
config={config || {}}
|
||||
formData={formData} // formData 전달 (필드 매핑에서 사용)
|
||||
onChange={this.handleLocationsChange}
|
||||
isPreview={isPreview}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 생성된 위치 데이터 변경 핸들러
|
||||
*/
|
||||
protected handleLocationsChange = (locations: GeneratedLocation[]) => {
|
||||
// 생성된 위치 데이터를 formData에 저장
|
||||
this.updateComponent({ generatedLocations: locations });
|
||||
};
|
||||
}
|
||||
|
||||
// 자동 등록 실행
|
||||
RackStructureRenderer.registerSelf();
|
||||
|
||||
// Hot Reload 지원 (개발 모드)
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
RackStructureRenderer.enableHotReload();
|
||||
}
|
||||
Reference in New Issue
Block a user