문서 표와 그리드

UIDataGrid

Sectile의 팩토리로 상호작용 가능한 데이터 그리드를 구성합니다.

기본 사용법

작업 상태 그리드 탐색

createTableData로 등록한 작업 목록을 표시합니다. 셀을 클릭한 뒤 방향키로 행과 열 사이를 이동해 보세요.

작업
담당자
상태
시안 검토
민지
완료
접근성 검사
서준
진행 중
모바일 확인
다현
대기
<script setup lang="ts">
import { createTableData, UIDataGrid } from "@connextable/ui";

const tasks = createTableData({
  columns: [
    { id: "task", label: "작업" },
    { id: "owner", label: "담당자" },
    { id: "status", label: "상태" },
  ],
  rows: [
    { id: "1", cells: { task: "시안 검토", owner: "민지", status: "완료" } },
    {
      id: "2",
      cells: { task: "접근성 검사", owner: "서준", status: "진행 중" },
    },
    { id: "3", cells: { task: "모바일 확인", owner: "다현", status: "대기" } },
  ],
});
</script>

<template>
  <UIDataGrid :data="tasks" label="작업 상태" />
</template>

설정과 동작

현재 포커스된 셀 읽기

셀을 클릭하고 방향키로 이동하면 그리드 밖의 요약도 갱신됩니다.

이동에서 제외되는 셀

방향키를 움직여 첫 번째 행의 상태 셀을 건너뜁니다.

행 양끝을 이어서 탐색

이전과 다음 열 버튼을 누르면 강조 표시가 같은 행의 셀을 따라 이동합니다. 행 끝에 도달하면 반대쪽 끝으로 이어집니다.

그리드 행 선택

셀 이동과 별도로 행 전체를 선택합니다.

그리드 정렬

작업 옆 정렬 아이콘을 눌러 행의 순서를 바꿉니다.

그리드의 상태 열 필터

상태 옆 필터 아이콘을 눌러 UISelect에서 ‘대기’를 선택합니다. 선택을 set-query에 연결하면 해당 행만 남습니다.

실전 예제

셀을 눌러 편집하고 확정

상태 값 옆 연필 버튼을 누르세요. Enter로 확정하거나 Escape로 취소합니다.

재고 수량 검증

수량을 편집해 -1을 입력하면 저장이 거부됩니다. 0~999 사이의 정수를 입력해 다시 확정하세요.

예산 편집 후 합계 다시 계산

예산 값 옆 연필 버튼을 눌러 숫자를 바꾸고 Enter로 저장합니다. 월 예산 합계도 바뀝니다.

구성 컴포넌트

구조와 배치

DataGrid.Provider

팩토리가 만든 컨트롤러를 같은 컴포넌트 모음에 연결합니다.

현재 포커스된 셀 읽기 예제
DataGrid.Root

표 또는 그리드의 접근성 역할과 이름을 설정합니다.

현재 포커스된 셀 읽기 예제
DataGrid.Header

하나 이상의 열 제목 행을 담습니다.

현재 포커스된 셀 읽기 예제
DataGrid.HeaderRow

같은 단계에 있는 열 제목을 묶습니다.

현재 포커스된 셀 읽기 예제
DataGrid.ColumnHeader

열이나 제목 그룹을 스키마의 식별자와 연결합니다.

현재 포커스된 셀 읽기 예제
DataGrid.Body

컨트롤러가 받아들인 행을 렌더링합니다.

현재 포커스된 셀 읽기 예제
DataGrid.Row

직접 렌더링하는 행을 컨트롤러의 행 id와 연결합니다.

DataGrid.Cell

행에 있는 값이나 편집기를 표시합니다.

현재 포커스된 셀 읽기 예제

값 입력과 선택

DataGrid.RowSelectionControl

그리드에서 현재 행의 선택을 바꿉니다.

그리드 행 선택 예제
DataGrid.BulkSelectionControl

검색 범위나 그룹에 포함된 행의 선택을 한꺼번에 바꿉니다.

DataGrid.Editor

셀 값을 편집하고 입력한 값을 확정합니다.

재고 수량 검증 예제
UITabularEditTrigger

편집 가능한 값과 연필 아이콘을 표시하고 클릭하면 셀 편집기에 포커스를 옮깁니다.

셀을 눌러 편집하고 확정 예제

탐색과 동작

DataGrid.SortTrigger

열의 정렬 방향을 바꿉니다.

그리드 정렬 예제
DataGrid.FilterControl

검색 값을 현재 열이나 전체 데이터의 필터에 연결합니다.

DataGrid.ColumnResizeHandle

열 너비를 조절합니다.

주요 API

속성과 모델

data타입TableData<Cells, ID>

createTableData로 등록한 열과 행입니다. 테이블과 동일한 열 정의를 그리드에도 전달할 수 있습니다.

작업 상태 그리드 탐색 예제
Editor parseValue

입력 문자열을 저장할 값으로 변환하거나 실패 결과를 반환합니다.

데이터 소스와 컨트롤러

source

렌더링할 행과 각 열의 기능을 반환합니다. capabilities에 edit를 선언한 열은 편집에 진입할 수 있습니다.

현재 포커스된 셀 읽기 예제

슬롯

Body #default

현재 행과 편집 상태를 제공합니다.

이벤트와 명령

commit-edit

셀과 새 값을 받는 명령입니다. 소스에 값을 반영하고 다시 읽을 수 있습니다.

