@duskmoon-dev/el-table

中文文档
1.10.3发布于 2026/11/11TypeScriptESM + CJS构建来源已验证近 30 天下载 2592

A full-featured data table web component with sorting, pagination, and row selection.

原始使用文档
文档目录7 节
  1. Installation
  2. Usage
  3. Data API
  4. Declarative API
  5. Properties
  6. Events
  7. CSS Custom Properties

@duskmoon-dev/el-table

A full-featured data table web component with sorting, pagination, and row selection.

Installation

npm install @duskmoon-dev/el-table

Usage

Data API

<el-dm-table id="my-table" paginated selection-mode="multiple" striped></el-dm-table>

<script type="module">
  import '@duskmoon-dev/el-table/register';

  const table = document.getElementById('my-table');

  table.columns = [
    { key: 'name', label: 'Name', sortable: true },
    { key: 'email', label: 'Email', sortable: true },
    { key: 'role', label: 'Role', width: '120px' },
  ];

  table.data = [
    { id: 1, name: 'John Doe', email: '[email protected]', role: 'Admin' },
    { id: 2, name: 'Jane Smith', email: '[email protected]', role: 'User' },
  ];
</script>

Declarative API

<el-dm-table paginated page-size="5">
  <el-dm-table-column key="name" label="Name" sortable></el-dm-table-column>
  <el-dm-table-column key="email" label="Email" sortable></el-dm-table-column>
  <el-dm-table-column key="role" label="Role" width="120px"></el-dm-table-column>
</el-dm-table>

Properties

PropertyTypeDefaultDescription
columnsTableColumn[][]Column definitions
dataTableRow[][]Row data
sort-columnstring-Current sort column key
sort-direction'asc' | 'desc''asc'Sort direction
paginatedbooleanfalseEnable pagination
pagenumber1Current page
page-sizenumber10Rows per page
selection-mode'none' | 'single' | 'multiple''none'Selection mode
stripedbooleanfalseAlternating row colors
borderedbooleanfalseCell borders
hoverablebooleantrueRow hover effect
compactbooleanfalseReduced padding
sticky-headerbooleanfalseFixed header on scroll
loadingbooleanfalseLoading state
empty-messagestring'No data available'Empty state text

Events

EventDetailDescription
sort{ column, direction }Fired when sort changes
select{ selectedIds, selectedRows }Fired when selection changes
page-change{ page, pageSize }Fired when page changes
row-click{ row, rowIndex }Fired when row is clicked

CSS Custom Properties

The table uses CSS custom properties from @duskmoon-dev/el-base theme:

  • --color-surface - Table background
  • --color-surface-variant - Header/stripe background
  • --color-on-surface - Text color
  • --color-outline - Border color
  • --color-primary - Sort indicator, selection highlight
  • --radius-md - Border radius

版本与发布记录

@duskmoon-dev/el-table 共发布 51 个版本,首次发布于 2026/01/13;过去 12 个月发布了 51 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.10.3latest2026/11/112 天前
1.10.22026/10/2222 天前
1.10.12026/10/1627 天前
1.10.02026/10/1628 天前
1.9.32026/10/131 个月前
1.9.22026/10/131 个月前

关于 @duskmoon-dev/el-table 的常见问题

@duskmoon-dev/el-table 是什么?

A full-featured data table web component with sorting, pagination, and row selection.

如何安装 @duskmoon-dev/el-table?

在项目目录运行 npm install @duskmoon-dev/el-table,或使用 pnpm add / yarn add / bun add。

@duskmoon-dev/el-table 支持 TypeScript 吗?

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

@duskmoon-dev/el-table 支持 ESM 还是 CommonJS?

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

@duskmoon-dev/el-table 可以商用吗?

@duskmoon-dev/el-table 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@duskmoon-dev/el-table 的下载量有多少?

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

@duskmoon-dev/el-table 还在维护吗?

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