Skip to content

Latest commit

 

History

History
265 lines (209 loc) · 19.8 KB

report.mdx

File metadata and controls

265 lines (209 loc) · 19.8 KB
title Report schema — UI Protocol property reference
navTitle Report
description Report schemas of the ObjectStack UI Protocol: JoinedReportBlock, Report and 3 more — each property with its type, default and a TypeScript example.

{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}

**Source:** `packages/spec/src/ui/report.zod.ts`

TypeScript Usage

import { JoinedReportBlockSchema, ReportSchema, ReportChartSchema, ReportSortSchema, ReportType } from '@objectstack/spec/ui';
import type { JoinedReportBlock, Report, ReportChart, ReportSort, ReportType } from '@objectstack/spec/ui';

// Validate data
const result = JoinedReportBlockSchema.parse(data);

JoinedReportBlock

Properties

Property Type Required Description
name string ✅ Snake case identifier (lowercase with underscores only)
label string | Record<string, string> optional Display label — the default-language string, or an inline locale map ({ en, "zh-CN" }) resolved at render time
description string | Record<string, string> optional Display label — the default-language string, or an inline locale map ({ en, "zh-CN" }) resolved at render time
type Enum<'tabular' | 'summary' | 'matrix'> optional (default: "tabular")
dataset string optional Dataset name to bind (ADR-0021); a joined report refuses a block without one
rows string[] optional Dimension names down (dataset-bound)
columns string[] optional Dimension names across (matrix, dataset-bound)
values string[] optional Measure names to show (dataset-bound)
runtimeFilter any optional Render-time scope filter (dataset-bound)
order { by: string; direction?: Enum<'asc' | 'desc'> }[] optional Result ordering, most significant key first

Nested Shape: JoinedReportBlock.order[number]

Property Type Required Description
by string ✅ Dimension or measure name to order by (must be selected by this report)
direction Enum<'asc' | 'desc'> optional (default: "asc") Sort direction (default ascending)

Report

Properties

Property Type Required Description
name string ✅ Report unique name
label string | Record<string, string> ✅ Report label
description string | Record<string, string> optional Display label — the default-language string, or an inline locale map ({ en, "zh-CN" }) resolved at render time
type Enum<'tabular' | 'summary' | 'matrix' | 'joined'> optional (default: "tabular") Report format type
dataset string optional Dataset name to bind (ADR-0021)
rows string[] optional Dimension names down
columns string[] optional Dimension names across (matrix)
values string[] optional Measure names to show
runtimeFilter any optional Render-time scope filter
order { by: string; direction?: Enum<'asc' | 'desc'> }[] optional Result ordering, most significant key first
drilldown boolean optional (default: true) Click-through to underlying records
chart { type: Enum<'bar' | 'horizontal-bar' | 'column' | 'line' | 'area' | 'pie' | 'donut' | …>; title?: string | Record<string, string>; subtitle?: string | Record<string, string>; description?: string | Record<string, string>; … } optional Embedded chart configuration (refused on a joined report, which draws tables only)
dateRange { dimension?: string; defaultRange?: Enum<'today' | 'yesterday' | 'this_week' | 'last_week' | 'this_month' | 'last_month' | …>; allowCustomRange?: boolean } optional Report date range: a window over one dataset date dimension (refused on a joined report)
exportOptions { formats?: Enum<'csv' | 'xlsx'>[]; includeHeaders?: boolean; fileNamePrefix?: string } optional Report export control: { formats?, includeHeaders?, fileNamePrefix? }, csv / xlsx, on by default; who may export is the base object's export permission (refused on a joined report)
blocks { name: string; label?: string | Record<string, string>; description?: string | Record<string, string>; type?: Enum<'tabular' | 'summary' | 'matrix'>; … }[] optional Sub-reports for type=joined
protection { lock: Enum<'none' | 'no-overlay' | 'no-delete' | 'full'>; reason: string; docsUrl?: string } optional Package author protection block — lock policy for this report.
_lock Enum<'none' | 'no-overlay' | 'no-delete' | 'full'> optional Item-level lock — controls overlay & delete (ADR-0010).
_lockReason string optional Human-readable reason shown when a write is refused by _lock.
_lockSource Enum<'artifact' | 'package' | 'env-forced'> optional Layer that set _lock (artifact | package | env-forced).
_provenance Enum<'package' | 'org' | 'env-forced' | 'platform'> optional Origin of the item (package | org | env-forced | platform).
_packageId string optional Owning package machine id.
_packageVersion string optional Owning package version.
_lockDocsUrl string optional Optional documentation link surfaced next to _lockReason.
overrides { package: string; basedOn: string } optional Override declaration (ADR-0146 D2): { package, basedOn } — this item of "<base>.custom" replaces the base package's same-named item whole. basedOn is recorded and never gates; a base's upgrade plan reads it only as advice.

