@malloy-publisher/sdk 0.8.3 → 0.8.4
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/README.md +14 -65
- package/dist/{DocumentStorage-CigwNjz4.es.js → Dashboard-DnqWRijB.es.js} +23660 -23575
- package/dist/Dashboard-FD3-Af-_.cjs.js +136 -0
- package/dist/{RenderedResult-BfayOSk1.es.js → RenderedResult-6UKAHaAj.es.js} +18 -18
- package/dist/{RenderedResult-DpHdrFtp.cjs.js → RenderedResult-CetSzFgW.cjs.js} +1 -1
- package/dist/ServerProvider-BsjJvkML.cjs.js +1 -0
- package/dist/{ServerProvider-CfUFleYe.es.js → ServerProvider-DgRFJ43L.es.js} +983 -957
- package/dist/builder/index.cjs.js +50 -50
- package/dist/builder/index.es.js +2587 -2511
- package/dist/client/api.d.ts +141 -40
- package/dist/client/configuration.d.ts +1 -1
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.es.js +62 -59
- package/dist/components/DashboardBuilder/malloyText.d.ts +49 -0
- package/dist/components/DashboardBuilder/malloyTree.d.ts +2 -18
- package/dist/components/DashboardBuilder/readDocument.d.ts +2 -0
- package/dist/components/Notebook/NotebookCell.d.ts +3 -2
- package/dist/components/Notebook/cellKind.d.ts +20 -0
- package/dist/index.cjs.js +15 -12
- package/dist/index.es.js +4528 -4435
- package/package.json +1 -1
- package/src/components/DashboardBuilder/malloyText.spec.ts +70 -1
- package/src/components/DashboardBuilder/malloyText.ts +171 -3
- package/src/components/DashboardBuilder/malloyTree.spec.ts +35 -0
- package/src/components/DashboardBuilder/malloyTree.ts +28 -4
- package/src/components/DashboardBuilder/readDocument.spec.ts +180 -1
- package/src/components/DashboardBuilder/readDocument.ts +52 -14
- package/src/components/DashboardBuilder/spliceDocument.spec.ts +396 -2
- package/src/components/DashboardBuilder/spliceDocument.ts +121 -18
- package/src/components/Notebook/Notebook.served.spec.tsx +175 -0
- package/src/components/Notebook/Notebook.spec.tsx +33 -2
- package/src/components/Notebook/Notebook.tsx +13 -7
- package/src/components/Notebook/NotebookCell.tsx +124 -63
- package/src/components/Notebook/cellKind.spec.ts +191 -0
- package/src/components/Notebook/cellKind.ts +74 -0
- package/src/components/Package/Package.notebooks.spec.tsx +90 -0
- package/src/components/Package/Package.tsx +18 -4
- package/dist/DocumentStorage-DvUNSOiN.cjs.js +0 -134
- package/dist/ServerProvider-CuYLH_Yi.cjs.js +0 -1
package/README.md
CHANGED
|
@@ -572,8 +572,9 @@ const embedded = createEmbeddedQueryResult({
|
|
|
572
572
|
## Dimensional Filters
|
|
573
573
|
|
|
574
574
|
The SDK supports interactive dimensional filtering for hand-built data apps.
|
|
575
|
-
|
|
576
|
-
component does not use this mechanism; see
|
|
575
|
+
You configure each filter in code, with a `dimensionSpecs` entry passed to the
|
|
576
|
+
hooks below. The `Notebook` component does not use this mechanism; see
|
|
577
|
+
[Notebooks use `given:`](#notebooks-use-given-not-these-annotations) below.
|
|
577
578
|
|
|
578
579
|
### Filter Types
|
|
579
580
|
|
|
@@ -585,69 +586,17 @@ component does not use this mechanism; see [Notebooks use `given:`](#notebooks-u
|
|
|
585
586
|
| `Retrieval` | Semantic search input | Free-text semantic search |
|
|
586
587
|
| `Boolean` | Toggle switch | Boolean fields |
|
|
587
588
|
|
|
588
|
-
###
|
|
589
|
+
### Choosing a filter type and label
|
|
589
590
|
|
|
590
|
-
|
|
591
|
+
Set `filterType` and `label` on each `dimensionSpecs` entry, as in the hook
|
|
592
|
+
example below. The model needs no annotation for this.
|
|
591
593
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
// Range slider for numeric values
|
|
600
|
-
#(filter) {"type": "MinMax"}
|
|
601
|
-
distance_miles is distance
|
|
602
|
-
|
|
603
|
-
// Date range picker
|
|
604
|
-
#(filter) {"type": "DateMinMax"}
|
|
605
|
-
flight_departure is dep_time
|
|
606
|
-
|
|
607
|
-
join_one: carriers with carrier
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
source: carriers is duckdb.table('data/carriers.parquet') extend {
|
|
611
|
-
dimension:
|
|
612
|
-
#(filter) {"type": "Star"}
|
|
613
|
-
nickname is nickname_old
|
|
614
|
-
|
|
615
|
-
// Semantic search for text fields (requires embedding index)
|
|
616
|
-
#(index_values) n=-1
|
|
617
|
-
#(filter) {"type": "Retrieval"}
|
|
618
|
-
name is name_old
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
source: recalls is duckdb.table('data/recalls.csv') extend {
|
|
622
|
-
dimension:
|
|
623
|
-
// Boolean toggle filter
|
|
624
|
-
#(filter) {"type": "Boolean"}
|
|
625
|
-
is_major_recall is potentially_affected > 100000
|
|
626
|
-
}
|
|
627
|
-
```
|
|
628
|
-
|
|
629
|
-
### Custom Labels
|
|
630
|
-
|
|
631
|
-
By default, filters display the dimension field name in the UI. You can customize the display label using the `# label="..."` annotation:
|
|
632
|
-
|
|
633
|
-
```malloy
|
|
634
|
-
source: recalls is duckdb.table('data/recalls.csv') extend {
|
|
635
|
-
dimension:
|
|
636
|
-
#(filter) {"type": "Star"}
|
|
637
|
-
# label="Vehicle Manufacturer"
|
|
638
|
-
Manufacturer is Manufacturer_old
|
|
639
|
-
|
|
640
|
-
#(filter) {"type": "Retrieval"}
|
|
641
|
-
# label="Recall Subject"
|
|
642
|
-
Subject is Subject_old
|
|
643
|
-
|
|
644
|
-
#(filter) {"type": "MinMax"}
|
|
645
|
-
# label="Number of Affected Vehicles"
|
|
646
|
-
potentially_affected is affected_count
|
|
647
|
-
}
|
|
648
|
-
```
|
|
649
|
-
|
|
650
|
-
The `# label="..."` annotation can be placed before or after the `#(filter)` annotation. When present, the label value will be displayed in the filter UI instead of the raw field name.
|
|
594
|
+
Do not add a `#(filter) {"type": "..."}` annotation to a dimension to pick the
|
|
595
|
+
type. `#(filter)` is deprecated in every form, and this JSON form is legacy
|
|
596
|
+
syntax. `extractDimensionSpecs` still reads it, and `# label="..."`, from a
|
|
597
|
+
model that already has them, so existing apps keep working. To make a model
|
|
598
|
+
filterable by its callers, declare a `given:` on the source instead; see
|
|
599
|
+
[docs/givens.md](../../docs/givens.md).
|
|
651
600
|
|
|
652
601
|
### Notebooks use `given:`, not these annotations
|
|
653
602
|
|
|
@@ -657,8 +606,8 @@ come from the `given:` parameters its model declares, which is the mechanism
|
|
|
657
606
|
described in [docs/givens.md](../../docs/givens.md). A `##(filters)` annotation in
|
|
658
607
|
a notebook cell is inert.
|
|
659
608
|
|
|
660
|
-
The
|
|
661
|
-
|
|
609
|
+
The hooks below still work. They are what a hand-built data app uses; only the
|
|
610
|
+
notebook's own panel changed.
|
|
662
611
|
|
|
663
612
|
### React Hooks for Programmatic Filtering
|
|
664
613
|
|