/** * Public, host-facing filter model for embedded AI/BI dashboards. * * These types are intentionally simpler than the dashboard's internal selection model. The embedded * (iframe) side translates this shape to and from `SerializedSelectionNode`, the same * representation the dashboard URL uses and must keep backwards-compatible, so the public contract * stays stable as the internal model evolves. */ /** * The type of filter. See the docs for more information on filter types * ([AWS](https://docs.databricks.com/aws/en/dashboards/manage/filter-types#filter-types) | * [Azure](https://learn.microsoft.com/en-us/azure/databricks/dashboards/manage/filter-types#filter-types) | * [GCP](https://docs.databricks.com/gcp/en/dashboards/manage/filter-types#filter-types)). */ export type FilterWidgetType = 'single-select' | 'multi-select' | 'text' | 'range' | 'date-picker' | 'date-range'; /** * A value a host can write to a filter via {@link DatabricksDashboard.setFilters}, * or read back from {@link DatabricksDashboard.getFilters}. Discriminated by the `type` field. * * Alongside concrete values, filters accept sentinel states that mirror the * dashboard's built-in options: * * - {@link SelectDefault} * - {@link SelectAll} * - {@link SelectNone} */ export type FilterValue = SingleSelectFilterValue | MultiSelectFilterValue | TextFilterValue | RangeFilterValue | DatePickerFilterValue | DateRangeFilterValue; /** * The "select everything" state available on certain filters. This essentially means * "no filter". For the single/multi-select filters this is the "All" option. On a * `range` / `date-range` endpoint it means that end is unbounded * (so `min: { all: true }, max: 10` is "≤ 10"). */ export type SelectAll = { all: true; }; /** * The "select nothing" state available on certain filters. This essentially means * "filter everything out". This mirrors the dashboard's "None" option. */ export type SelectNone = { none: true; }; /** * The "select default" state available on all filters. This will reset the filter to its * author-configured default. This mirrors the dashboard's "Default" option. */ export type SelectDefault = { default: true; }; /** * Fields common to every {@link FilterValue}. */ export interface BaseFilterValue { /** * The filter's URL identifier, as returned in {@link FilterState.id} from * {@link DatabricksDashboard.getFilters}. */ id: string; } export interface SingleSelectFilterValue extends BaseFilterValue { type: 'single-select'; /** * A single option value. {@link SelectAll} / {@link SelectNone} for the built-in All / None * options, or {@link SelectDefault}. An empty string (`''`) also resets to default. */ value: string | SelectAll | SelectNone | SelectDefault; /** * - `true` - Anything except {@link value} (ignored when {@link value} is a * sentinel — All / None / Default) * - `false` - Must include {@link value} * * @default false */ exclude?: boolean; } export interface MultiSelectFilterValue extends BaseFilterValue { type: 'multi-select'; /** * The selected option values. {@link SelectAll} / {@link SelectNone} for the built-in All / None * options, or {@link SelectDefault}. An empty array (`[]`) also resets to default. */ values: string[] | SelectAll | SelectNone | SelectDefault; /** * @see {@link SingleSelectFilterValue.exclude} * @default false */ exclude?: boolean; } export interface TextFilterValue extends BaseFilterValue { type: 'text'; /** * The search text. {@link SelectAll} to match everything, or {@link SelectDefault}. * An empty string (`''`) also resets to default. */ value: string | SelectAll | SelectDefault; } export interface RangeFilterValue extends BaseFilterValue { type: 'range'; /** * Lower bound. {@link SelectAll} for an unbounded low end, or * {@link SelectDefault} to reset the filter to its author default. */ min: number | SelectAll | SelectDefault; /** * Upper bound. {@link SelectAll} for an unbounded high end, or * {@link SelectDefault} to reset the filter to its author default. */ max: number | SelectAll | SelectDefault; } export interface DatePickerFilterValue extends BaseFilterValue { type: 'date-picker'; /** * An absolute ISO date (e.g., `2026-01-31`), datetime (e.g., `2026-01-31T00:00:00Z`), or a * relative-date token the dashboard produces. {@link SelectAll} for no constraint, or * {@link SelectDefault}. */ value: string | SelectAll | SelectDefault; } export interface DateRangeFilterValue extends BaseFilterValue { type: 'date-range'; /** * Range start. {@link SelectAll} for an unbounded start, or {@link SelectDefault}. * * @see {@link DatePickerFilterValue.value} for the string format. */ min: string | SelectAll | SelectDefault; /** * Range end. {@link SelectAll} for an unbounded end, or {@link SelectDefault}. * * @see {@link DatePickerFilterValue.value} for the string format. */ max: string | SelectAll | SelectDefault; } /** * The full observed state of a dashboard filter, returned by * {@link DatabricksDashboard.getFilters}. */ export interface FilterState { /** * The filter's **URL identifier** of the form `~`. Read it from * {@link DatabricksDashboard.getFilters} (use {@link displayName} to tell which filter is which) * and pass it back to {@link DatabricksDashboard.setFilters}. * * This doesn't change when the dashboard is edited, but it can be explicitly updated by going * to the dashboard editor, selecting the widget/page and using the **Update URL Identifier** * action. */ id: string; /** The kind of control, so hosts can render an appropriate input. */ widgetType: FilterWidgetType; /** * Human-readable filter title (the widget's configured title, falling back to its field name). * Author-controlled and not stable (it may change on rename or be non-unique), so use {@link id} * as the durable handle, not this. */ displayName: string; /** * True when the filter is showing its author-configured default value (viewer has not explicitly * changed it). Helps distinguish "at default" from an explicit empty selection. */ isDefault: boolean; /** * The current value of the filter. `undefined` when the filter is unset or * {@link FilterState.unsupportedValue its value cannot be represented}. */ value: FilterValue | undefined; /** * True when the filter holds a value that cannot be represented. Hosts should avoid * round-tripping such filters through {@link DatabricksDashboard.setFilters}. */ unsupportedValue: boolean; } /** * Options controlling how {@link DatabricksDashboard.setFilters} applies values. */ export interface SetFiltersOptions { /** * For dashboards in "apply mode" (selections staged until the viewer clicks "Apply"), whether to * commit the new values immediately (`true`) or just stage them (`false`). * * @default true */ apply?: boolean; } //# sourceMappingURL=EmbedFilters.d.ts.map