@lightdash/cli 1.248.2 → 1.249.0

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.
@@ -35,6 +35,7 @@ const {
35
35
  pivotDetails,
36
36
  ready,
37
37
  underlyingData,
38
+ drillDown,
38
39
  } = useVizContext();
39
40
  ```
40
41
 
@@ -51,6 +52,8 @@ const {
51
52
  - `ready` — false until the first context arrives.
52
53
  - `underlyingData` — host-mediated access to the raw rows behind a clicked data point.
53
54
  See "Data-point actions" below.
55
+ - `drillDown` — host-mediated drill on a clicked data point. See "Data-point
56
+ actions" below.
54
57
 
55
58
  Read all of them. Ignoring `options` and `colorPalette` is the most common way to build a
56
59
  viz nobody can configure.
@@ -153,9 +156,14 @@ declared series fields builds its label from each matching `pivotValues` entry i
153
156
  field order. Backend-pivoted rows do not have safe one-source-row provenance, so the host
154
157
  sets `underlyingData.enabled` to false for them.
155
158
 
156
- ## Data-point actions: underlying data
159
+ ## Data-point actions: underlying data and drill-down
157
160
 
158
- When `underlyingData.enabled` is true, viewers expect the standard Lightdash action on
161
+ Every chart whose marks satisfy the provenance rule below MUST wire the data-point
162
+ action menu. This is part of the component contract, not an optional nicety — a
163
+ "keep it minimal" prompt does not waive it. The flags decide at RUNTIME whether each
164
+ item shows; you always write the wiring, and it costs nothing visually when disabled.
165
+
166
+ When `underlyingData.enabled` is true, viewers get the standard Lightdash action on
159
167
  chart marks: click a data point → small action menu → "View underlying data" → a dialog
160
168
  listing the raw rows behind that point, with a Download button. When it is false (host
161
169
  too old, viewer lacks permission, embed), render no menu item — never a disabled one.
@@ -203,6 +211,24 @@ overflow container's horizontal scroll dead — the table looks clipped and view
203
211
  cannot reach the right-hand columns. Verify by scrolling right in the rendered
204
212
  dialog with more columns than fit.
205
213
 
214
+ ### Drill into a data point
215
+
216
+ When `drillDown.enabled` is true, the same data-point action menu also offers
217
+ "Drill into *{formatted metric value}*" (e.g. "Drill into $1,234"). On
218
+ selection, fire the intent and render nothing else — Lightdash opens its own
219
+ drill dialog outside the viz:
220
+
221
+ ```tsx
222
+ drillDown.open({ row: datum.sourceRow, metric: 'value' }).catch(() => {});
223
+ ```
224
+
225
+ `metric` is the declared field NAME, exactly as for `underlyingData`. The same
226
+ provenance contract applies: the item appears only where one mark maps to
227
+ exactly ONE source row and ONE metric-slot field, and only when
228
+ `drillDown.enabled` — never a disabled item. The two flags are independent:
229
+ show each action on its own flag (a viewer may have one permission but not
230
+ the other).
231
+
206
232
  ## The declaration
207
233
 
208
234
  Alongside the component you emit one structured declaration — as **structured output, not a
@@ -334,5 +360,8 @@ Then check both directions: every key you read from `options` is declared, and e
334
360
  you declared is read somewhere. `colorPalette` is declared when you colour from
335
361
  `colorPalette` — it is never read from `options`.
336
362
 
337
- Finally, if the chart has clickable marks: each interactive datum carries `sourceRow`,
338
- and the data-point action menu is gated on `underlyingData.enabled`.
363
+ Finally, if any mark maps to exactly one source row, the data-point action
364
+ menu is wired: each interactive datum carries `sourceRow`, the underlying-data
365
+ action is gated on `underlyingData.enabled`, and the drill action is gated on
366
+ `drillDown.enabled`. Omitting the menu on a chart whose marks satisfy
367
+ provenance is a defect, not a simplification.
@@ -20,6 +20,7 @@ Users describe features by what they see in the Lightdash editor. Translate:
20
20
  | "select an element", editor element picker | `inspect` | none (automatic) |
21
21
  | thumbnails / screenshots / scheduled deliveries | `screenshot` | required — see below |
22
22
  | drill down, click into a chart | `drill-down` | app code opt-in |
23
+ | drill into a viz data point (reusable visualization) | `viz-drill-down` | app code opt-in |
23
24
  | "share this view", URL that restores state | `url-state` | app code opt-in |
24
25
  | Google Sheets export | `gsheet-export` | app code opt-in |
25
26
  | "delivery has all tabs", full data in scheduled deliveries | `delivery-render` | app code opt-in |
@@ -102,6 +103,10 @@ order, `sortBy` describes result ordering, `totalColumnCount` exposes truncation
102
103
 
103
104
  - `drill-down`: `drillDown(...)` derives a more detailed query from a clicked
104
105
  result row — wire it to click handlers on charts/rows.
106
+ - `viz-drill-down`: in a reusable visualization, the data-point action menu
107
+ offers "Drill into …" when `useVizContext().drillDown.enabled`; selection
108
+ calls `drillDown.open({ row, metric })` and Lightdash opens its drill
109
+ dialog. Distinct from `drill-down`, which is the full-app query helper.
105
110
  - `url-state`: `useUrlState(...)` syncs a piece of app state into the page URL
106
111
  so views can be shared and restored.
107
112
  - `gsheet-export`: `exportToSheets(...)` sends tabular results to a new
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "1.248.2",
3
+ "version": "1.249.0",
4
4
  "description": "Lightdash CLI tool",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -45,8 +45,8 @@
45
45
  "unique-names-generator": "4.7.1",
46
46
  "uuid": "11.1.1",
47
47
  "yaml": "2.8.3",
48
- "@lightdash/common": "1.248.2",
49
- "@lightdash/warehouses": "1.248.2"
48
+ "@lightdash/warehouses": "1.249.0",
49
+ "@lightdash/common": "1.249.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/inquirer": "8.2.4",