Nested Shape: Report.order[number]

Property Type Required Description
by string ✅ Dimension or measure name to order by (must be selected by this report)
direction Enum<'asc' | 'desc'> optional (default: "asc") Sort direction (default ascending)

Nested Shape: Report.chart

Property Type Required Description
type Enum<'bar' | 'horizontal-bar' | 'column' | 'line' | 'area' | 'pie' | 'donut' | …> ✅
title string | Record<string, string> optional Chart title
subtitle string | Record<string, string> optional Chart subtitle
description string | Record<string, string> optional Accessibility description — announced to screen readers as the chart’s label
xAxis string ✅ Dataset dimension name for the X-axis (bound-dataset dimension, not a raw field)
yAxis string ✅ Dataset measure name for the Y-axis (bound-dataset measure, not a raw field)
series { name: string; label?: string | Record<string, string>; type?: Enum<'bar' | 'horizontal-bar' | 'column' | 'line' | 'area' | 'pie' | 'donut' | …>; color?: string; … }[] optional Defined series configuration. Structure, not appearance — authorable where the chart has inline data; refused by name on a dataset-bound dashboard widget, where the dataset decides it (ADR-0021).
colors string[] | Record<string, string> optional Color palette (string[]) or value→color map ({ value: color })
height number optional Fixed plot height in pixels (overrides the container default)
showLegend boolean optional (default: true) Display legend
showDataLabels boolean optional (default: false) Display data labels
annotations { type?: Enum<'line' | 'region'>; axis?: Enum<'x' | 'y'>; value: number | string; endValue?: number | string; … }[] optional Reference lines/bands drawn over the plot: { type: "line" | "region", axis: "x" | "y", value, endValue?, color?, label?, style? }
interaction { tooltips?: boolean; brush?: boolean } optional Interaction toggles: { tooltips?, brush? }
aria never optional [REMOVED] ChartConfig.aria — authored as dashboard.widgets[].chartConfig.aria, report.chart.aria and report.blocks[].chart.aria — was removed in @objectstack/spec 17 (ADR-0049 D2). No chart renderer ever applied it: the chart implementation declares no aria prop, the presentation lowering names it nowhere, and the react <ObjectChart> block never published it, so ARIA attributes declared here parsed and then silently did not reach the DOM. Delete the key. The accessible name that IS applied on this same chart config is its sibling description, which the chart renderer lowers onto the chart graphic as role="img" plus aria-label. The shared AriaProps shape is NOT gone — ariaLabel / ariaDescribedBy / role stay live in the aria block on page.aria, page.components[].aria and the list view aria. Run os migrate meta --from 17 to list the mechanical edits for existing sources; --write applies the ones it can prove, and you apply the rest by hand.
seriesBy string optional Dataset dimension name that splits the yAxis measure into one series per value of it (bound-dataset dimension, not a raw field); with it set, series[].name names a value of this dimension. Refused on a single-series type (pie/donut/funnel/treemap/sankey) and when it names the xAxis dimension
showEmptyGroups boolean optional Show the declared options of the xAxis dimension field that have no records, valued 0 for a count or sum (left empty for avg/min/max), on a chart with a category axis (bar, column, horizontal-bar, line, area, radar, combo); nothing is added on any other chart type. Only a field that declares its options is filled; nothing is added when the report's order reaches the chart, and an answer with no rows still draws no chart; omitted = off

