Skip to content
D
Documentation

WidgetHandle

reference
1 min readUpdated

Import it from @grafloria/element.

One widget's OO surface (mirrors ErTable/UmlClass).

ts
interface WidgetHandle

Properties

NameTypeDefaultDescription
idstring
viewIdstring
nodeNodeModel | undefined
specDashboardWidgetSpecThe DECLARED spec — read it back (title/kind/data) without a side map.
cell{ x: number; y: number; w: number; h: number } | undefinedCurrent cell, as data.
rect{ x: number; y: number; width: number; height: number } | undefinedThe world rect the current cell projects to.
pinnedboolean

Members

  • resize(span: number, rows: number): Promise<boolean> — Resize in CELLS. Resolves TRUE when the board accepted it.
  • moveTo(x: number, y: number): Promise<boolean> — Move to a cell. Resolves TRUE when the board accepted it.
  • pin(on?: boolean): void — Pin / unpin (a pinned widget refuses the mover and never gets pushed).
  • bringToFront(): void — Raise / lower — one undoable step each (mirrors the toolbar commands).
  • sendToBack(): void
  • remove(displaced?: unknown[]): void — Remove it — ONE undoable step including the survivors' re-pack. displaced accepts the commands a drag-out gesture already computed; omit it and the handle plans them itself.
  • update(patch: Partial<Pick<DashboardWidgetSpec, 'data' | 'title' | 'kind'>>): void — Replace the widget's data (and optionally title) and repaint.
  • repaint(): void — Repaint through renderWidget (after your data changed).

Was this page helpful?

WidgetHandle — Grafloria