@adapttable/vue

中文文档
0.4.1发布于 2026/11/02MITTypeScriptESM + CJS构建来源已验证近 30 天下载 1804

Headless Vue composables and structural table contracts for AdaptTable — sorting, filtering, editing, grouping, URL state and server data over the framework-neutral engine.

原始使用文档
文档目录5 节
  1. Features
  2. Sources and rendering
  3. Feature and adapter entries
  4. Optional assistant UI
  5. Popup control slot ownership

@adapttable/vue

Requires Node.js 22.12.0 or newer; packed releases are tested on Node 22.12 and Node 24.

Headless Vue 3.5 composables over the framework-neutral AdaptTable engine. Vue owns reactivity and lifecycle; adapters supply every visible control. This is a public 0.1.0 package.

pnpm add @adapttable/vue vue@^3.5.0

For a ready table with native controls, install @adapttable/vue-unstyled and follow the Vue getting-started guide.

Features

  • Reactive frontend, server and query-library sources with search, filtering, sorting and pagination over host-owned rows
  • Typed cell/header/footer renderers, controlled column layout and row selection, desktop table and responsive mobile card models
  • Feature composition for filters, header filters and AND/OR filter trees; cell, row and batch editing with validation, conflict handling, dirty state and undo/redo
  • Grouping and aggregation, tree data, row expansion and nested tables; resizable/grouped columns, row pinning, independent summary rows, cell spans, full-width rows, row styling and host-owned row actions
  • Density/fullscreen view controls, URL state and Saved Views for the connected state slices
  • Localized labels, RTL semantic attributes, SSR-safe setup and scoped resource ownership through mount, KeepAlive deactivation and disposal

The binding provides models and structural Chrome. A feature that needs UI requires adapter controls; use the native factories from @adapttable/vue-unstyled with its DataTable. The native standardFeatures() preset is available from @adapttable/vue-unstyled/preset.

Sources and rendering

import { useFrontendData, useDataTable } from "@adapttable/vue";
import type { ColumnDef } from "@adapttable/vue";

interface Person {
  id: string;
  name: string;
}
const columns: ColumnDef<Person>[] = [{ key: "name", sortable: true }];
const source = useFrontendData({
  data: [{ id: "ada", name: "Ada" }],
  columns,
  urlSync: false,
});
const table = useDataTable({
  source,
  columns,
  rowKey: (row: Person) => row.id,
});

Run composables in setup or an owned effect scope. Source results are readonly shallow refs; read the latest source.value in script. Returned table refs stay reactive when destructured. Callback values remain callbacks; pass a getter for the whole options object when replacing callback identities.

useServerData sends the host a query and request-local AbortSignal. Check info.signal.aborted before publishing rows, totals, errors or loading state. responseKey attributes data to a query; it is not a request-generation token. useQuerySource adapts an existing query composable, which owns its requests, cancellation and SSR policy.

ColumnDef<TRow, TValue>, CellContext, HeaderContext, FooterContext and componentRenderer preserve row/value types. The table never mutates host data. Controlled layout, selection, density and hierarchy state request host changes; ignoring a request preserves the supplied state.

Feature and adapter entries

@adapttable/vue/features exports opt-in factories and feature-specific options. Import shared table, source, column, view-state and feature composition contracts from @adapttable/vue. Structural Chrome, required slot props and adapter construction helpers belong to @adapttable/vue/adapter.

Formula, pivot, stream and sparkline integrations keep their matching binding entries. Optional PDF and XLSX factories and writers live at /pdf and /xlsx; CSV and callback-driven print factories live at /features.

Adapter authors use @adapttable/vue/adapter for useDataTableShell, semantic attribute/ref bridges, structural Chrome and lifecycle/model channels. Every visible button, input, select and overlay is supplied by the adapter. Bind complete attribute records to the actual semantic element.

DataTableSurfaceChrome is an optional shared outer layout. Its required Search, Select, Button, Loading, Desktop and Mobile renderers let each kit own its controls, table/card markup and appearance. DataTableSurfaceSlots and DataTableSurfaceChromeProps describe that construction boundary. Root composables and direct shell rendering remain available for completely custom UI without selecting this layout. See the optional layout reference.

