feat(workspace): make compose and sign views accept document, recipient, and field state via properties and emit field and routing change events

This commit is contained in:
2026-05-05 20:45:05 +00:00
parent 7baff5004c
commit b6b4698028
5 changed files with 67 additions and 12 deletions
@@ -1,5 +1,5 @@
import { DeesElement, property, html, customElement, type TemplateResult, css } from '@design.estate/dees-element';
import { demoDocuments, icon, type IDocumentRow, type TDensity, type TWorkspaceTheme, type TWorkspaceView } from './sdig-workspace.shared.js';
import { demoDocuments, demoFields, demoRecipients, icon, type IDocumentRow, type IFieldPlacement, type IRecipient, type TDensity, type TWorkspaceTheme, type TWorkspaceView } from './sdig-workspace.shared.js';
import './sdig-workspace-inbox.js';
import './sdig-workspace-compose.js';
import './sdig-workspace-sign.js';
@@ -25,6 +25,8 @@ export class SdigWorkspace extends DeesElement {
@property({ type: String, reflect: true }) public accessor view: TWorkspaceView = 'inbox';
@property({ attribute: false }) public accessor documents: IDocumentRow[] = demoDocuments;
@property({ type: String }) public accessor activeDocumentId: string = '';
@property({ attribute: false }) public accessor recipients: IRecipient[] = demoRecipients;
@property({ attribute: false }) public accessor fields: IFieldPlacement[] = demoFields;
public connectedCallback = async () => {
await super.connectedCallback();
@@ -163,8 +165,8 @@ export class SdigWorkspace extends DeesElement {
const activeDocument = this.documents.find((document) => document.id === this.activeDocumentId) || this.documents[0] || demoDocuments[0];
switch (this.view) {
case 'inbox': return html`<sdig-workspace-inbox class="view-host" .density=${this.density} .documents=${this.documents}></sdig-workspace-inbox>`;
case 'compose': return html`<sdig-workspace-compose class="view-host"></sdig-workspace-compose>`;
case 'sign': return html`<sdig-workspace-sign class="view-host" .document=${activeDocument}></sdig-workspace-sign>`;
case 'compose': return html`<sdig-workspace-compose class="view-host" .document=${activeDocument} .recipients=${this.recipients} .fields=${this.fields}></sdig-workspace-compose>`;
case 'sign': return html`<sdig-workspace-sign class="view-host" .document=${activeDocument} .fields=${this.fields}></sdig-workspace-sign>`;
case 'audit': return html`<sdig-workspace-audit class="view-host" .document=${activeDocument}></sdig-workspace-audit>`;
case 'developers': return html`<sdig-workspace-developers class="view-host"></sdig-workspace-developers>`;
case 'templates': return html`<sdig-workspace-placeholder class="view-host" label="Templates" subtitle="Reusable agreement templates"></sdig-workspace-placeholder>`;