@dashspec/renderer 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/widgets.md CHANGED
@@ -67,7 +67,7 @@ Field props such as `x`, `label` or `value` name a field of each data row; dot p
67
67
  | Kind | What it shows | Main props | Events |
68
68
  |---|---|---|---|
69
69
  | `Kpi` | A metric card: label, big value, target and an "On track / Action needed" chip | `unit`, `unitStyle` (`small` / `value`), `format`, `decimals`, `target`, `targetLabel`, `goodWhen` (`up` / `down` / `none`), `badge`, `statusLabels`, `compare`, `band`, `progress`, `note`, `emptyText`, `empty` (show `emptyText` even with a value), `sublabel`, `size` (`normal` / `hero`), `tone` | `click`, `hover` (part `value`) |
70
- | `Tiles` | One tile per row: label, big number, caption | `label`, `value` (required), `caption`, `status`, `statusMap`, `valueTone`, `count`, `format`, `unit`, `columns`, `minTileWidth`, `wrap`, `selectable`, `selected` | `click`, `hover`, `select` (part `tile`) |
70
+ | `Tiles` | One tile per row: label, big number, caption | `label`, `value` (required), `caption`, `status`, `statusMap`, `valueTone`, `count`, `format`, `unit`, `columns`, `minTileWidth`, `wrap`, `chips`, `mutedWhen`, `highlightWhen`, `highlightTone`, `selectable`, `selected`; `value` may be a template over `row` (`"${row.value ?? row.passed}"`) | `click`, `hover`, `select` (part `tile`) |
71
71
  | `Gauge` | A value on an arc or circle with coloured bands | `min` (0), `max` (100), `bands: [{ to, tone }]`, `shape` (`arc` / `circle`), `unit`, `format`, `decimals` | `click` |
72
72
  | `Status` | A status badge from a state field, or fixed text | `state` (field, default `"state"`), `stateMap`, `labels`, `label`, `text`, `tone` | `click` |
73
73
 
@@ -147,7 +147,7 @@ Charts take their colours from the theme's `chart.series` tokens (see
147
147
 
148
148
  | Kind | What it shows | Main props | Events |
149
149
  |---|---|---|---|
150
- | `Table` | Rows and columns with sorting, search, filters, paging, totals and pivots | `columns` (below), `columnsFrom`, `totals`, `pivot`, `pagination`, `search`, `sorting`, `filtering`, `sticky`, `rowKey`, `rowMutedWhen`, `virtual`, `density`, `maxHeight` (px; rows scroll past it) | `rowClick`, `cellClick`, `hover` (parts `row`, `cell`) |
150
+ | `Table` | Rows and columns with sorting, search, filters, paging, totals and pivots | `columns` (below), `columnsFrom`, `totals`, `pivot`, `pagination`, `search`, `sorting`, `filtering`, `sticky`, `rowKey`, `rowMutedWhen`, `virtual`, `density`, `maxHeight` (px; rows scroll past it), `totalsRow`, `expand` (slot `detail`) | `rowClick`, `cellClick`, `hover` (parts `row`, `cell`) |
151
151
  | `CardGrid` | One card per row with fields, a status and a progress bar | `cardTitle` (required), `fields: [{ key, label, format, unit }]`, `status`, `statusMap`, `progress: { value, max, label }`, `badge`, `minCardWidth`, `selectable`, `selected`, `rowKey` | `click`, `select` (part `card`) |
152
152
 
153
153
  A table column is `{ key, label?, type?, … }`. `type` is `text`, `number`, `badge`,
@@ -155,7 +155,28 @@ A table column is `{ key, label?, type?, … }`. `type` is `text`, `number`, `ba
155
155
  `format`, `decimals`, `prefix`, `suffix`, `align`, `empty`, `template`
156
156
  (`"${row.first} ${row.last}"`), `list`, `map` (badge value → tone), `tone` (an
157
157
  expression over `row`), `href` (link template), `max` (progress), `width`, `sortable`,
158
- `filter` (`text` / `select` / `min`) and `filterOptions`.
158
+ `filter` (`text` / `select` / `min`) and `filterOptions`. For richer cells: `sub` (a second line,
159
+ template), `chips` (`[{ text, tone, when }]`, tags under the value shown when `when` holds),
160
+ `weight` (`regular` / `medium` / `semibold` / `bold`) and `valueTone` (an expression over `row` and
161
+ `value` returning a tone, `action` or `muted`).
162
+
163
+ `columnsFrom` builds columns from the data (`{ path, key, label }`). Its `column` is a pattern
164
+ applied to each generated column, with `{key}` and `{label}` filled in; with fixed `columns` too,
165
+ `after` puts the generated ones after that column:
166
+
167
+ ```json
168
+ "columns": [{ "key": "order", "label": "Order" }, { "key": "qty", "label": "Qty" }],
169
+ "columnsFrom": {
170
+ "path": "stages", "key": "id", "label": "name", "after": "qty",
171
+ "column": { "key": "stages.{key}.done", "chips": [{ "text": "${row.stages.{key}.waiting} waiting", "tone": "warn", "when": "row.stages.{key}.waiting > 0" }] }
172
+ }
173
+ ```
174
+
175
+ `totalsRow: { path, label }` draws a total row taken from the data (e.g. the API's own totals)
176
+ with the columns' options; `label` (a template over that row) fills the first column. Use it when
177
+ summing the shown rows isn't right (server paging). `expand: true` opens the `detail` slot under a
178
+ clicked row, with the row as `${item.*}`; the open row's key is in `panels.<id>.ui.expanded` and
179
+ the row in `ui.expandedRow`, so a datasource can fetch its details.
159
180
 
160
181
  ```json
161
182
  "orders": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashspec/renderer",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Draws a dashboard from DashSpec JSON: widgets, data, events, state.",
5
5
  "keywords": [
6
6
  "dashboard",