Skip to content

feat(package): add DataVis field and host providers - #158

Open
lattln wants to merge 6 commits into
mainfrom
feature-datavis-integration
Open

feat(package): add DataVis field and host providers#158
lattln wants to merge 6 commits into
mainfrom
feature-datavis-integration

Conversation

@lattln

@lattln lattln commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Overview

This PR adds a reusable @esheet/document-list-field package backed by DataVis and introduces a generic field-provider mechanism for passing host-specific behavior into fields.

The document-list field handles document normalization and grid rendering, while the host application controls actions such as Compose, Upload, detail expansion, routing, persistence, and business workflows.

What Changed

New document-list field package

Added document-list-field, including:

  • DocumentListField
  • DocumentListGrid
  • DocumentListFieldProvider
  • createDocumentListFieldProvider
  • useDocumentListFieldHost
  • Document row and value types
  • JSON answer parsing and row normalization
  • DataVis local source creation
  • Default document columns and action-column support
  • Loading, error, row-click, double-click, and detail-row support

The field accepts static definition data or response answers in these forms:

{ documents: [...] }
{ rows: [...] }
[...]

Rows are normalized into a consistent document summary shape, with fallback display values for missing data.

Generic field-provider support

Added FieldProviderStack, allowing multiple field extensions to wrap a shared builder or renderer tree.

New provider support was added to:

  • EsheetBuilder
  • EsheetRenderer
  • Blaze renderer

Consumers can now pass:

fieldProviders?: readonly FieldProvider[];

This allows field add-ons to provide React context and host callbacks without changing the form response model.

Document-list toolbar controls

DocumentListGrid now supports optional host-controlled controls for:

  • Expanding or collapsing detail rows
  • Composing a document
  • Uploading a document
  • Rendering custom title actions

The controls include accessible labels and aria-pressed state for the detail toggle.

Demo integration

The demo now:

  • Registers the document-list field type
  • Includes document-list data in the builder example
  • Adds a standalone YAML document-list schema
  • Demonstrates the builder and renderer provider APIs
  • Demonstrates custom detail-row rendering
  • Adds Compose and Upload callbacks
  • Adds a file picker for the upload example
  • Displays toast feedback for demo actions

The demo actions are intentionally placeholders. They show how a host supplies behavior but do not persist or upload documents.

Tests

Added focused tests covering:

  • Provider composition order
  • Provider behavior without configured providers
  • Document-list host context behavior
  • Document normalization and fallback values
  • Supported answer formats
  • DataVis payload creation
  • Action-column injection
  • Row click and double-click mapping
  • Detail-row mapping
  • Toolbar callback dispatch
  • Detail toggle accessibility state

Dependency and build configuration

Added package-level:

  • package.json
  • TypeScript configurations
  • Vitest configuration
  • ESLint configuration
  • Vite library build configuration
  • CSS bundling and runtime injection

Updated the workspace lockfile with the new package importer and DataVis/AG Grid dependency graph.

Compatibility

The changes are backward compatible:

  • fieldProviders is optional.
  • Existing builder and renderer usage remains unchanged.
  • DocumentListGrid continues to work without host callbacks.
  • Document-list fields without a provider render without toolbar actions.
  • The document-list field does not mutate response data when actions are triggered.

Known Limitations

  • Demo Upload only opens a file picker and displays a toast.
  • Demo Compose only displays a toast.
  • There is no generic typed row-action dispatcher yet for edit, delete, signature, or PDF actions.
  • Detail-row loading is synchronous and has no built-in async lifecycle.
  • Detail expansion is global rather than individually controlled per row.
  • Row selection and bulk actions are not implemented.
  • There is no full integration test covering fieldProviders through a real builder or renderer instance.

Add a reusable `@esheet/document-list-field` package backed by DataVis, including document normalization, grid rendering, toolbar actions, detail rows, and provider-based host integration.

Add generic `FieldProviderStack` support to the builder, renderer, and Blaze renderer so field add-ons can receive host behavior without changing form response data.

Register the document-list field in the demo and demonstrate Compose, Upload, detail expansion, custom detail rows, and YAML schema loading. Add focused unit tests and workspace build configuration for the new package.
@lattln lattln changed the title feat(document-list): add DataVis field and host providers feat(package): add DataVis field and host providers Aug 18, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploying esheet with  Cloudflare Pages  Cloudflare Pages

Latest commit: c7960e1
Status: ✅  Deploy successful!
Preview URL: https://bce8ad04.esheet.pages.dev
Branch Preview URL: https://feature-datavis-integration.esheet.pages.dev

View logs

@lattln lattln self-assigned this Aug 19, 2026
lattln added 5 commits August 19, 2026 14:22
- Add package-owned Compose and Upload modals
- Support editable document metadata and note content
- Pass transient text and file content through the repository contract
- Add text/image detail previews with metadata fallback
- Move demo persistence to in-memory document/content maps
- Remove host-owned upload and compose handlers
- Add workflow tests, styles, and exports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant