74 lines
2.2 KiB
TypeScript
74 lines
2.2 KiB
TypeScript
"use client";
|
|
|
|
import { createComponentDefinition } from "../../utils/createComponentDefinition";
|
|
import { ComponentCategory } from "@/types/component";
|
|
import { TableWrapper } from "./TableComponent";
|
|
import { InvTableConfigPanel } from "./InvTableConfigPanel";
|
|
import type { TableConfig } from "./types";
|
|
|
|
/**
|
|
* Table — canonical data table component
|
|
*
|
|
* 통합 데이터 테이블. 5가지 displayMode 지원:
|
|
* - table (기본 그리드)
|
|
* - split (좌우 분할 — master-detail)
|
|
* - grouped (그룹화)
|
|
* - pivot (피벗 그리드)
|
|
* - card (카드 리스트, 좁은 컨테이너 자동 fallback)
|
|
*
|
|
* 관련 문서:
|
|
* notes/gbpark/2026-04-11-component-unification-plan.md §3.1
|
|
* notes/gbpark/2026-05-20-table-canonical-cleanup-plan.md
|
|
*/
|
|
|
|
const DEFAULT_CONFIG: Partial<TableConfig> = {
|
|
displayMode: "table",
|
|
selectionMode: "single",
|
|
showCheckbox: false,
|
|
showHeader: true,
|
|
showFooter: true,
|
|
showToolbar: true,
|
|
striped: true,
|
|
hoverable: true,
|
|
rowHeight: "normal",
|
|
pagination: {
|
|
enabled: true,
|
|
pageSize: 20,
|
|
},
|
|
};
|
|
|
|
export const TableDefinition = createComponentDefinition({
|
|
id: "table",
|
|
name: "테이블",
|
|
name_eng: "Table",
|
|
description:
|
|
"통합 데이터 테이블. 기본/분할/그룹/피벗/카드 5가지 모드 지원",
|
|
category: ComponentCategory.DISPLAY,
|
|
web_type: "text",
|
|
component: TableWrapper,
|
|
default_config: DEFAULT_CONFIG as Record<string, any>,
|
|
default_size: { width: 800, height: 400 },
|
|
config_panel: InvTableConfigPanel,
|
|
icon: "Table",
|
|
tags: ["테이블", "table", "grid", "list", "data", "split", "pivot"],
|
|
version: "2.0.0",
|
|
author: "INVYONE",
|
|
documentation:
|
|
"notes/gbpark/2026-04-11-component-unification-plan.md#31-table",
|
|
// ─── INVYONE DataPort 선언 ───
|
|
dataPorts: {
|
|
inputs: [
|
|
{ name: "searchParams", type: "params" },
|
|
{ name: "refreshTrigger", type: "value" },
|
|
],
|
|
outputs: [
|
|
{ name: "selectedRow", type: "row" },
|
|
{ name: "selectedRows", type: "rows" },
|
|
],
|
|
},
|
|
});
|
|
|
|
export type { TableConfig, TableColumn } from "./types";
|
|
export { TableComponent, TableWrapper } from "./TableComponent";
|
|
export { InvTableConfigPanel } from "./InvTableConfigPanel";
|