@lightdash/cli 2.249.0 → 2.250.1
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.
|
@@ -251,7 +251,8 @@ highlighted:
|
|
|
251
251
|
## The declaration
|
|
252
252
|
|
|
253
253
|
Alongside the component you emit one structured declaration — as **structured output, not a
|
|
254
|
-
file**. It has
|
|
254
|
+
file**. It has four parts: `fields`, `configOptions`, `colorPalette` and optional
|
|
255
|
+
`inputGuidance`. Lightdash builds
|
|
255
256
|
the field-mapping UI and the chart config panel from it, so the component is unusable
|
|
256
257
|
without it.
|
|
257
258
|
|
|
@@ -265,9 +266,26 @@ One entry per data column the component reads:
|
|
|
265
266
|
|
|
266
267
|
- `name` — the key read from `fieldMapping`. Unique, no spaces.
|
|
267
268
|
- `label` — human label shown in the mapping UI.
|
|
268
|
-
- `type` — `dimension` (a category/grouping column), `metric` (a numeric measure),
|
|
269
|
-
`series` (a dimension used to split or colour the chart)
|
|
269
|
+
- `type` — `dimension` (a category/grouping column), `metric` (a numeric measure),
|
|
270
|
+
`series` (a dimension used to split or colour the chart), or `column` (any result
|
|
271
|
+
column, whether metric or dimension).
|
|
270
272
|
- `required` — `false` only when the chart still renders with this field unmapped.
|
|
273
|
+
- `description` — optional reusable mapping help, maximum 160 characters. Use one
|
|
274
|
+
or two short, plain sentences explaining the field's role in the chart. Keep it agnostic
|
|
275
|
+
to any business, explore, or query; do not imply fixed categories or values.
|
|
276
|
+
|
|
277
|
+
Do not generate field examples. Viewers supply their own values; describe the field's
|
|
278
|
+
role and data shape without prescribing categories from a particular business.
|
|
279
|
+
|
|
280
|
+
### `inputGuidance`
|
|
281
|
+
|
|
282
|
+
Optional reusable help shown above the mappings, maximum 200 characters. Use at most two
|
|
283
|
+
short, plain sentences. State what each row represents, any ordering the visualization relies
|
|
284
|
+
on, and how to change a query that has a different shape.
|
|
285
|
+
For a funnel, say that each row contains one stage label and its count in stage order; separate
|
|
286
|
+
stage metrics or boolean flags need reshaping into stage/count rows, or a differently authored
|
|
287
|
+
chart. This explains how the same viz can be reused with other queries; it does not make the
|
|
288
|
+
component infer semantics or transform host data.
|
|
271
289
|
|
|
272
290
|
### `configOptions`
|
|
273
291
|
|
|
@@ -362,11 +380,12 @@ function Chart() {
|
|
|
362
380
|
The declaration that component emits is exactly:
|
|
363
381
|
|
|
364
382
|
```
|
|
365
|
-
fields: [{ "name": "category", "label": "Category", "type": "dimension", "required": true },
|
|
366
|
-
{ "name": "value", "label": "Value", "type": "metric", "required": true }]
|
|
383
|
+
fields: [{ "name": "category", "label": "Category", "type": "dimension", "required": true, "description": "The label for each chart row." },
|
|
384
|
+
{ "name": "value", "label": "Value", "type": "metric", "required": true, "description": "The numeric value for that row." }]
|
|
367
385
|
configOptions: [{ "name": "showLabels", "label": "Show value labels", "group": "Labels", "type": "boolean", "default": true },
|
|
368
386
|
{ "name": "maxBars", "label": "Max bars", "type": "number", "default": 10, "min": 1, "max": 50 }]
|
|
369
387
|
colorPalette: {}
|
|
388
|
+
inputGuidance: "Use one row per category in display order. Reshape queries with separate category columns into category/value rows before mapping."
|
|
370
389
|
```
|
|
371
390
|
|
|
372
391
|
## Final pass, before you finish
|
|
@@ -392,6 +411,11 @@ Then check both directions: every key you read from `options` is declared, and e
|
|
|
392
411
|
you declared is read somewhere. `colorPalette` is declared when you use either resolved-
|
|
393
412
|
colour helper or colour from `colorPalette` — it is never read from `options`.
|
|
394
413
|
|
|
414
|
+
Before returning the declaration, add a `description` to each slot whose role
|
|
415
|
+
could be ambiguous to a viewer, and add `inputGuidance` whenever row shape or ordering
|
|
416
|
+
matters. Keep that help reusable across queries: describe the chart contract rather than a
|
|
417
|
+
specific dataset.
|
|
418
|
+
|
|
395
419
|
Finally, if any mark maps to exactly one source row, the data-point action
|
|
396
420
|
menu is wired: each interactive datum carries `sourceRow`, the underlying-data
|
|
397
421
|
action is gated on `underlyingData.enabled`, and the drill action is gated on
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.250.1",
|
|
4
4
|
"description": "Lightdash CLI tool",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"@actions/core": "1.11.1",
|
|
23
23
|
"@aws-sdk/credential-providers": "3.995.0",
|
|
24
24
|
"@casl/ability": "6.8.0",
|
|
25
|
-
"@lightdash/common": "2.
|
|
26
|
-
"@lightdash/warehouses": "2.
|
|
25
|
+
"@lightdash/common": "2.250.1",
|
|
26
|
+
"@lightdash/warehouses": "2.250.1",
|
|
27
27
|
"@sidvind/better-ajv-errors": "7.0.0",
|
|
28
28
|
"@types/columnify": "1.5.1",
|
|
29
29
|
"ajv": "8.18.0",
|