import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import type{PropertyValues}from'lit';import{type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';export type ConditionBuilderFieldType='string'|'number'|'boolean'|'date'|'enum'; /** A comparison a condition row can apply. `gt`/`gte`/`lt`/`lte` are shared by `number` and * `date` fields (labelled "Greater than"/"After" etc. depending on the field's own `type`, see * `operatorLabel()`) rather than duplicated as separate date-only tokens, so a host swapping a * field's `type` between the two doesn't need to remap any already-selected operator. `in`/ * `notIn` only apply to `enum` fields (rendered as a multi-select `lr-combobox`); `isEmpty`/ * `isNotEmpty` are unary and render no value control at all. */ export type ConditionBuilderOperator='eq'|'neq'|'gt'|'gte'|'lt'|'lte'|'contains'|'startsWith'|'endsWith'|'in'|'notIn'|'isEmpty'|'isNotEmpty'; /** One selectable value for an `enum`-typed `ConditionBuilderField`. */ export interface ConditionBuilderFieldOption{readonly value:string;readonly label?:string;} /** One field a host makes available for building conditions against. */ export interface ConditionBuilderField{ /** Machine key, matched against a `ConditionBuilderCondition`'s own `field`. */ readonly name:string; /** Visible label; falls back to `name` when omitted. */ readonly label?:string;readonly type:ConditionBuilderFieldType; /** Required (and only meaningful) for `type: 'enum'` — the choices offered for `eq`/`neq` * (single `lr-select`) and `in`/`notIn` (multi `lr-combobox`). */ readonly options?:readonly ConditionBuilderFieldOption[]; /** Overrides the default operator set for this field's `type` (see `defaultOperatorsForType()`). * Lets a host narrow (or reorder) the operators offered for a specific field, e.g. a * free-text field that should only ever offer `contains`. */ readonly operators?:readonly ConditionBuilderOperator[]; /** Forwarded to the rendered `lr-input` for a `string`-typed field's value cell. */ readonly placeholder?:string; /** Inclusive lower constraint. A finite number is forwarded by `type: 'number'`; a bounded date * string is forwarded by `type: 'date'`. Other field types ignore it. */ readonly min?:number|string; /** Inclusive upper constraint, with the same number/date type-dependent forwarding as `min`. */ readonly max?:number|string; /** Positive finite step forwarded to the numeric `lr-input`; ignored by every other field type. */ readonly step?:number;} /** A single field/operator/value row. `field`/`operator` are `''` until the user has picked * one — an incomplete row is a normal, valid intermediate state, not an error. `value` is * `undefined` for a unary operator (`isEmpty`/`isNotEmpty`), a `string[]` for `in`/`notIn`, * and a `string | number | boolean` otherwise, matching the selected field's `type`. Those are * the valid authored shapes; incompatible controlled payloads are retained and reported through * `validationIssues` rather than silently rewritten. */ export interface ConditionBuilderCondition{readonly id:string;readonly field:string;readonly operator:ConditionBuilderOperator|'';readonly value?:string|number|boolean|readonly string[];}export type ConditionBuilderCombinator='and'|'or'; /** The whole builder's plain-data state: a flat list of conditions combined with one top-level * `combinator`. It can be persisted and restored without the component repairing operator/value * disagreements; call `checkValidity()` before sending a restored model to a backend. This * library's `lr-filter-bar` follows the same controlled-plain-object-`value` shape. */ export interface ConditionBuilderValue{readonly combinator:ConditionBuilderCombinator;readonly conditions:readonly ConditionBuilderCondition[];} /** Why one controlled condition is inconsistent with the current field metadata. Controlled * values remain unchanged; these codes let a host decide whether and how to repair persisted data. */ export type ConditionBuilderValidationIssueCode='field-unavailable'|'operator-not-allowed'|'operator-arity'|'value-type'; /** One live validation result for a retained condition. At most one issue is reported per row, * ordered by field, operator, arity, then value type so repairing it reveals the next boundary. */ export interface ConditionBuilderValidationIssue{readonly conditionId:string;readonly code:ConditionBuilderValidationIssueCode;}export interface LyraConditionBuilderEventMap{ /** Fired whenever `value` changes as a result of user interaction (picking a field/operator, * editing a value, changing the combinator, or adding/removing a row) — never for a * programmatic `value`/`fields` assignment. `detail.value` is the full current value. */ 'lr-input':CustomEvent>; /** Fired after a new condition row seeded with the first available field is appended, whether * triggered by the button or a public `addCondition()` call. */ 'lr-add-condition':CustomEvent>; /** Fired after a condition row is removed. */ 'lr-remove-condition':CustomEvent<{readonly conditionId:string;}>;} /** * `` — a composable structured-condition builder for tabular/dashboard data: a * flat list of field/operator/value condition rows combined with one AND/OR combinator. * * Distinct from this package's ``: that component builds typed * relationship/path queries over a knowledge graph, a genuinely different data model from this * one's flat tabular field/operator/value conditions — they never share a file or a value type. * * A host supplies `fields` (the available columns, each with a `ConditionBuilderFieldType` that * determines its offered operators and value control) and `value` (a plain * `{ combinator, conditions }` object whose valid snapshots can be persisted or sent to a backend, * using the same shape convention as this package's ``/``). * This component never mutates `fields`/`value` in place — inputs are clone-owned — and never calls * out to storage/network itself. It does advance its own copy of `value` on each edit and *then* * emits `lr-input` with the complete next state: the same "update, then emit; reassign to control" * round-trip ``'s `selectedSourceIds` and ``'s `filters` * establish. `lr-input` is not cancelable, so a host validating an edit reassigns `value` in its * handler rather than vetoing the change before it renders. Controlled condition payloads are * preserved when field metadata is absent, changes, or disagrees with an operator/value shape — * persisted data is never silently repaired. `validationIssues`, `invalidConditionIds`, * `checkValidity()`, and `reportValidity()` expose those disagreements instead. User-entered * numeric text is still parsed at the control boundary, where a non-finite result becomes unset. * Inputs are clone-owned, bounded readonly snapshots; blank field names, option values, and * condition ids are omitted, duplicates use their first valid record, unknown closed-vocabulary * values normalize to a safe fallback, and all event details are frozen. * * **9.0 migration:** this original component was renamed from `` / * `LyraQueryBuilder` / `QueryBuilder*` to the condition-specific names above. No legacy tag, class, * type, or granular-path alias remains. * * Each row composes `` for the field and operator pickers, and a value control chosen * from the selected field's `type`: `` (`string`), `` (`number`), `` with `True`/`False` options (`boolean`), * `` (`date`), `` (`enum`, `eq`/`neq`) or a multi-select * `` (`enum`, `in`/`notIn`). Date fields forward bounded `min`/`max` strings to * ``; number fields forward finite `min`/`max` and positive finite `step` values to * ``. A unary operator (`isEmpty`/`isNotEmpty`) renders no value control. * Field/operator selections emit one complete-model `lr-input`; their native value events, * prefixed value aliases and listbox lifecycle events stay within the picker. * `` removes a row; `` appends one. * * This is a composite query-definition control, not a single submittable form field — it * deliberately ships no `label`/`hint`/`errorText` chrome or native form association (the * `label`/`hint`/`error` triad those controls share doesn't fit a multi-row, multi-field * composite the way it fits one value). A host names the whole control via a plain `aria-label` * attribute, applied to the element that owns `role="group"`. The group and each condition expose * explicit `aria-invalid="true"|"false"` from the live validation result. * * @customElement lr-condition-builder * @event lr-input - `detail: { value }` — the full current value, after any user-driven change. * @event lr-add-condition - Frozen `detail: { condition }` — a row seeded with the first field was appended. * @event lr-remove-condition - `detail: { conditionId }` — a row was removed. * @csspart base - The outer wrapper. * @csspart combinator - The AND/OR combinator `lr-select`, rendered only when there are 2+ conditions. * @csspart conditions - The wrapper around the condition rows. * @csspart condition - One field/operator/value row. * @csspart field-select - A row's field `lr-select`. * @csspart operator-select - A row's operator `lr-select`. * @csspart value - A row's value control (whichever of `lr-input`/`lr-select`/`lr-date-input`/ * `lr-combobox` applies, or an empty placeholder for a unary operator or an incomplete row). * @csspart remove-button - A row's remove `lr-icon-button`. * @csspart add-button - The "Add condition" `lr-button`. * @csspart empty - The message shown when there are no fields, or no conditions yet. * @status stable * @since 9.0.0 */ export declare class LyraConditionBuilder extends LyraElement{static styles:import("lit").CSSResultGroup[];protected static readonly immutableEventDetails:readonly string[];static properties:{fields:{attribute:boolean;noAccessor:boolean;};value:{attribute:boolean;noAccessor:boolean;};disabled:{type:BooleanConstructor;reflect:boolean;noAccessor:boolean;};};private _fields;private _value;private _disabled;private pendingFocusAdd; /** Frozen snapshot of at most 200 fields, 500 options/operators per field, bounded strings, and * finite type-specific number constraints. Reassign after changing it. */ get fields():readonly ConditionBuilderField[];set fields(next:readonly ConditionBuilderField[]); /** The current query: one combinator plus a flat list of conditions. Controlled — assigning * this directly never emits `lr-input` (that only fires for a user-driven change); see the * class doc's form-association note for why this stays a plain property, not a form value. * Assignment preserves retained operator/value payloads even when they disagree with the current * field metadata; inspect `validationIssues` rather than expecting silent repair. It freezes at * most 200 conditions and 500 entries in each array-valued condition; reassign to update. */ get value():ConditionBuilderValue;set value(next:ConditionBuilderValue);get disabled():boolean;set disabled(next:boolean);private operatorsFor;private validationIssueFor; /** Live, frozen validation results for controlled conditions that disagree with the current * field/operator/arity/type vocabulary. Reading this never mutates `value`. */ get validationIssues():readonly ConditionBuilderValidationIssue[]; /** Condition ids currently represented in `validationIssues`, in model order. */ get invalidConditionIds():readonly string[]; /** Whether every retained controlled condition agrees with the current field metadata. */ checkValidity():boolean; /** Reports current validity without rewriting controlled data. When invalid, focuses the first * affected field/operator/value control so a caller's Apply action has a useful recovery target. */ reportValidity():boolean;private operatorLabel; /** The value a condition should reset to whenever its `field` or `operator` changes -- always * a fresh, type-appropriate default rather than attempting to carry over a value that may no * longer match the new field's type or the new operator's arity. */ private defaultValueFor;private commit; /** Appends a new condition seeded with the first available field, or does nothing when no field * exists. The operator remains empty until the user chooses the intended comparison. */ addCondition():void;private conditionElement; /** Removes the condition row with the given `id`, if present. */ removeCondition(id:string):void;private setCombinator;private setConditionField;private setConditionOperator;private setConditionValue;private consumeChildEvent;private containSelectEvent;protected updated(changed:PropertyValues):void;private renderCombinator;private renderValueControl;private renderCondition;render():TemplateResult; /** `localize()` interpolates with a bare `String(value)`, so a number handed to it renders in * ASCII digits no matter the locale -- mixing two numbering systems inside one translated * sentence. Route every user-facing number through the effective locale instead. */ private formatCount;}declare global{interface HTMLElementTagNameMap{'lr-condition-builder':LyraConditionBuilder;}}