54 lines
1.8 KiB
TypeScript
54 lines
1.8 KiB
TypeScript
"use client";
|
|
|
|
import { PopComponentRegistry } from "../../PopComponentRegistry";
|
|
import { PopSearchComponent } from "./PopSearchComponent";
|
|
import { PopSearchConfigPanel } from "./PopSearchConfig";
|
|
import type { PopSearchConfig } from "./types";
|
|
import { DEFAULT_SEARCH_CONFIG } from "./types";
|
|
|
|
function PopSearchPreviewComponent({ config, label }: { config?: PopSearchConfig; label?: string }) {
|
|
const cfg = config || DEFAULT_SEARCH_CONFIG;
|
|
const displayLabel = cfg.labelText || label || cfg.fieldName || "검색";
|
|
|
|
return (
|
|
<div className="flex h-full w-full flex-col items-center justify-center gap-1 p-2">
|
|
<span className="text-muted-foreground text-[10px] font-medium">{displayLabel}</span>
|
|
<div className="border-muted-foreground/30 flex h-6 w-full items-center rounded border border-dashed px-2">
|
|
<span className="text-muted-foreground text-[9px]">{cfg.placeholder || cfg.inputType}</span>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
PopComponentRegistry.registerComponent({
|
|
id: "pop-search",
|
|
name: "검색",
|
|
description: "조건 입력 (텍스트/날짜/선택/모달)",
|
|
category: "input",
|
|
icon: "Search",
|
|
component: PopSearchComponent,
|
|
configPanel: PopSearchConfigPanel,
|
|
preview: PopSearchPreviewComponent,
|
|
defaultProps: DEFAULT_SEARCH_CONFIG,
|
|
connectionMeta: {
|
|
sendable: [
|
|
{
|
|
key: "filter_value",
|
|
label: "필터 값",
|
|
type: "filter_value",
|
|
description: "입력한 검색 조건을 다른 컴포넌트에 전달",
|
|
},
|
|
],
|
|
receivable: [
|
|
{
|
|
key: "set_value",
|
|
label: "값 설정",
|
|
type: "filter_value",
|
|
description: "외부에서 값을 받아 검색 필드에 세팅 (스캔, 모달 선택 등)",
|
|
},
|
|
],
|
|
},
|
|
touchOptimized: true,
|
|
supportedDevices: ["mobile", "tablet"],
|
|
});
|