import * as i13 from '@angular/forms'; import { ValidatorFn, AsyncValidatorFn, UntypedFormControl, AbstractControl, UntypedFormGroup, ControlValueAccessor } from '@angular/forms'; import { SearchService, FirstPageService } from '@sinequa/components/search'; import { AppService, FormatService, Query, ValueItem } from '@sinequa/core/app-utils'; import { ValidationService, ValidationDirective } from '@sinequa/core/validation'; import { Filter, CCColumn } from '@sinequa/core/web-services'; import { FacetService } from '@sinequa/components/facet'; import * as i0 from '@angular/core'; import { OnChanges, OnDestroy, ElementRef, OnInit, AfterViewInit, EventEmitter } from '@angular/core'; import * as i17 from '@sinequa/components/autocomplete'; import { AutocompleteItem, Autocomplete } from '@sinequa/components/autocomplete'; import * as i14 from '@sinequa/core/intl'; import { IntlService } from '@sinequa/core/intl'; import * as i15 from 'ngx-bootstrap/datepicker'; import { BsDatepickerDirective, BsDatepickerConfig, BsDaterangepickerDirective, BsDaterangepickerConfig } from 'ngx-bootstrap/datepicker'; import { Observable } from 'rxjs'; import * as i12 from '@angular/common'; import * as i16 from '@sinequa/components/utils'; /** * Defines the possible basic types of an advanced value */ type BaseAdvancedValue = string | number | Date | boolean | undefined; /** * Defines an advanced value type as either a single basic advanced value or an array of basic advanced values */ type AdvancedValue = BaseAdvancedValue | BaseAdvancedValue[]; interface AdvancedFormValidators { min: (min: string | number | Date, field: string) => ValidatorFn; max: (max: string | number | Date, field: string) => ValidatorFn; required: ValidatorFn; email: ValidatorFn; pattern: (pattern: string | RegExp) => ValidatorFn; integer: (field: string) => ValidatorFn; number: (field: string) => ValidatorFn; date: (field: string) => ValidatorFn; range: (field: string) => ValidatorFn; } declare class AdvancedService { appService: AppService; searchService: SearchService; facetService: FacetService; validationService: ValidationService; formatService: FormatService; /** * Default form validators packaged within SBA to standardize advanced-search validation */ readonly validators: AdvancedFormValidators; constructor(appService: AppService, searchService: SearchService, facetService: FacetService, validationService: ValidationService, formatService: FormatService); /** * Return a standard FormControl compatible with a select component * @param field * @param validators optional validators to be added to the returned FormControl * @param asyncValidators optional asyncValidators to be added to the returned FormControl * @param query Query where to fetch advanced values, if omitted, use searchService.query */ createSelectControl(field: string, validators?: ValidatorFn[], asyncValidators?: AsyncValidatorFn[], query?: Query): UntypedFormControl; /** * Return a standard FormControl compatible with a range-input component * @param field * @param validators optional validators to be added to the returned FormControl * @param asyncValidators optional asyncValidators to be added to the returned FormControl * @param query Query where to fetch advanced values, if omitted, use searchService.query */ createRangeControl(field: string, validators?: ValidatorFn[], asyncValidators?: AsyncValidatorFn[], query?: Query): UntypedFormControl; /** * Return a standard FormControl compatible with a text input component * @param field * @param validators optional validators to be added to the returned FormControl * @param asyncValidators optional asyncValidators to be added to the returned FormControl * @param query Query where to fetch advanced values, if omitted, use searchService.query */ createInputControl(field: string, validators?: ValidatorFn[], asyncValidators?: AsyncValidatorFn[], query?: Query): UntypedFormControl; /** * Return a standard FormControl compatible with a multi-value text input component * @param field * @param validators optional validators to be added to the returned FormControl * @param asyncValidators optional asyncValidators to be added to the returned FormControl * @param query Query where to fetch advanced values, if omitted, use searchService.query */ createMultiInputControl(field: string, validators?: ValidatorFn[], asyncValidators?: AsyncValidatorFn[], query?: Query): UntypedFormControl; /** * Return a standard FormControl compatible with a checkbox component * @param field * @param validators optional validators to be added to the returned FormControl * @param asyncValidators optional asyncValidators to be added to the returned FormControl * @param query Query where to fetch advanced values, if omitted, use searchService.query */ createCheckboxControl(field: string, validators?: ValidatorFn[], asyncValidators?: AsyncValidatorFn[], query?: Query): UntypedFormControl; /** * Reset the supplied AbstractControl (and its validation) and sets its value to undefined * @param control */ resetControl(control: AbstractControl): void; /** * Reset the supplied AbstractControl (and its validation) and sets its value to [undefined, undefined] * @param control */ resetRangeControl(control: AbstractControl): void; /** * Retrieve the value (ValueItem | ValueItem[] | undefined) to be set to the FormControl from the Query * @param field * @param query Query where to fetch advanced values, if omitted, use searchService.query */ getValue(field: string, query?: Query): ValueItem | ValueItem[] | undefined; extractValues(filter: Filter): ValueItem[]; /** * Retrieve the boolean value to be set to the FormControl from the Query * @param field * @param query Query where to fetch advanced values, if omitted, use searchService.query */ getBooleanValue(field: string, query?: Query): boolean | undefined; /** * Retrieve the range value to be set to the FormControl from the Query * @param field * @param query Query where to fetch advanced values, if omitted, use searchService.query */ getRangeValue(field: string, query?: Query): AdvancedValue; /** * Return the filter of an advanced filter * @param field * @param query Query where to fetch advanced values, if omitted, use searchService.query */ protected getAdvancedFilter(field: string, query?: Query): Filter | undefined; /** * Sets a select on a query (defaults to searchService.query) for a given * field and value(s) * @param field * @param value * @param query Query where to fetch advanced values, if omitted, use searchService.query * @param combineWithAnd */ setSelect(field: string, value: ValueItem | ValueItem[] | undefined, query?: Query, combineWithAnd?: boolean, fieldOperator?: 'contains'): void; setSelect(field: string, value: ValueItem | ValueItem[] | undefined, options?: { query?: Query; combineWithAnd?: boolean; fieldOperator?: 'contains'; }): void; /** * Sets a select on a query (defaults to searchService.query) for a given * field and a boolean value * @param field * @param value * @param discardFalsy by default it is 'false', so a false value is used to be undefined * @param query */ setBooleanSelect(field: string, value: boolean | undefined, allowFalsy?: boolean, query?: Query): void; /** * Sets a select on a query (defaults to searchService.query) for a given * field, operator and value * @param field * @param value * @param operator * @param query */ setNumericalSelect(field: string, value: string | Date | number | ValueItem | undefined, operator: "gt" | "gte" | "lt" | "lte" | "eq" | "neq", query?: Query): void; /** * Sets a select on a query (defaults to searchService.query) for a given * field and range of values * @param field * @param range * @param query */ setRangeSelect(field: string, range: (string | Date | number)[] | undefined, query?: Query): void; /** * Sets a select for a given field and filter on the query (defaults to searchService.query) * @param query Query where to fetch advanced values, if omitted, use searchService.query * @param field * @param filter */ protected setAdvancedSelect(field: string, filter: Filter | undefined, query?: Query): void; /** * Remove a specific advanced value by its field name. * By default, Trigger search() action * @param field * @param query Query from which will remove the specific advanced value, if omitted, use searchService.query * @param search */ removeAdvancedValue(field: string, search?: boolean, query?: Query): void; /** * Transforms a value to a parsed ValueItem[] * @param value * @param field */ protected asValueItems(value: ValueItem | ValueItem[], field: string): ValueItem[]; formatValueItems(field: string, value: ValueItem | ValueItem[]): ValueItem | ValueItem[]; /** * Format the display property of the ValueItem according its related column definition * @param field * @param value */ protected formatValueItem(field: string, value: ValueItem): ValueItem; /** * Format a given advanced value according to its column definition * @param field * @param value */ formatAdvancedValue(field: string, value: AdvancedValue): AdvancedValue; protected formatBaseAdvancedValue(value: BaseAdvancedValue, column: CCColumn): BaseAdvancedValue; /** * Cast a given value as per its column definition * @param value * @param column */ castAdvancedValue(value: BaseAdvancedValue, column: CCColumn | undefined): BaseAdvancedValue; /** * Create a generic FormControl * @param value value of the FormControl * @param validators optional validators to be added to the returned FormControl * @param asyncValidators optional asyncValidators to be added to the returned FormControl */ protected createControl(value: AdvancedValue | ValueItem | ValueItem[], validators?: ValidatorFn[], asyncValidators?: AsyncValidatorFn[]): UntypedFormControl; /** * Parse a value according to its column definition * @param value * @param field */ protected parse(value: T, field: string): T | string; /** * Return the parser if existing in the given field * @param field */ protected _parser(field: string): string | undefined; protected _rangeType(field: string): string | number | Date; /** * Return `true` if the passed value is an `ValueItem[]` */ protected _isValueItemArray(value: any): value is ValueItem[]; /** * Return `true` if the passed value is an `ValueItem` */ protected _isValueItem(value: any): value is ValueItem; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class BsAdvancedFormCheckbox implements OnChanges { appService: AppService; form: UntypedFormGroup; field: string; label: string; constructor(appService: AppService); ngOnChanges(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsAdvancedFormInput implements OnChanges, OnDestroy { appService: AppService; form: UntypedFormGroup; field: string; suggestQuery: string; label: string; control: AbstractControl | null; viewValue: string | number | undefined | null; private _valueChangesSubscription; constructor(appService: AppService); ngOnChanges(): void; ngOnDestroy(): void; onItemChange(item: AutocompleteItem): void; private _updateControl; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } /** * Component representing a text input that accepts multiple entries. * This component also performs value validation on each entry. * */ declare class BsAdvancedFormMultiInput implements OnChanges, OnDestroy { private elementRef; appService: AppService; form: UntypedFormGroup; field: string; suggestQuery: string; label: string; items: AutocompleteItem[]; /** List of items already existing in the advanced search */ private _valueChangesSubscription; control: AbstractControl | null; constructor(elementRef: ElementRef, appService: AppService); ngOnChanges(): void; ngOnDestroy(): void; removeItem(item: AutocompleteItem): void; onItemsChanged(items: AutocompleteItem[]): void; keydown(event: KeyboardEvent): false | undefined; keypress(event: KeyboardEvent): false | undefined; private _updateControl; private _getDropdownItem; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsAdvancedFormRange implements OnInit, OnDestroy { private appService; form: UntypedFormGroup; field: string; min: Date | number | string; max: Date | number | string; label: string; fromName: string; toName: string; forName: string; column: CCColumn | undefined; minDate: Date | undefined; maxDate: Date | undefined; control: AbstractControl | null; value: (string | number | Date)[]; isDate: boolean; private _valueChangesSubscription; constructor(appService: AppService); ngOnInit(): void; ngOnDestroy(): void; ensureValue(value: string): string | number | Date; updateFrom(from: string): void; updateTo(to: string): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsAdvancedFormSelect implements OnInit, OnDestroy { private appService; private firstPageService; form: UntypedFormGroup; field: string; /** Optional label: the component looks for the label in the Query web service configuration for the given field */ label: string; /** Whether the component supports multiple selection */ multiple: boolean; /** Optional input. The component automatically looks for an aggregation with the name equal to the field */ aggregation: string; column: CCColumn | undefined; items: ValueItem[]; private _valueChangesSubscription; constructor(appService: AppService, firstPageService: FirstPageService); ngOnInit(): void; ngOnDestroy(): void; private getItems; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare const DATE_PICKER_VALUE_ACCESSOR: any; interface DatePickerOptions { name?: string; system?: boolean; minDate?: Date; maxDate?: Date; } declare class BsDatePicker implements OnInit, AfterViewInit, OnDestroy, ControlValueAccessor { intlService: IntlService; private readonly SystemFormat; options: DatePickerOptions; value: Date; private onChangeCallback; private localeChange; picker: BsDatepickerDirective; input: ElementRef; constructor(intlService: IntlService); ngOnInit(): void; get dateFormat(): string; setLocale(): void; ngAfterViewInit(): void; ngOnDestroy(): void; bsConfig(): BsDatepickerConfig; updateValue(value: Date): void; private zeroTimes; focus(): void; writeValue(value: Date): void; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare const DATE_RANGE_PICKER_VALUE_ACCESSOR: any; interface DateRangePickerOptions extends DatePickerOptions { closedRange?: boolean; } declare class BsDateRangePicker implements OnInit, AfterViewInit, OnDestroy, ControlValueAccessor { intlService: IntlService; private readonly SystemFormat; options: DateRangePickerOptions; display: 'row' | 'column'; displaySeparator: boolean; displayLabel: boolean; size: '' | 'sm' | 'lg'; value: (Date | undefined)[]; private onChangeCallback; private localeChange; fromToPicker?: BsDaterangepickerDirective; fromPicker?: BsDatepickerDirective; toPicker?: BsDatepickerDirective; fromName: string; toName: string; fromOperator: 'gte' | 'eq'; constructor(intlService: IntlService); ngOnInit(): void; get dateFormat(): string; setLocale(): void; ngAfterViewInit(): void; ngOnDestroy(): void; bsFromToConfig(): BsDaterangepickerConfig; updateFromTo(fromTo: Date[]): void; maxDate: Date | undefined; minDate: Date | undefined; bsFromConfig(): BsDatepickerConfig; bsToConfig(): BsDatepickerConfig; setMinMaxDate(): void; resetMinMaxDate(): void; updateFrom(from: Date): void; updateTo(to: Date): void; zeroTimes(): void; setValue(value: (Date | undefined)[] | undefined): void; writeValue(value: Date[]): void; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; toggleFromOperator(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsSelectComponent implements ControlValueAccessor, OnInit { items: ValueItem[]; disabled: boolean; multiple: boolean; buttonElement: ElementRef; opened: boolean; isOpen: boolean; activeItem: number; private cancelBlur; names: string[]; private selectedItems; private onChangeCallback; ngOnInit(): void; setOpen(value: boolean): void; mousedown(event: Event): void; blur(event: FocusEvent): void; toggleOpen(): void; keydown($event: KeyboardEvent): void; private clearSelected; private countSelected; isItemSelected(itemIndex: number): boolean; toggleItemSelected(itemIndex: number): void; get buttonTitleMessageParams(): any; get buttonTitle(): string; get itemListHeight(): string; private triggerOnChange; writeValue(value: ValueItem | ValueItem[]): void; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class BsAdvancedFormAutocomplete extends Autocomplete implements OnInit { UpdateItem: EventEmitter; field: string; /** * The ngOnInit() method from the original directive is overridden * On initialization, we listen to the autocomplete component for * selection events */ ngOnInit(): void; protected getSuggests(): void; protected processSuggests(obs: Observable): void; protected setAutocompleteItem(item: AutocompleteItem): boolean; /** * Listen to blur events on the host and overrides the autocomplete blur events */ blur(event: FocusEvent): void; /** * Overrides the parent inputChanged method, so that it is possible to reinitialize the autocomplete * @param event */ inputChanged(event: Event): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class BsAdvancedFormAutocompleteMultiInput extends BsAdvancedFormAutocomplete { /** Event synchronizing the list of search terms in the parent component */ itemsUpdate: EventEmitter; /** Stores the selected search terms selected via Tab */ items: AutocompleteItem[]; /** * The setAutocompleteItem() method from the original directive is overriden to * Sets the content of the based on the given * Autocomplete Item. * @returns false since we don't need trigger search at this point of time */ protected setAutocompleteItem(item: AutocompleteItem): boolean; /** * Listen to user's keyboard actions in the , in order to navigate * and select the autocomplete suggestions. * Overrides the parent keydown method, adds the management of the backspace key * to remove items, enhance the enter key to support adding new items. * @param event the keyboard */ keydown(event: KeyboardEvent): false | undefined; /** * Listens to blur events (out of focus) on the host and overrides the parent blur events */ blur(): void; private _manageSetAutocompleteItem; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class BsAdvancedFormValidation extends ValidationDirective implements OnInit { field: string; validationForm: UntypedFormGroup; ngOnInit(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class BsAdvancedModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } declare const enAdvanced: any; declare const frAdvanced: any; declare const deAdvanced: any; export { AdvancedService, BsAdvancedFormAutocomplete, BsAdvancedFormAutocompleteMultiInput, BsAdvancedFormCheckbox, BsAdvancedFormInput, BsAdvancedFormMultiInput, BsAdvancedFormRange, BsAdvancedFormSelect, BsAdvancedFormValidation, BsAdvancedModule, BsDatePicker, BsDateRangePicker, BsSelectComponent, DATE_PICKER_VALUE_ACCESSOR, DATE_RANGE_PICKER_VALUE_ACCESSOR, deAdvanced, enAdvanced, frAdvanced }; export type { AdvancedFormValidators, AdvancedValue, BaseAdvancedValue, DatePickerOptions, DateRangePickerOptions };