API reference: @salmonui/query-builder
QueryBuilderApiinterface
import type { QueryBuilderApi } from '@salmonui/query-builder';interface QueryBuilderApi {
getValue(): QueryGroup;
setValue(value: QueryGroup): void;
getValidValue(): QueryGroup;
getNode(id: string): QueryNode | null;
addRules(rules: readonly QueryRule[], groupId?: string): string[];
addGroups(groups: readonly QueryGroup[], groupId?: string): string[];
remove(ids: string | readonly string[]): void;
clone(id: string, options?: {
readonly parentId?: string;
readonly index?: number;
}): string | null;
lock(id: string, locked?: boolean): void;
validate(): boolean;
reset(): void;
focus(): void;
}
| Name | Signature | Description |
|---|---|---|
getValue | getValue(): QueryGroup; | |
setValue | setValue(value: QueryGroup): void; | |
getValidValue | getValidValue(): QueryGroup; | The value without incomplete rules and empty groups. |
getNode | getNode(id: string): QueryNode | null; | |
addRules | addRules(rules: readonly QueryRule[], groupId?: string): string[]; | Appends rules to the group |
addGroups | addGroups(groups: readonly QueryGroup[], groupId?: string): string[]; | |
remove | remove(ids: string | readonly string[]): void; | |
clone | clone(id: string, options?: {
readonly parentId?: string;
readonly index?: number;
}): string | null; | Copies a node next to itself (or into |
lock | lock(id: string, locked?: boolean): void; | |
validate | validate(): boolean; | Validates every rule, shows inline errors and returns whether the value is valid. |
reset | reset(): void; | Back to |
focus | focus(): void; | Moves focus to the first control. |