Skip to content

jsonforms-renderers: editable preview table for SpreadsheetControl (edit cells, save/discard, re-derive) #36

Description

@sthanikan2000

Problem

SpreadsheetControl's preview table (matrix or records-shaped, see #35) is read-only today — the only way to fix a value is to edit the source file and re-upload the whole sheet. For a small correction (one typo'd cell), that's a heavyweight round-trip: leave the form, open a spreadsheet app, fix one cell, re-save, re-upload, re-wait for parsing and re-derivation.

What's needed

A configurable edit mode for the preview table:

  1. Opt-in via a new x-spreadsheet option, off by default — consistent with every other behavior toggle on this control (persistSheet, columnHeader, rowHeader, showSheet).
  2. When enabled, cells in the preview table become editable inputs.
  3. Edits are staged locally, not applied immediately — a Save button commits them (re-running x-evaluate derivations against the edited matrix, exactly as a fresh upload does today) and a Discard button reverts to the last-persisted value.
  4. Works against whichever shape is currently persisted (raw matrix or records-shaped, per jsonforms-renderers(spreadsheet)!: persist SpreadsheetControl's sheet as records when a header is configured #35) — editing a records-shaped sheet means converting back to a matrix, editing, then re-shaping on save (the inverse of shapeSheet in utils/spreadsheet/process.ts).

Constraints worth stating up front

  • Derivations must never look stale. An edited-but-unsaved cell shouldn't silently leave derivations reflecting the old values — either recompute live as a preview, or make it visually clear the shown totals are pre-edit until Save.
  • Formula addressing is matrix-based (A1-style). Editing in records-mode requires reconstructing a matrix in the same row/column order the original shaping used, so x-evaluate formulas (written against that original layout) keep addressing the right cells after a round-trip.
  • Should reuse, not duplicate, the existing upload pipeline. processMatrix/evaluateExpressions already do "matrix in, derivations + shaped sheet out" — editing should feed the same pipeline with a locally-edited matrix instead of a freshly-parsed one, not fork a separate code path.

Out of scope

  • Adding/removing rows or columns — this is about correcting existing cell values, not restructuring the sheet.
  • Multi-user concurrent editing / conflict resolution.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions