@malloy-publisher/sdk 0.0.146 → 0.0.148

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 CHANGED
@@ -634,6 +634,29 @@ source: recalls is duckdb.table('data/recalls.csv') extend {
634
634
  }
635
635
  ```
636
636
 
637
+ ### Custom Labels
638
+
639
+ By default, filters display the dimension field name in the UI. You can customize the display label using the `# label="..."` annotation:
640
+
641
+ ```malloy
642
+ source: recalls is duckdb.table('data/recalls.csv') extend {
643
+ dimension:
644
+ #(filter) {"type": "Star"}
645
+ # label="Vehicle Manufacturer"
646
+ Manufacturer is Manufacturer_old
647
+
648
+ #(filter) {"type": "Retrieval"}
649
+ # label="Recall Subject"
650
+ Subject is Subject_old
651
+
652
+ #(filter) {"type": "MinMax"}
653
+ # label="Number of Affected Vehicles"
654
+ potentially_affected is affected_count
655
+ }
656
+ ```
657
+
658
+ 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.
659
+
637
660
  ### Notebook Annotation Syntax
638
661
 
639
662
  Enable filters in a notebook by adding a `##(filters)` annotation in a Malloy code cell. This annotation specifies which dimensions should appear as filters using `source.dimension` format:
@@ -665,9 +688,9 @@ const config: DimensionFiltersConfig = {
665
688
  package: "faa",
666
689
  indexLimit: 1000,
667
690
  dimensionSpecs: [
668
- { dimensionName: "origin_code", filterType: "Star", source: "flights", model: "flights.malloy" },
669
- { dimensionName: "distance", filterType: "MinMax", source: "flights", model: "flights.malloy" },
670
- { dimensionName: "dep_time", filterType: "DateMinMax", source: "flights", model: "flights.malloy" },
691
+ { dimensionName: "origin_code", filterType: "Star", source: "flights", model: "flights.malloy", label: "Origin Airport" },
692
+ { dimensionName: "distance", filterType: "MinMax", source: "flights", model: "flights.malloy", label: "Distance (miles)" },
693
+ { dimensionName: "dep_time", filterType: "DateMinMax", source: "flights", model: "flights.malloy", label: "Departure Time" },
671
694
  ],
672
695
  };
673
696
 
@@ -5,5 +5,5 @@ interface ResultContainerProps {
5
5
  hideToggle?: boolean;
6
6
  maxResultSize?: number;
7
7
  }
8
- export default function ResultContainer({ result, minHeight, maxHeight, hideToggle, maxResultSize, }: ResultContainerProps): import("react/jsx-runtime").JSX.Element;
8
+ export default function ResultContainer({ result, minHeight, maxHeight, hideToggle: _hideToggle, maxResultSize, }: ResultContainerProps): import("react/jsx-runtime").JSX.Element;
9
9
  export {};
@@ -37,6 +37,11 @@ export declare function parseNotebookFilterAnnotation(annotations: string[] | un
37
37
  * Returns the filter annotation or null if not found
38
38
  */
39
39
  export declare function parseDimensionFilterAnnotation(annotation: string): DimensionFilterAnnotation | null;
40
+ /**
41
+ * Parse # label="..." annotation from a dimension annotation string
42
+ * Returns the label value or null if not found
43
+ */
44
+ export declare function parseLabelAnnotation(annotation: string): string | null;
40
45
  /**
41
46
  * Parse all source infos from notebook cells and create a map of source_name -> SourceInfo
42
47
  * Also returns the model path from the first import statement found
@@ -15,6 +15,8 @@ export interface DimensionSpec {
15
15
  source: string;
16
16
  /** Model path */
17
17
  model: string;
18
+ /** Label to display in the UI (derived from # label="..." annotation) */
19
+ label?: string;
18
20
  /** Minimum similarity score for Retrieval filter type (default: 0.1) */
19
21
  minSimilarityScore?: number;
20
22
  /** Optional list of static values to use for the dropdown instead of querying */