View as Markdown

API reference: @salmonui/query-builder

QueryFieldinterface

import type { QueryField } from '@salmonui/query-builder';
interface QueryField {
    readonly field: string;
    readonly label?: string | undefined;
    readonly type?: QueryFieldType | undefined;
    readonly operators?: readonly string[] | undefined;
    readonly values?: readonly QueryFieldValue[] | undefined;
    readonly defaultValue?: Json | undefined;
    readonly format?: string | FormatOptions | undefined;
    readonly step?: number | undefined;
    readonly validation?: FieldValidation | undefined;
    readonly category?: string | undefined;
    readonly fields?: readonly QueryField[] | undefined;
    readonly renderValueEditor?: ((ctx: QueryValueEditorContext) => ReactNode) | undefined;
}
QueryField members (12)
NameSignatureDescription
fieldreadonly field: string;

Field name; with fields it is the path segment of the children.

labeloptionalreadonly label?: string | undefined;
typeoptionalreadonly type?: QueryFieldType | undefined;

Default 'string'.

operatorsoptionalreadonly operators?: readonly string[] | undefined;

Operators offered (Data Grid filter operator names or custom ones); default per type (operatorsFor).

valuesoptionalreadonly values?: readonly QueryFieldValue[] | undefined;

Fixed values: a Select (or a multiple Select for in / notIn).

defaultValueoptionalreadonly defaultValue?: Json | undefined;

Value of a new rule on this field.

formatoptionalreadonly format?: string | FormatOptions | undefined;

Display format of values (summary): a Data Grid format ('N2', 'C2', 'yMMMd', 'dd/MM/yyyy') or format options.

stepoptionalreadonly step?: number | undefined;

Step of the numeric editor.

validationoptionalreadonly validation?: FieldValidation | undefined;

Rules of the value (the Form rule vocabulary), checked by validation / api.validate().

categoryoptionalreadonly category?: string | undefined;

Group of the field in the field list.

fieldsoptionalreadonly fields?: readonly QueryField[] | undefined;

Nested fields: paths parent.child with pathSeparator. A field with children is not selectable itself.

renderValueEditoroptionalreadonly renderValueEditor?: ((ctx: QueryValueEditorContext) => ReactNode) | undefined;

Custom value editor.