78 lines
2.7 KiB
TypeScript
78 lines
2.7 KiB
TypeScript
import React from "react";
|
|
import { WidgetComponent } from "@/types/screen";
|
|
|
|
// 웹타입 정의 인터페이스
|
|
export interface WebTypeDefinition {
|
|
webType: string; // 웹타입 식별자
|
|
name: string; // 표시명
|
|
nameEng?: string; // 영문명
|
|
description?: string; // 설명
|
|
category: string; // 카테고리 (input, select, display, special)
|
|
defaultConfig?: any; // 기본 설정
|
|
validationRules?: any; // 유효성 검사 규칙
|
|
defaultStyle?: any; // 기본 스타일
|
|
inputProperties?: any; // HTML input 속성
|
|
component: React.ComponentType<WebTypeComponentProps>; // 렌더링 컴포넌트
|
|
configPanel?: React.ComponentType<WebTypeConfigPanelProps>; // 설정 패널 컴포넌트
|
|
icon?: React.ComponentType<{ className?: string }>; // 아이콘 컴포넌트
|
|
sortOrder?: number; // 정렬 순서
|
|
isActive?: boolean; // 활성화 여부
|
|
}
|
|
|
|
// 웹타입 컴포넌트 프로퍼티
|
|
export interface WebTypeComponentProps {
|
|
component: WidgetComponent;
|
|
value?: any;
|
|
onChange?: (value: any) => void;
|
|
readonly?: boolean;
|
|
className?: string;
|
|
style?: React.CSSProperties;
|
|
[key: string]: any;
|
|
}
|
|
|
|
// 웹타입 설정 패널 프로퍼티
|
|
export interface WebTypeConfigPanelProps {
|
|
component: WidgetComponent;
|
|
onUpdateComponent: (updates: Partial<WidgetComponent>) => void;
|
|
onUpdateProperty?: (key: string, value: any) => void;
|
|
}
|
|
|
|
// 버튼 액션 정의 인터페이스
|
|
export interface ButtonActionDefinition {
|
|
actionType: string; // 액션 타입 식별자
|
|
name: string; // 표시명
|
|
nameEng?: string; // 영문명
|
|
description?: string; // 설명
|
|
category: string; // 카테고리 (crud, navigation, utility, custom)
|
|
defaultText?: string; // 기본 텍스트
|
|
defaultTextEng?: string; // 기본 영문 텍스트
|
|
defaultIcon?: string; // 기본 아이콘 (Lucide 아이콘 이름)
|
|
defaultColor?: string; // 기본 색상
|
|
defaultVariant?: string; // 기본 변형 (default, destructive, outline, secondary, ghost, link)
|
|
confirmationRequired?: boolean; // 확인 메시지 필요 여부
|
|
confirmationMessage?: string; // 기본 확인 메시지
|
|
validationRules?: any; // 실행 전 검증 규칙
|
|
actionConfig?: any; // 액션별 추가 설정
|
|
handler?: (
|
|
component: WidgetComponent,
|
|
formData?: any
|
|
) => Promise<void> | void; // 액션 핸들러
|
|
sortOrder?: number; // 정렬 순서
|
|
isActive?: boolean; // 활성화 여부
|
|
}
|
|
|
|
// 레지스트리 이벤트 타입
|
|
export interface RegistryEvent {
|
|
type:
|
|
| "webtype_registered"
|
|
| "webtype_unregistered"
|
|
| "action_registered"
|
|
| "action_unregistered";
|
|
data: WebTypeDefinition | ButtonActionDefinition;
|
|
}
|
|
|
|
// 레지스트리 이벤트 리스너
|
|
export type RegistryEventListener = (event: RegistryEvent) => void;
|
|
|
|
|