The shell composes column-aligned summaries through useSummaryCells, useTableSummaryModel, TableSummaryChrome and MobileSummaryChrome. TableFooterChrome places custom content outside the table. Summary mappers receive the current source row scope, with reactive Vue values and shared neutral incremental aggregates supported.

The shell distinguishes loaded rows from visible hierarchy rows: collapsed children keep their editing drafts while select-all follows visible rows. Grouped/tree tables refuse data-row pinning; independent summaries still work. Saved Views capture connected URL slices, including density and uncontrolled pins; group collapse and column layout require explicit host wiring. useColumnLayoutUrlState returns layout/change/flush bindings; useColumnLayoutStorageState persists an independent browser preference. Pass the URL flush as the Saved Views flushViewState option. Selection, tree/detail expansion and edit drafts are not captured.

SSR state is request-local. Browser resources start after mount and suspend under KeepAlive. Dispose explicit effect scopes when their owner finishes. Supply equivalent initial rows, direction, URL state and responsive settings on server and client.

Read getting started, feature composition and the Vue API reference for signatures, examples, required slots and state-persistence boundaries.

Optional assistant UI

@adapttable/vue/adapter exports TableAssistantChrome, AgentApprovalChrome, ApprovalReviewChrome and their required kit control contracts. It imports no AI runtime. The separately opt-in @adapttable/ai-vue package connects agents, conversations and speech to Vue scopes. See the assistant guide for approvals, controlled updates and lifecycle behavior. These public packages are published on npm.

Popup control slot ownership

Create popup renderer functions once in component setup and read current presentation props through getters. A new slots object containing the same renderer functions is a harmless render wrapper; it does not begin a new logical session. Creating new renderer closures during each render replaces their owner and retires callbacks captured by the previous owner.

SidePanelChrome tracks the Frame, Tab, and Close renderers (or its complete presentation renderer). SavedViewsPanelChrome tracks Surface, Row, Input, and Empty. Context menus track their Surface driver; saved-view menus track their Panel driver. A replaced context-menu onClose callback also retires captured callbacks and queued commands. Keep these functions stable across style, label, and other ordinary presentation updates. Slot objects may be recreated, and getters may read updated classes or direction without replacing the functions. Replaced models or callback owners, replaced renderers, closed sessions, KeepAlive deactivation, and disposal still retire stale callbacks. Context-menu commands whose close was accepted remain one-shot dispatches even when the closed projection clears its items or recreates its Surface wrapper.

Controls become active after their mounted render has flushed. In mounted interaction tests, await Vue's next tick before invoking a control for the first time; a callback captured from an inactive render remains retired.

版本与发布记录

@adapttable/vue 共发布 11 个版本,首次发布于 2026/10/11;过去 12 个月发布了 11 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.4.1latest2026/11/026 天前
0.4.02026/10/318 天前
0.3.02026/10/2217 天前
0.2.02026/10/1623 天前
0.1.42026/10/1424 天前
0.1.32026/10/1326 天前

关于 @adapttable/vue 的常见问题

@adapttable/vue 是什么?

Headless Vue composables and structural table contracts for AdaptTable — sorting, filtering, editing, grouping, URL state and server data over the framework-neutral engine.

如何安装 @adapttable/vue?

在项目目录运行 npm install @adapttable/vue,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:vue(^3.5.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@adapttable/vue 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@adapttable/vue 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@adapttable/vue 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.12.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@adapttable/vue 可以商用吗?

@adapttable/vue 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@adapttable/vue 的下载量有多少?

根据 npm 官方下载统计,@adapttable/vue 在 2026/10/05 – 2026/11/03 这 30 天内被下载 1,804 次,日均约 60 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@adapttable/vue 还在维护吗?

最新版本 0.4.1 发布于 2026/11/02(6 天前);至今共发布 11 个版本,其中过去 12 个月发布了 11 个;首次发布于 2026/10/11。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。