@dashspec/renderer 0.1.9 → 0.1.11
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/CHANGELOG.md +31 -1
- package/README.md +1 -1
- package/dist/{chunk-5EYC4E5K.js → chunk-RSIUW5J4.js} +55 -8
- package/dist/chunk-RSIUW5J4.js.map +1 -0
- package/dist/{core-BBSo3c1f.d.ts → core-DchxX9ku.d.ts} +3 -2
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +153 -21
- package/dist/index.js.map +1 -1
- package/docs/README.md +1 -1
- package/docs/api.md +1 -1
- package/docs/data.md +1 -1
- package/docs/getting-started.md +1 -1
- package/docs/widgets.md +10 -5
- package/package.json +1 -1
- package/dist/chunk-5EYC4E5K.js.map +0 -1
package/docs/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
| Page | What it covers |
|
|
10
10
|
|---|---|
|
|
11
11
|
| [Getting started](getting-started.md) | Install, a first dashboard, loading JSON from your API, validating with `loadDocument`, what viewers see for invalid documents |
|
|
12
|
-
| [Widgets](widgets.md) | The
|
|
12
|
+
| [Widgets](widgets.md) | The 31 built-in widgets and their props, nesting with slots, and writing your own with `wrapComponent`, `defineWidget` and `lazyWidget` |
|
|
13
13
|
| [Data](data.md) | Connections and auth, every datasource type, transforms, refresh and cache, `${…}` templates, the expression language and its helpers, custom datasource types, errors |
|
|
14
14
|
| [State and events](state-and-events.md) | The state tree, widget events, every action with an example, named actions, `watch`, host actions, scripts, driving a dashboard from your app, URL sync |
|
|
15
15
|
| [Design systems](design-systems.md) | Bringing your own components, filter controls, empty / error / loading states and custom filter kinds; combining design systems; aliasing built-ins |
|
package/docs/api.md
CHANGED
|
@@ -408,7 +408,7 @@ See [Widgets](widgets.md) for a guide.
|
|
|
408
408
|
| `wrapComponent(Component, options)` | Turns any React component into a widget by mapping props, events, state writes and slots (`WrapOptions`) |
|
|
409
409
|
| `lazyWidget(def)` | A widget whose code downloads only when a dashboard uses it (`load: () => import(…)`, optional `fallback`) |
|
|
410
410
|
| `checkWidget(def)` | Returns a list of contract problems (empty when fine). Use it in your tests |
|
|
411
|
-
| `builtInWidgets` | The
|
|
411
|
+
| `builtInWidgets` | The 31 built-in widget definitions |
|
|
412
412
|
| `createWidgetRegistry(builtIns, extra, aliases)` | Builds the kind → widget map the renderer uses (throws on un-namespaced or duplicate kinds). `WidgetRegistry` type |
|
|
413
413
|
|
|
414
414
|
Types: `WidgetDefinition`, `AnyWidgetDefinition` (for lists of widgets with different
|
package/docs/data.md
CHANGED
|
@@ -497,7 +497,7 @@ Reading a member of `null` or `undefined` gives `undefined` instead of an error.
|
|
|
497
497
|
| `fmt.compact(v)` | `12.3K` |
|
|
498
498
|
| `fmt.percent(v, decimals = 0)` | `42.5%` (`v` is already a percentage) |
|
|
499
499
|
| `fmt.duration(seconds)` | `1 hr 1 min` |
|
|
500
|
-
| `fmt.date(v, style = "date")` | A date; `style` `"date"`, `"datetime"` or `"time"`, in the dashboard's time zone |
|
|
500
|
+
| `fmt.date(v, style = "date")` | A date; `style` `"date"`, `"datetime"` or `"time"`, or the parts you want (`{ weekday: 'short', day: 'numeric', month: 'short' }`), in the dashboard's locale and time zone |
|
|
501
501
|
| `fmt.ago(v)` | `just now`, `3 min ago`, `2 hr ago`, `4 days ago` |
|
|
502
502
|
| `t.<key>` | `display.translations` text for the active locale, else the first locale's, else the key ([JSON format](json-format.md#specdisplay)) |
|
|
503
503
|
|
package/docs/getting-started.md
CHANGED
|
@@ -231,7 +231,7 @@ Report these to your monitoring with `onError`:
|
|
|
231
231
|
|
|
232
232
|
## Next steps
|
|
233
233
|
|
|
234
|
-
- [Widgets](widgets.md): the
|
|
234
|
+
- [Widgets](widgets.md): the 31 built-in widgets, nesting, and writing your own.
|
|
235
235
|
- [Data](data.md): connections, auth, datasources, templates and expressions.
|
|
236
236
|
- [State and events](state-and-events.md): clicks, actions, filters, and driving a dashboard from your app.
|
|
237
237
|
- [Design systems](design-systems.md): use your own components and controls.
|
package/docs/widgets.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Widgets
|
|
2
2
|
|
|
3
3
|
Every box on a dashboard is a **node** in `spec.panels`: a `kind` (which widget) and a
|
|
4
|
-
`spec` (that widget's props). The renderer ships
|
|
4
|
+
`spec` (that widget's props). The renderer ships 31 built-in widgets, and you can add
|
|
5
5
|
your own.
|
|
6
6
|
|
|
7
7
|
```json
|
|
@@ -19,7 +19,7 @@ your own.
|
|
|
19
19
|
## Props every widget shares
|
|
20
20
|
|
|
21
21
|
Besides its own props, every built-in widget except the atoms (Text, Value, Progress,
|
|
22
|
-
Icon, Divider) accepts these in `spec`:
|
|
22
|
+
Icon, Divider, Button) accepts these in `spec`:
|
|
23
23
|
|
|
24
24
|
| Prop | Type | What it does |
|
|
25
25
|
|---|---|---|
|
|
@@ -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`, `chips`, `mutedWhen`, `highlightWhen`, `highlightTone`, `selectable`, `selected`; `value` may be a template over `row` (`"${row.value ?? row.passed}"`) | `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`, `captionInline` (caption right after the number), `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
|
|
|
@@ -199,6 +199,9 @@ the row in `ui.expandedRow`, so a datasource can fetch its details.
|
|
|
199
199
|
}
|
|
200
200
|
```
|
|
201
201
|
|
|
202
|
+
`pagination` also takes `layout` (`"pages"`, numbered pages, or `"simple"`: "Showing 1–25 of 223
|
|
203
|
+
rows", Previous, "Page 1 of 9", Next) and `sizes: false` to hide the rows-per-page picker.
|
|
204
|
+
|
|
202
205
|
`pagination`, `search`, `sorting` and `filtering` each take `mode: "client"` (the table
|
|
203
206
|
works on the rows it has) or `"server"` (the table writes `page`, `pageSize`, `search`,
|
|
204
207
|
`sortKey`, `sortOrder`, `ordering` or `filters` to `panels.<id>.ui`, and your datasource
|
|
@@ -292,6 +295,7 @@ Small pieces for building your own cards inside `Card`, `Row` or a header slot.
|
|
|
292
295
|
| `Progress` | A progress bar | `field`, `max`, `color`, `goodFrom`, `showPercent`, `thickness` | none |
|
|
293
296
|
| `Icon` | An icon: `bolt`, `fire`, `factory`, `clock`, `check`, `alert`, `up`, `down`, `gauge`, `box`, `user`, `money` | `icon`, `size`, `color`, `background` | `click` |
|
|
294
297
|
| `Divider` | A line | `direction`, `dashed` | none |
|
|
298
|
+
| `Button` | A button that runs the panel's `on.click` | `label`, `icon` (incl. `arrow-left`, `arrow-right`), `iconAfter`, `variant` (`primary` / `secondary` / `subtle` / `link`), `size` (`sm` / `md`), `disabled` (e.g. `"${datasources.trend.data.meta.prev == null}"`), `ariaLabel` | `click` |
|
|
295
299
|
|
|
296
300
|
```json
|
|
297
301
|
"revenueCard": {
|
|
@@ -330,8 +334,9 @@ top-level nodes go in `layouts`; nested ones live only in their parent's slot.
|
|
|
330
334
|
|
|
331
335
|
The rules:
|
|
332
336
|
|
|
333
|
-
- **Every node** has a `header` slot (next to the title)
|
|
334
|
-
|
|
337
|
+
- **Every node** has a `header` slot (next to the title), a `toolbar` slot (a row under the
|
|
338
|
+
title, above the body: navigation, actions, notes) and a `footer` slot (under the body).
|
|
339
|
+
The header takes only small widgets: atoms, `Status`, `Content`, `Filter`.
|
|
335
340
|
- Layout widgets add their own: `items` (Container, Row, Column), `body` (Card), one
|
|
336
341
|
slot per tab `key` (Tabs), `item` (Repeater).
|
|
337
342
|
- A node sits in **one place**: on the grid or in one slot.
|