import * as _angular_core from '@angular/core'; import { OnInit, AfterViewInit, Signal } from '@angular/core'; import { TLocale } from '@talenra/ngx-base/shared'; import { InputComponent } from '@talenra/ngx-base/input'; import { SelectComponent } from '@talenra/ngx-base/select'; import { DateComponent } from '@talenra/ngx-base/date'; /** * Operators accepted by the query selection rule in which the type of value is a string. The operator is used to determine the type of comparison that is to be performed. * * ### Import * * ```typescript * import { QueryBuilderStringOperator } from '@talenra/ngx-base/query-builder'; * ``` */ declare const QueryBuilderStringOperator: { readonly Equal: "equal"; readonly NotEqual: "notEqual"; readonly StartsWith: "startsWith"; readonly EndsWith: "endsWith"; readonly NotStartsWith: "notStartsWith"; readonly NotEndsWith: "notEndsWith"; readonly Contains: "contains"; readonly NotContains: "notContains"; readonly From: "from"; readonly To: "to"; }; /** * Type of operators accepted by the query selection rule. * * ### Import * * ```typescript * import { TQueryBuilderStringOperator } from '@talenra/ngx-base/query-builder'; * ``` */ type TQueryBuilderStringOperator = (typeof QueryBuilderStringOperator)[keyof typeof QueryBuilderStringOperator]; /** * Operators accepted by the query selection rule in which the type of value is an option of multiple strings. * The operator is used to determine the type of comparison that is to be performed. * * ### Import * * ```typescript * import { QueryBuilderOptionOperator } from '@talenra/ngx-base/query-builder'; * ``` */ declare const QueryBuilderOptionOperator: { readonly Contains: "contains"; readonly NotContains: "notContains"; }; /** * Type of operators accepted by the query selection rule. * * ### Import * * ```typescript * import { TQueryBuilderOptionOperator } from '@talenra/ngx-base/query-builder'; * ``` */ type TQueryBuilderOptionOperator = (typeof QueryBuilderOptionOperator)[keyof typeof QueryBuilderOptionOperator]; /** * Operators accepted by the query selection rule in which the type of value is a number. * The operator is used to determine the type of comparison that is to be performed. * * ### Import * * ```typescript * import { QueryBuilderNumberOperator } from '@talenra/ngx-base/query-builder'; * ``` */ declare const QueryBuilderNumberOperator: { readonly Equal: "equal"; readonly NotEqual: "notEqual"; readonly Greater: "greater"; readonly Lesser: "lesser"; readonly GreaterOrEqual: "greaterOrEqual"; readonly LesserOrEqual: "lesserOrEqual"; }; /** * Type of operators accepted by the query selection rule. * * ### Import * * ```typescript * import { TQueryBuilderNumberOperator } from '@talenra/ngx-base/query-builder'; * ``` */ type TQueryBuilderNumberOperator = (typeof QueryBuilderNumberOperator)[keyof typeof QueryBuilderNumberOperator]; /** * Operators accepted by the query selection rule in which the type of value is a date. * The operator is used to determine the type of comparison that is to be performed. * * ### Import * * ```typescript * import { QueryBuilderDateOperator } from '@talenra/ngx-base/query-builder'; * ``` */ declare const QueryBuilderDateOperator: { readonly Equal: "equal"; readonly NotEqual: "notEqual"; readonly Before: "before"; readonly After: "after"; readonly BeforeOrEqual: "beforeOrEqual"; readonly AfterOrEqual: "afterOrEqual"; }; /** * Type of operators accepted by the query selection rule. * * ### Import * * ```typescript * import { TQueryBuilderDateOperator } from '@talenra/ngx-base/query-builder'; * ``` */ type TQueryBuilderDateOperator = (typeof QueryBuilderDateOperator)[keyof typeof QueryBuilderDateOperator]; /** * Actions that can be performed on rules of a query. * * ### Import * * ```typescript * import { QueryBuilderRuleAction } from '@talenra/ngx-base/query-builder'; * ``` */ declare const QueryBuilderRuleAction: { readonly AddRule: "addRule"; readonly AddRuleGroup: "addRuleGroup"; readonly DeleteElement: "deleteElement"; readonly ConditionChange: "conditionChange"; }; /** * Type of actions which can be performed on rules of a query. * * ### Import * * ```typescript * import { TQueryBuilderRuleAction } from '@talenra/ngx-base/query-builder'; * ``` */ type TQueryBuilderRuleAction = (typeof QueryBuilderRuleAction)[keyof typeof QueryBuilderRuleAction]; /** * Conditions accepted by the query. The operator is used to determine the type of comparison that is to be performed. * * ### Import * * ```typescript * import { QueryBuilderCondition } from '@talenra/ngx-base/query-builder'; * ``` */ declare const QueryBuilderCondition: { readonly And: "and"; readonly Or: "or"; }; /** * Type of condition accepted by the query. * * ### Import * * ```typescript * import { TQueryBuilderCondition } from '@talenra/ngx-base/query-builder'; * ``` */ type TQueryBuilderCondition = (typeof QueryBuilderCondition)[keyof typeof QueryBuilderCondition]; /** * Value types accepted by the query selection rule. The value type is used to determine the type of comparison that is to be performed. * * ### Import * * ```typescript * import { QueryBuilderValueType } from '@talenra/ngx-base/query-builder'; * ``` */ declare const QueryBuilderValueType: { readonly String: "string"; readonly Option: "option"; readonly Number: "number"; readonly Date: "date"; readonly Boolean: "boolean"; }; /** * Type of value types accepted by the query selection rule. * * ### Import * * ```typescript * import { TQueryBuilderValueType } from '@talenra/ngx-base/query-builder'; * ``` */ type TQueryBuilderValueType = (typeof QueryBuilderValueType)[keyof typeof QueryBuilderValueType]; /** * Interface for the custom operators. * * ```typescript * { * key: 'equal', * label: 'Equal' * } * ``` * * ### Import * * ```typescript * import { IQueryBuilderOperator } from '@talenra/ngx-base/query-builder'; * ``` */ interface IQueryBuilderOperator { /** * The operator used to compare the value with the items. */ key: string; /** * The label is the translated value of the operator. */ label: string; } /** * Contains the different attributes of a query builder rule. * * ```typescript * { * identifier: '1', * operator: 'equal', * key: 'name', * label: 'Name', * type: 'string', * value: 'John Doe' * } * ``` * * ### Import * ```typescript * import { IQueryBuilderRule } from '@talenra/ngx-base/query-builder'; * ``` */ interface IQueryBuilderRule { /** * Random identifier for the query rule. */ identifier: string; /** * The operator used to compare the value with the items. */ operator?: TQueryBuilderStringOperator | TQueryBuilderOptionOperator | TQueryBuilderNumberOperator | TQueryBuilderDateOperator | string; /** * The identifier of the field that is used to compare the value with the items. */ key?: string; /** * The label is the translated value of the identifier. */ label?: string; /** * The type of the value that is used to compare the items. */ type?: TQueryBuilderValueType; /** * The value that is used to compare the items. */ value?: string | number | Date | boolean | IQueryBuilderValueOption; } /** * The possible rules that can be used to compare the items. * * ```typescript * { * key: 'name', * label: 'Name', * type: 'string', * operators: [ * { * key: 'equal', * label: 'Equal' * } * ] * } * ``` * * ### Import * ```typescript * import { IQueryBuilderPossibleRule } from '@talenra/ngx-base/query-builder'; * ``` */ interface IQueryBuilderPossibleRule { /** * The identifier of the field that is used to compare the value with the items. */ key: string; /** * The label is the translated value of the identifier. */ label: string; /** * The type of the value that is used to compare the items. */ type: TQueryBuilderValueType; /** * The value that is used to compare the items. */ operators?: IQueryBuilderOperator[]; } /** * Query of conditions and rules. * The query can contain multiple rules and queries. * * ```typescript * { * condition: 'and', * identifier: '1', * hierarchyLevel: 1, * rules: [ * { * identifier: '2', * operator: 'equal', * key: 'name', * label: 'Name', * type: 'string', * value: 'John Doe' * }, * { * condition: 'or', * identifier: '3', * hierarchyLevel: 2, * rules: [ * { * identifier: '4', * operator: 'equal', * key: 'age', * label: 'Age', * type: 'number', * value: 30 * } * ] * } * ] * } * ``` * * ### Import * ```typescript * import { IQueryBuilderQuery } from '@talenra/ngx-base/query-builder'; * ``` */ interface IQueryBuilderQuery { /** * The condition used to combine the rules and queries. */ condition: TQueryBuilderCondition; /** * Random identifier for the query. */ identifier: string; /** * The hierarchy level of the query. Starting with 1. */ hierarchyLevel: number; /** * The type of the value that is used to compare the items. */ rules: (IQueryBuilderQuery | IQueryBuilderRule)[]; } /** * Value options that are connected to a specific identifier. * * ```typescript * { * key: 'animal', * valueOptions: [{ * key: 'animal.zebra', * label: 'Zebra' * }, { * key: 'animal.giraffe', * label: 'Giraffe' * }] * } * ``` * * ### Import * ```typescript * import { IQueryBuilderValueOptions } from '@talenra/ngx-base/query-builder'; * ``` */ interface IQueryBuilderValueOptions { /** * The identifier of the field that is used to connect the identifier with the options. */ key: string; /** * Options that are available for the specific identifier. */ valueOptions: IQueryBuilderValueOption[]; } /** * Options that are connected to a specific identifier. * * ```typescript * { * key: 'animal.zebra', * label: 'Zebra' * } * ``` * * ### Import * ```typescript * import { IQueryBuilderValueOption } from '@talenra/ngx-base/query-builder'; * ``` */ interface IQueryBuilderValueOption { /** * The identifier of the field that is used to compare the value with the items. */ key: string; /** * The label is the translated value of the identifier. */ label: string; } /** * The `talenra-query-builder` component enables the user to create a query with rules and subqueries. * The user can add rules and subqueries to the query and select the condition for each query and subqueries. * Rules can be selected from a list of possible rules and the user can select an operator and a value. * * ```html * * ``` * * ### Import * * ```typescript * import { QueryBuilderComponent } from '@talenra/ngx-base/query-builder'; * ``` * * ../../#/query-builder * * @experimental */ declare class QueryBuilderComponent { /** * The query that is currently selected. Contains all selection, even the rules that are not fully filled out and empty groups. * * ```html * * ``` */ query: _angular_core.ModelSignal; /** * The possible rules that can be selected. * * ```html * * ``` */ possibleRules: _angular_core.InputSignal; /** * The values that can be selected in connection to each rule identifier. * * ```html * * ``` */ values: _angular_core.InputSignal; /** * The maximum hierarchy level on how deep the rule can be constructed. * * ```html * * ``` */ maxHierarchyLevel: _angular_core.InputSignalWithTransform; /** * Locale to dynamically overwrite the app's locale. * Allowed values, see: Locale * * ```html * * ``` * * @see {@link Locale} * @see {@link TLocale} */ dynamicLocale: _angular_core.InputSignal; /** * The locale to use. */ locale: _angular_core.Signal; /** The app's global locale */ private appLocale; /** * Actions performed on the query. Either deleting and element of adding a new rule or query. * @param action The action that is to be performed on the query. * @param queryOrRule The query or rule that is to be changed. */ protected queryAction(action: TQueryBuilderRuleAction, queryOrRule: IQueryBuilderRule | IQueryBuilderQuery): void; /** * Changes the rule in the query. * @param availableQuery * @param rule */ protected onRuleChange(availableQuery: IQueryBuilderQuery, rule: IQueryBuilderRule): void; /** * Changes the condition in the query. * @param condition The condition that is to be set. * @param query The query that is to be changed. */ protected conditionChange(condition: TQueryBuilderCondition, query: IQueryBuilderQuery): void; /** * Gets the translation for a key. * @param key The key that is to be translated. */ protected getTranslation(key: string): string; /** * Gets the disabled or hidden actions for a query. * @param query The query that is to be checked. */ protected getDisableActionsForQuery(query: IQueryBuilderQuery): TQueryBuilderRuleAction[]; /** * The map of values for the rule. The key is the identifier of the rule and the value is the rule itself. */ protected readonly valuesMap: _angular_core.Signal>; /** * Gets the values for the rule. If the values are not found, an empty array is returned. * @param ruleOrQuery The rule or query that is to be checked. */ protected getValuesForRule(ruleOrQuery: IQueryBuilderRule): IQueryBuilderValueOptions; /** * Checks if the rule or query is a query. * @param queryOrRule The rule or query that is to be checked. */ protected checkTypeRuleQuery(queryOrRule: IQueryBuilderQuery | IQueryBuilderRule): queryOrRule is IQueryBuilderQuery; /** * Generates a UUID. */ private generateUUID; /** * Deletes the rule or query from the available query. * @param availableQuery The query that is currently available. It is condensed for the recursive function. * @param queryOrRuleToDelete The query or rule that is to be deleted. */ private deleteElementFromQuery; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * The `talenra-query-selection-field` component enables the user to select a rule for the query. * The user can select an identifier from a list of possible rules. If selected the user can select an operator and a * value, specific to the type of the rule. * * ```html * * ``` * * ### Import * * ```typescript * import { QuerySelectionFieldComponent } from '@talenra/ngx-base/query-builder'; * ``` */ declare class QuerySelectionFieldComponent implements OnInit, AfterViewInit { /** * The selection field of the rule. */ readonly ruleSelect: _angular_core.Signal; /** * The selection field of the operator. */ readonly operatorSelect: _angular_core.Signal; /** * The selection field of the option value. */ readonly optionValueSelect: _angular_core.Signal; /** * The selection field of the string value. */ readonly stringValueInput: _angular_core.Signal; /** * The selection field of the number value. */ readonly numberValueInput: _angular_core.Signal; /** * The selection field of the date value component. */ readonly dateValue: _angular_core.Signal; /** * The rule that is currently selected. Is required to be set by the parent component. * * ```html * * ``` */ rule: _angular_core.ModelSignal; /** * The possible rules that can be selected. Is required to be set by the parent component to enable the selection of a query selection. * * ```html * * ``` */ possibleRules: _angular_core.InputSignal; /** * The values that can be selected in connection to the selected identifier. * Has to be set during the change of the identifier. * * ```html * * ``` */ values: _angular_core.InputSignal; /** * Locale to dynamically overwrite the app's locale. * Allowed values, see: Locale * * ```html * * ``` * * @see {@link Locale} * @see {@link TLocale} */ dynamicLocale: _angular_core.InputSignal; /** * The rule action that is performed. It emits the type of action that is to be performed on a query. * * ```html * * ``` */ ruleAction: _angular_core.OutputEmitterRef; /** * The selected rule from the possible rules. */ protected selectedRule: IQueryBuilderPossibleRule | undefined; /** * The possible operator entries. */ protected possibleOperator: IQueryBuilderOperator[]; /** * The locale to use. */ private locale; /** * The filter label that is to be shown. */ protected filterLabel: _angular_core.Signal; /** The operator label that is to be shown. */ protected operatorLabel: _angular_core.Signal; /** The operator label that is to be shown. */ protected noEntriesMessage: _angular_core.Signal; /** * The tooltip for the delete button. */ protected deleteFilterTooltip: _angular_core.Signal; private appLocale; /** * Initializes the component. * @internal */ ngOnInit(): void; /** @internal */ ngAfterViewInit(): void; /** * Emits to the parent component that the element is to be deleted. */ protected deleteElement(): void; /** * Handles the change of the operator. * @param operator The operator that is selected. */ protected operatorChange(operator: string | TQueryBuilderStringOperator | TQueryBuilderOptionOperator | TQueryBuilderDateOperator | TQueryBuilderNumberOperator | undefined): void; /** * Handles the change of the value. * @param value The value that is selected. */ protected valueChange(value: string | Date | number | boolean | undefined | IQueryBuilderValueOption): void; /** * Handles the change of the key. * @param key The key that is selected. */ protected keyChange(key: string | null | undefined): void; /** * Sets the initial values of the component. */ private setInitialValues; /** * Initializes the possible operator selection for each type of rule or if a custom value is chosen. */ private initializeOperator; /** * Opens/Focuses the value field accordingly for each type. */ private focusValueField; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * The `talenra-query-condition-selector` component is a query condition selector component. * It is used to select the condition for the query and to perform actions on the query. * The actions allow the user to delete the query or add a new queries, subqueries and rules. * * ```html * * * ``` * * ### Import * * ```typescript * import { QueryConditionSelectorComponent } from '@talenra/ngx-base/query-builder'; * ``` */ declare class QueryConditionSelectorComponent { /** * The condition that is currently active. * * ```html * * * ``` */ activeCondition: _angular_core.ModelSignal; /** * The actions that are disabled or hidden. * * ```html * * * ``` */ disabledRuleActions: _angular_core.InputSignal; /** * Locale to dynamically overwrite the app's locale. * Allowed values, see: Locale * * ```html * * * ``` * * @see {@link Locale} * @see {@link TLocale} */ dynamicLocale: _angular_core.InputSignal; /** * The hierarchy level of the query. * Used to calculate the header interaction button indent. * * ```html * * * ``` */ hierarchyLevel: _angular_core.InputSignal; /** * The tooltip for the delete group button. */ protected deleteFilterGroupTooltip: Signal; /** * The tooltip for the add filter button. */ protected addFilterTooltip: Signal; /** * The tooltip for the add group button. */ protected addFilterGroupTooltip: Signal; /** * The rule action that is performed. It emits the type of action that is to be performed on a query. * * ```html * * * ``` */ ruleAction: _angular_core.OutputEmitterRef; /** * The computed locale to use for translations. */ private locale; /** * The conditions that are available in the header. */ protected conditions: Signal<{ key: TQueryBuilderCondition; label: string; }[]>; private appLocale; /** * Emits the action that is to be performed on a query. * @param action The action that is to be performed on a query. */ protected buttonAction(action: TQueryBuilderRuleAction): void; /** * Changes the active condition. * @param conditionElement The condition element that is to be set as the active condition. */ protected changeActiveCondition(conditionElement: TQueryBuilderCondition): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } export { QueryBuilderComponent, QueryBuilderCondition, QueryBuilderDateOperator, QueryBuilderNumberOperator, QueryBuilderOptionOperator, QueryBuilderRuleAction, QueryBuilderStringOperator, QueryBuilderValueType, QueryConditionSelectorComponent, QuerySelectionFieldComponent }; export type { IQueryBuilderOperator, IQueryBuilderPossibleRule, IQueryBuilderQuery, IQueryBuilderRule, IQueryBuilderValueOption, IQueryBuilderValueOptions, TQueryBuilderCondition, TQueryBuilderDateOperator, TQueryBuilderNumberOperator, TQueryBuilderOptionOperator, TQueryBuilderRuleAction, TQueryBuilderStringOperator, TQueryBuilderValueType };