Files
invyone/frontend/lib/registry/components/input/index.ts
T
2026-05-07 17:06:26 +09:00

66 lines
2.2 KiB
TypeScript

"use client";
import { createComponentDefinition } from "../../utils/createComponentDefinition";
import { ComponentCategory } from "@/types/component";
import { InputWrapper } from "./InputComponent";
import { InvFieldConfigPanel } from "@/components/v2/config-panels/InvFieldConfigPanel";
import type { InputConfig } from "./types";
/**
* Input — 범용 필드 입력 통합 컴포넌트 (2026-04-11, Phase B-1)
*
* 하나의 컴포넌트가 FieldConfig.type 10종을 전부 처리. 팔레트에는 1개만 나오고
* 사용자가 type 을 선택하면 해당 위젯으로 전환.
*
* 흡수 대상 (20+):
* v2-input, v2-select, v2-category-manager, v2-file-upload,
* v2-media, v2-numbering-rule, v2-location-swap-selector,
* entity-search-input, autocomplete-search-input,
* text-input, number-input, date-input, select-basic, checkbox-basic,
* radio-basic, toggle-switch, slider-basic, textarea-basic,
* file-upload, image-display, image-widget,
* selected-items-detail-input, test-input
*
* 관련 문서:
* notes/gbpark/2026-04-11-component-unification-plan.md §3.4
*/
const DEFAULT_CONFIG = {
kind: "input",
type: "text",
format: "free",
placeholder: "입력하세요",
required: false,
editable: true,
} as Record<string, any>;
export const InputDefinition = createComponentDefinition({
id: "input",
name: "입력 필드",
name_eng: "Input",
description: "텍스트, 숫자, 날짜, 선택 등 10종 입력",
category: ComponentCategory.INPUT,
web_type: "text",
component: InputWrapper,
default_config: DEFAULT_CONFIG,
default_size: { width: 240, height: 48 },
config_panel: InvFieldConfigPanel,
icon: "Edit",
tags: ["입력", "input", "field", "text", "number", "date", "select"],
version: "2.0.0",
author: "INVYONE",
documentation:
"notes/gbpark/2026-04-11-component-unification-plan.md#34-input",
// ─── INVYONE DataPort 선언 ───
dataPorts: {
inputs: [{ name: "value", type: "value" }],
outputs: [
{ name: "value", type: "value" },
{ name: "changed", type: "value" },
],
},
});
export type { InputConfig } from "./types";
export { InputComponent, InputWrapper } from "./InputComponent";