Core API

Data

Query tree types
export type QueryGroupValue = 'AND' | 'OR';
export type QueryGroupType = 'with-modifiers' | 'without-modifiers';
export type GroupReadOnlyTarget = 'negation' | 'combinator';
export type RuleReadOnlyTarget = 'field' | 'operator' | 'value';
export type QueryRuleValueSource = 'value' | 'field';
export interface IGroupReadOnlyConfig {
enabled: boolean;
targets?: GroupReadOnlyTarget[];
inheritToChildren?: boolean;
}
export interface IRuleReadOnlyConfig {
enabled: boolean;
targets?: RuleReadOnlyTarget[];
}
export type QueryRuleValue =
| string
| number
| string[]
| number[]
| boolean;
export interface ILiteralRuleNode {
id?: string;
parent?: string;
field: string;
valueSource?: 'value';
value?: QueryRuleValue;
valueField?: undefined;
operator?: QueryOperator;
operators?: QueryOperator[];
readOnly?: boolean | IRuleReadOnlyConfig;
}
export interface IFieldReferenceRuleNode {
id?: string;
parent?: string;
field: string;
valueSource: 'field';
value?: undefined;
valueField: string;
operator?: QueryOperator;
operators?: QueryOperator[];
readOnly?: boolean | IRuleReadOnlyConfig;
}
export type IDenormalizedRuleNode = ILiteralRuleNode | IFieldReferenceRuleNode;
export interface IDenormalizedGroupNodeBase {
id?: string;
parent?: string;
type: 'GROUP';
children: DenormalizedNode[];
readOnly?: boolean | IGroupReadOnlyConfig;
}
export type DenormalizedQuery = DenormalizedNode[];
Field-reference rule data
const rule: IDenormalizedRuleNode = {
field: 'ORDER_TOTAL',
operator: 'LARGER_EQUAL',
valueSource: 'field',
valueField: 'ORDER_APPROVAL_LIMIT',
};

Rule props

  • field Required field identifier matching one of the configured fields.
  • operator Optional operator for the rule. Some field and operator combinations imply different value shapes.
  • valueSource Optional discriminant. Omit it or set 'value' for literal comparisons, or set 'field' for right-hand-side field references.
  • value Optional literal rule value used when valueSource is omitted or set to 'value'. Supported scalar and array forms are defined by QueryRuleValue.
  • valueField Required when valueSource is 'field'. Stores the compared field identifier instead of a literal value.
  • operators Optional rule-level operator override list.
  • readOnly Optional per-rule lock definition. Supported shapes are false or omitted, true, or { enabled: boolean; targets?: ('field' | 'operator' | 'value')[] }.
  • readOnly.targets Part of the readOnly object config. Rule targets are 'field', 'operator', and 'value'. Targeted controls stay visible but become non-editable.
  • readOnly.enabled Part of the readOnly object config. When true, the listed targets are protected. When readOnly.targets is omitted, the whole rule is read-only.
  • Delete behavior A rule with any effective read-only target is also non-deletable, and cloned rules preserve the same read-only configuration.
  • GUI cycle When lockable is enabled, rules cycle between unlocked and locked. Object-based readOnly.targets are preserved when the user unlocks and re-locks the same rule.
  • id and parent Optional in denormalized input. The builder can ingest data without them.

Group props

  • type Always 'GROUP'.
  • children Required nested nodes.
  • value Present only for groups with modifiers and must be 'AND' or 'OR'.
  • isNegated Present only for groups with modifiers.
  • readOnly Can be false or omitted, true, or { enabled: boolean; targets?: ('negation' | 'combinator')[]; inheritToChildren?: boolean }.
  • readOnly: true Locks only the group's own controls by default. Descendant rules and groups remain editable unless inheritance is enabled.
  • readOnly.targets Part of the readOnly object config. Group targets are 'negation' and 'combinator'. Targeted controls stay visible but become non-editable.
  • readOnly.enabled Part of the readOnly object config. When true, the listed targets are protected. When readOnly.targets is omitted, the whole group is read-only.
  • readOnly.inheritToChildren Part of the readOnly object config. Applies the group lock to descendant groups and their children when the group is enabled.
  • Delete behavior A group cannot be deleted when it has effective read-only targets. By default, it also cannot be deleted when that would remove protected descendants indirectly. This subtree behavior can be disabled with Builder.readOnlyProtectsDelete=.
  • GUI cycle When lockable is enabled, groups cycle through unlocked, locked group only, and locked group with descendants while preserving object-based readOnly.targets.
  • Inheritance behavior Descendants cannot override an inherited lock from an ancestor.
Documentation
© Vojtěch Václav Porteš 2026 - All library contents are available under the MIT license.
Loading privacy preferences...