feat(dees-table): add schema-based in-cell editing with keyboard navigation and cell edit events

This commit is contained in:
2026-04-07 15:32:10 +00:00
parent 2f95979cc6
commit efea2d62d9
6 changed files with 451 additions and 91 deletions

View File

@@ -55,36 +55,66 @@ export const demoFunc = () => html`
<div class="demo-container">
<div class="demo-section">
<h2 class="demo-title">Basic Table with Actions</h2>
<p class="demo-description">A standard table with row actions, editable fields, and context menu support. Double-click on descriptions to edit. Grid lines are enabled by default.</p>
<p class="demo-description">A standard table with row actions, editable cells, and context menu support. Double-click any cell to edit. Tab moves to the next editable cell, Enter to the row below, Esc cancels.</p>
<dees-table
heading1="Current Account Statement"
heading2="Bunq - Payment Account 2 - April 2021"
.editableFields="${['description']}"
.columns=${[
{ key: 'date', header: 'Date', sortable: true, editable: true, editor: 'date' },
{ key: 'amount', header: 'Amount', editable: true, editor: 'text' },
{
key: 'category',
header: 'Category',
editable: true,
editor: 'dropdown',
editorOptions: {
options: [
{ option: 'Office Supplies', key: 'office' },
{ option: 'Hardware', key: 'hardware' },
{ option: 'Software', key: 'software' },
{ option: 'Travel', key: 'travel' },
],
},
},
{ key: 'description', header: 'Description', editable: true },
{ key: 'reconciled', header: 'OK', editable: true, editor: 'checkbox' },
]}
@cellEdit=${(e: CustomEvent) => console.log('cellEdit', e.detail)}
.data=${[
{
date: '2021-04-01',
amount: '2464.65 €',
description: 'Printing Paper (Office Supplies) - STAPLES BREMEN',
category: 'office',
description: 'Printing Paper - STAPLES BREMEN',
reconciled: true,
},
{
date: '2021-04-02',
amount: '165.65 €',
description: 'Logitech Mouse (Hardware) - logi.com OnlineShop',
category: 'hardware',
description: 'Logitech Mouse - logi.com OnlineShop',
reconciled: false,
},
{
date: '2021-04-03',
amount: '2999,00 €',
description: 'Macbook Pro 16inch (Hardware) - Apple.de OnlineShop',
category: 'hardware',
description: 'Macbook Pro 16inch - Apple.de OnlineShop',
reconciled: false,
},
{
date: '2021-04-01',
amount: '2464.65 €',
category: 'office',
description: 'Office-Supplies - STAPLES BREMEN',
reconciled: true,
},
{
date: '2021-04-01',
amount: '2464.65 €',
category: 'office',
description: 'Office-Supplies - STAPLES BREMEN',
reconciled: true,
},
]}
dataName="transactions"
@@ -510,13 +540,13 @@ export const demoFunc = () => html`
<h2 class="demo-title">Column Filters + Sticky Header (New)</h2>
<p class="demo-description">Per-column quick filters and sticky header with internal scroll. Try filtering the Name column. Uses --table-max-height var.</p>
<style>
dees-table[sticky-header] { --table-max-height: 220px; }
dees-table[fixed-height] { --table-max-height: 220px; }
</style>
<dees-table
heading1="Employees"
heading2="Quick filter per column + sticky header"
.showColumnFilters=${true}
.stickyHeader=${true}
.fixedHeight=${true}
.columns=${[
{ key: 'name', header: 'Name', sortable: true },
{ key: 'email', header: 'Email', sortable: true },
@@ -669,7 +699,7 @@ export const demoFunc = () => html`
</style>
<dees-table
id="scrollSmallHeight"
.stickyHeader=${true}
.fixedHeight=${true}
heading1="People Directory (Scrollable)"
heading2="Forced scrolling with many items"
.columns=${[