move-cell

현재 셀에서 한 칸 이동합니다. wrap-axis를 지정하면 같은 축의 반대쪽 끝으로 이어집니다.

컴포저블

useDataGrid

데이터 소스를 탐색 가능한 그리드 컨트롤러로 연결합니다.

현재 포커스된 셀 읽기 예제
useDataGridContext

하위 컴포넌트에서 그리드 Provider의 상태를 읽습니다.

현재 포커스된 셀 읽기 예제

팩토리와 유틸리티

createUITabularSource

열과 행을 가져오는 함수로 표, 그리드, 트리 그리드에 연결할 데이터 소스를 만듭니다.

셀을 눌러 편집하고 확정 예제
createUIDataGridComponents

그리드 컨트롤러의 행과 셀에 맞는 Vue 컴포넌트 모음을 만듭니다.

현재 포커스된 셀 읽기 예제
전체 속성, 이벤트와 슬롯

UIDataGrid

label필수
string
data필수
TableData<Cells, ID>
page-size
number | undefined
#cell
(scope: TableCell<NoInfer<Cells>, NoInfer<ID>>) => VNodeChild

DataGrid.Provider

#default
(props: DataGridProviderSlotProps<LeafCells, GroupCells>) => VNodeChild

DataGrid.Root

@command
DataGridCommandHandler
@error
DataGridErrorHandler
as
PrimitiveAs | undefined
as-child
boolean | undefined
#default
(props: DataGridRootSlotProps<LeafCells, GroupCells>) => VNodeChild

DataGrid.Header

as
PrimitiveAs | undefined
as-child
boolean | undefined
#default
(props: DataGridHeaderSlotProps<LeafCells, GroupCells>) => VNodeChild

DataGrid.HeaderRow

as
PrimitiveAs | undefined
as-child
boolean | undefined
#default
(props: DataGridHeaderRowSlotProps<LeafCells, GroupCells>) => VNodeChild

DataGrid.ColumnHeader

as
PrimitiveAs | undefined
as-child
boolean | undefined
header
string | undefined
column
undefined | DataTableColumnID<LeafCells, GroupCells>
#default
(props: DataGridColumnHeaderSlotProps<LeafCells, GroupCells>) => VNodeChild

DataGrid.SortTrigger

column필수
DataTableColumnID<LeafCells, GroupCells>
comparator
string | undefined
as
PrimitiveAs | undefined
as-child
boolean | undefined
#default
(props: DataGridSortTriggerSlotProps<LeafCells, GroupCells>) => VNodeChild

DataGrid.FilterControl

as
PrimitiveAs | undefined
as-child
boolean | undefined
scope필수
"global" | "column"
id필수
string
predicate필수
string
column
DataTableColumnID<LeafCells, GroupCells>
#default
(props: DataGridFilterControlSlotProps<LeafCells, GroupCells>) => VNodeChild

DataGrid.ColumnResizeHandle

column필수
DataTableColumnID<LeafCells, GroupCells>
min-size
number | undefined
max-size
number | undefined
as
PrimitiveAs | undefined
as-child
boolean | undefined
#default
(props: DataGridColumnResizeHandleSlotProps<LeafCells, GroupCells>) => VNodeChild

DataGrid.Body

as
PrimitiveAs | undefined
as-child
boolean | undefined
row-attributes
Readonly<Record<string, unknown>> | undefined
manual
Manual | undefined
#default
(props: Manual extends true ? DataGridRootSlotProps<LeafCells, GroupCells> : DataGridBodySlotProps<LeafCells, GroupCells>) => VNodeChild
#empty
(props: DataGridRootSlotProps<LeafCells, GroupCells>) => VNodeChild

DataGrid.Row

row-i-d필수
string
as
PrimitiveAs | undefined
as-child
boolean | undefined
#default
(props: DataGridRowSlotProps<LeafCells, GroupCells>) => VNodeChild

DataGrid.Cell

row-i-d
string | undefined
column필수
DataTableColumnID<LeafCells, GroupCells>
as
PrimitiveAs | undefined
as-child
boolean | undefined
#default
(props: DataGridCellSlotProps<LeafCells, GroupCells>) => VNodeChild

DataGrid.RowSelectionControl

row-i-d
string | undefined
name필수
string
value
string | undefined
form
string | undefined
disabled
boolean | undefined
as
PrimitiveAs | undefined
as-child
boolean | undefined
#default
(props: DataGridRowSelectionControlSlotProps<LeafCells, GroupCells>) => VNodeChild

DataGrid.BulkSelectionControl

target필수
{ readonly kind: "all-matching"; } | { readonly kind: "group-leaves"; readonly groupID: string; }
disabled
boolean | undefined
as
PrimitiveAs | undefined
as-child
boolean | undefined
#default
(props: DataGridBulkSelectionControlSlotProps<LeafCells, GroupCells>) => VNodeChild

DataGrid.Editor

parse-value
((value: string) => TabularResult<TabularQueryValue>) | undefined
commit-on-change
boolean | undefined
row-i-d
string | undefined
column필수
DataTableColumnID<LeafCells, GroupCells>
as
PrimitiveAs | undefined
as-child
boolean | undefined
#default
(props: DataGridEditorSlotProps<LeafCells, GroupCells>) => VNodeChild

UITabularEditTrigger

@click
(event: MouseEvent) => any
#default
(props: {}) => any