Function: dashboardFilterToLeaf()
function dashboardFilterToLeaf(filter:
| {
field: string;
id: string;
kind: "date-range";
label: string;
}
| {
field: string;
id: string;
kind: "select";
label: string;
multiple?: boolean;
searchable?: boolean;
}
| {
defaultOperator?: "gt" | "lt" | "gte" | "lte" | "eq";
field: string;
format?: "number" | "currency";
id: string;
kind: "measure";
label: string;
operators?: ("gt" | "lt" | "gte" | "lte" | "eq")[];
}
| {
field: string;
id: string;
kind: "search";
label: string;
}, value:
| {
from: string;
kind: "date-range";
to: string | null;
}
| {
kind: "select";
values: string[];
}
| {
kind: "measure";
operator: "gt" | "lt" | "gte" | "lte" | "eq";
value: number;
}
| {
kind: "search";
text: string;
}
| undefined):
| {
field: string;
kind: "condition";
operator: "eq";
value: string | number | boolean;
}
| {
field: string;
kind: "condition";
operator: "neq";
value: string | number | boolean;
}
| {
field: string;
kind: "condition";
operator: "gt";
value: string | number;
}
| {
field: string;
kind: "condition";
operator: "lt";
value: string | number;
}
| {
field: string;
kind: "condition";
operator: "gte";
value: string | number;
}
| {
field: string;
kind: "condition";
operator: "lte";
value: string | number;
}
| {
field: string;
kind: "condition";
operator: "contains";
value: string;
}
| {
field: string;
kind: "condition";
operator: "in";
value: (string | number | boolean)[];
}
| {
field: string;
kind: "condition";
operator: "between";
value: {
from: string | number;
to: string | number;
};
}
| {
field: string;
kind: "condition";
operator: "isNull";
}
| {
field: string;
kind: "condition";
operator: "isNotNull";
}
| undefined;Defined in: shared/insights/types/dashboard-filter.ts:239
Compile one filter + its active value to a ConditionLeaf, or
undefined when the value is empty, cleared, or incomplete — the same holes
the builder's leafValueWarning treats as "nothing to apply yet". Returns
undefined too when the value's kind does not match the descriptor's,
which a well-behaved bar never produces but a hostile client might.
Parameters
| Parameter | Type |
|---|---|
filter | | { field: string; id: string; kind: "date-range"; label: string; } | { field: string; id: string; kind: "select"; label: string; multiple?: boolean; searchable?: boolean; } | { defaultOperator?: "gt" | "lt" | "gte" | "lte" | "eq"; field: string; format?: "number" | "currency"; id: string; kind: "measure"; label: string; operators?: ("gt" | "lt" | "gte" | "lte" | "eq")[]; } | { field: string; id: string; kind: "search"; label: string; } |
value | | { from: string; kind: "date-range"; to: string | null; } | { kind: "select"; values: string[]; } | { kind: "measure"; operator: "gt" | "lt" | "gte" | "lte" | "eq"; value: number; } | { kind: "search"; text: string; } | undefined |
Returns
| {
field: string;
kind: "condition";
operator: "eq";
value: string | number | boolean;
}
| {
field: string;
kind: "condition";
operator: "neq";
value: string | number | boolean;
}
| {
field: string;
kind: "condition";
operator: "gt";
value: string | number;
}
| {
field: string;
kind: "condition";
operator: "lt";
value: string | number;
}
| {
field: string;
kind: "condition";
operator: "gte";
value: string | number;
}
| {
field: string;
kind: "condition";
operator: "lte";
value: string | number;
}
| {
field: string;
kind: "condition";
operator: "contains";
value: string;
}
| {
field: string;
kind: "condition";
operator: "in";
value: (string | number | boolean)[];
}
| {
field: string;
kind: "condition";
operator: "between";
value: {
from: string | number;
to: string | number;
};
}
| {
field: string;
kind: "condition";
operator: "isNull";
}
| {
field: string;
kind: "condition";
operator: "isNotNull";
}
| undefined