Nested Shape: Report.dateRange

Property Type Required Description
dimension string optional Dataset dimension (declared type: 'date') the window applies to; omitted = the dataset's one date dimension
defaultRange Enum<'today' | 'yesterday' | 'this_week' | 'last_week' | 'this_month' | 'last_month' | …> optional (default: "this_month") Default date range preset
allowCustomRange boolean optional (default: true) Allow users to pick a custom date range

Nested Shape: Report.exportOptions

Property Type Required Description
formats Enum<'csv' | 'xlsx'>[] optional Formats the report's export control offers (default: ['csv', 'xlsx']); an empty list turns the control off
includeHeaders boolean optional Include column headers in the exported file (default true)
fileNamePrefix string optional Download file name prefix — replaces the report label in the generated file name

Nested Shape: Report.blocks[number]

Property Type Required Description
name string ✅ Snake case identifier (lowercase with underscores only)
label string | Record<string, string> optional Display label — the default-language string, or an inline locale map ({ en, "zh-CN" }) resolved at render time
description string | Record<string, string> optional Display label — the default-language string, or an inline locale map ({ en, "zh-CN" }) resolved at render time
type Enum<'tabular' | 'summary' | 'matrix'> optional (default: "tabular")
dataset string optional Dataset name to bind (ADR-0021); a joined report refuses a block without one
rows string[] optional Dimension names down (dataset-bound)
columns string[] optional Dimension names across (matrix, dataset-bound)
values string[] optional Measure names to show (dataset-bound)
runtimeFilter any optional Render-time scope filter (dataset-bound)
order { by: string; direction?: Enum<'asc' | 'desc'> }[] optional Result ordering, most significant key first

Nested Shape: Report.protection

Property Type Required Description
lock Enum<'none' | 'no-overlay' | 'no-delete' | 'full'> ✅ Lock policy — none | no-overlay | no-delete | full.
reason string ✅ User-visible reason shown when the lock blocks an action.
docsUrl string optional Optional URL the Studio banner links to for more context.

Nested Shape: Report.overrides

Property Type Required Description
package string ✅ The base package id whose same-named item this item replaces whole (e.g. "com.acme.crm"). Only an item of the base's paired "<base>.custom" package declares an override.
basedOn string ✅ Recorded, never a gate: the base package's manifest.version this override was taken from (e.g. "3.2.0"), not a history version of the item. Nothing is refused, merged or rebased on it; it tells a person re-basing the override where it started. One reader, as advice: a base's upgrade plan lists an override whose basedOn is not the installed base version as stale, beside each override whose base item the upgrade changes (ADR-0146 D2, as amended).

ReportChart

Properties

Property Type Required Description
type Enum<'bar' | 'horizontal-bar' | 'column' | 'line' | 'area' | 'pie' | 'donut' | 'funnel' | 'scatter' | 'treemap' | 'sankey' | 'combo' | 'gauge' | 'solid-gauge' | … +6 more> ✅
title string | Record<string, string> optional Chart title
subtitle string | Record<string, string> optional Chart subtitle
description string | Record<string, string> optional Accessibility description — announced to screen readers as the chart’s label
xAxis string ✅ Dataset dimension name for the X-axis (bound-dataset dimension, not a raw field)
yAxis string ✅ Dataset measure name for the Y-axis (bound-dataset measure, not a raw field)
series { name: string; label?: string | Record<string, string>; type?: Enum<'bar' | 'horizontal-bar' | 'column' | 'line' | 'area' | 'pie' | 'donut' | …>; color?: string; … }[] optional Defined series configuration. Structure, not appearance — authorable where the chart has inline data; refused by name on a dataset-bound dashboard widget, where the dataset decides it (ADR-0021).
colors string[] | Record<string, string> optional Color palette (string[]) or value→color map ({ value: color })
height number optional Fixed plot height in pixels (overrides the container default)
showLegend boolean optional (default: true) Display legend
showDataLabels boolean optional (default: false) Display data labels
annotations { type?: Enum<'line' | 'region'>; axis?: Enum<'x' | 'y'>; value: number | string; endValue?: number | string; … }[] optional Reference lines/bands drawn over the plot: { type: "line" | "region", axis: "x" | "y", value, endValue?, color?, label?, style? }
interaction { tooltips?: boolean; brush?: boolean } optional Interaction toggles: { tooltips?, brush? }
aria never optional [REMOVED] ChartConfig.aria — authored as dashboard.widgets[].chartConfig.aria, report.chart.aria and report.blocks[].chart.aria — was removed in @objectstack/spec 17 (ADR-0049 D2). No chart renderer ever applied it: the chart implementation declares no aria prop, the presentation lowering names it nowhere, and the react <ObjectChart> block never published it, so ARIA attributes declared here parsed and then silently did not reach the DOM. Delete the key. The accessible name that IS applied on this same chart config is its sibling description, which the chart renderer lowers onto the chart graphic as role="img" plus aria-label. The shared AriaProps shape is NOT gone — ariaLabel / ariaDescribedBy / role stay live in the aria block on page.aria, page.components[].aria and the list view aria. Run os migrate meta --from 17 to list the mechanical edits for existing sources; --write applies the ones it can prove, and you apply the rest by hand.
seriesBy string optional Dataset dimension name that splits the yAxis measure into one series per value of it (bound-dataset dimension, not a raw field); with it set, series[].name names a value of this dimension. Refused on a single-series type (pie/donut/funnel/treemap/sankey) and when it names the xAxis dimension
showEmptyGroups boolean optional Show the declared options of the xAxis dimension field that have no records, valued 0 for a count or sum (left empty for avg/min/max), on a chart with a category axis (bar, column, horizontal-bar, line, area, radar, combo); nothing is added on any other chart type. Only a field that declares its options is filled; nothing is added when the report's order reaches the chart, and an answer with no rows still draws no chart; omitted = off

Allowed Values: ReportChart.type

  • bar
  • horizontal-bar
  • column
  • line
  • area
  • pie
  • donut
  • funnel
  • scatter
  • treemap
  • sankey
  • combo
  • gauge
  • solid-gauge
  • metric
  • kpi
  • bullet
  • radar
  • table
  • pivot

Nested Shape: ReportChart.series[number]

Property Type Required Description
name string ✅ Field name or series identifier
label string | Record<string, string> optional Series display label
type Enum<'bar' | 'horizontal-bar' | 'column' | 'line' | 'area' | 'pie' | 'donut' | …> optional Override chart type for this series
color string optional Series color (hex/rgb/token)
stack string optional Stack identifier to group series
yAxis Enum<'left' | 'right'> optional (default: "left") Bind to specific Y-Axis
variant Enum<'primary' | 'comparison'> optional (default: "primary") Series visual role
dashArray string optional SVG stroke-dasharray override
opacity number optional Series opacity override

Nested Shape: ReportChart.annotations[number]

Property Type Required Description
type Enum<'line' | 'region'> optional (default: "line")
axis Enum<'x' | 'y'> optional (default: "y")
value number | string ✅ Start value
endValue number | string optional End value for regions
color string optional
label string | Record<string, string> optional Display label — the default-language string, or an inline locale map ({ en, "zh-CN" }) resolved at render time
style Enum<'solid' | 'dashed' | 'dotted'> optional (default: "dashed")

Nested Shape: ReportChart.interaction

Property Type Required Description
tooltips boolean optional (default: true) Show the hover tooltip
brush boolean optional (default: false) Show the range selector under the plot

ReportSort

Properties

Property Type Required Description
by string ✅ Dimension or measure name to order by (must be selected by this report)
direction Enum<'asc' | 'desc'> optional (default: "asc") Sort direction (default ascending)

ReportType

Allowed Values

  • tabular
  • summary
  • matrix
  • joined