import { BehaviorSubject, Observable, Subject } from 'rxjs'; import { LiveAnnouncer } from '@angular/cdk/a11y'; import { ListRange } from '@angular/cdk/collections'; import { ConnectedPosition } from '@angular/cdk/overlay'; import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling'; import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, NgZone, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef, TrackByFunction } from '@angular/core'; import { FormGroupDirective, NgControl, NgForm } from '@angular/forms'; import { ErrorStateMatcher } from '@angular/material/core'; import { VirtualScrollItemStatus } from '@uipath/angular/directives/ui-virtual-scroll-range-loader'; import { ISuggestValue, ISuggestValues, SuggestDirection, SuggestMaxSelectionConfig } from './models'; import { UiSuggestIntl } from './ui-suggest.intl'; import { UiSuggestMatFormFieldDirective } from './ui-suggest.mat-form-field'; import * as i0 from "@angular/core"; export declare const DEFAULT_SUGGEST_DEBOUNCE_TIME = 300; export declare const DEFAULT_SUGGEST_DRILLDOWN_CHARACTER = ":"; export declare const MAT_CHIP_INPUT_SELECTOR = ".mat-mdc-chip-grid input"; /** * A form compatible `dropdown` packing `lazy-loading` and `virtual-scroll`. * * @ignore * @export */ export declare class UiSuggestComponent extends UiSuggestMatFormFieldDirective implements OnDestroy, OnInit, OnChanges, AfterViewInit { ngControl: NgControl; intl: UiSuggestIntl; private _liveAnnouncer; private _zone; get inDrillDownMode(): any; /** * Configure if the component is `disabled`. * */ get disabled(): boolean; set disabled(value: boolean); /** * Configure if the component allows expandable items * */ get drillDown(): boolean; set drillDown(value: boolean); /** * Divider character for drilldown logic */ drillDownCharacter: string; /** * Configure if the component is `readonly`. * */ get readonly(): boolean; set readonly(value: boolean); /** * Set the element in high density state. * */ hasHighDensity: boolean; /** * By default the onOpen fetchStrategy prevents additional requests if closed. * This allows you to bypass that check and update even if closed. */ ignoreOpenOnFetch: boolean; /** * Controls whether to use the default custom value template or use the custom item template * */ applyItemTemplateToCustomValue: boolean; /** * A list of options that will be presented at the top of the list. * */ get headerItems(): ISuggestValue[] | null; set headerItems(value: ISuggestValue[] | null); /** * If true, the item list will render open and will not close on selection * */ alwaysExpanded: boolean; /** * If true, component will always render the list upfront */ expandInline: boolean; /** * If true, component wil place the dropdown over the input */ forceDisplayDropdownOverInput: boolean; /** * Configure if the component allows multi-selection. * */ get multiple(): boolean; set multiple(multiple: boolean); /** * The `dropdown` item list. * */ get items(): ISuggestValue[]; set items(items: ISuggestValue[]); /** * Configure the direction in which to open the overlay: `up` or `down'. * */ set direction(value: SuggestDirection); get direction(): SuggestDirection; /** * Configure if the dropdown has `search` enabled. * */ get searchable(): boolean; set searchable(searchable: boolean); /** * Reference for custom item template * */ itemTemplate: TemplateRef | null; /** * Computes the current tooltip value. * */ get tooltip(): string | null; /** * Determines if the `custom value` option should be `displayed`. * */ get isCustomValueVisible(): boolean; get isCustomHeaderItemsVisible(): boolean; /** * Retrieves the currently `rendered` items. * */ get renderItems(): ISuggestValue[]; /** * Configure if the user is allowed to select `custom values`. * * @deprecated */ get enableCustomValue(): boolean; set enableCustomValue(value: boolean); /** * Configure if the dropdown is in a `loading` state. * */ set loading(value: boolean); /** * Render an additional info message if a specific count of items is rendered * Useful in case search results are capped and the user needs to adjust the query */ searchableCountInfo?: { count: number; message: string; }; /** * Configure if the selected value shown should respect the template in dropdown * */ displayTemplateValue: boolean; /** * Determines if there are no results to display. * */ get hasNoResults(): boolean; /** * @ignore */ get isCustomValueAlreadySelected(): boolean; /** * Computes the `viewport` max-height. * */ get viewportMaxHeight(): number; private get _isOnCustomValueIndex(); private get _itemLowerBound(); private get _itemUpperBound(); private get _fetchCount(); /** * A search stream factory, generally used to retrieve data from the server when a user searches. * By `default`, a search factory is generated that does an `in-memory` lookup if `searchable` is set to `true`. * */ searchSourceFactory?: (searchTerm?: string, fetchCount?: number, skip?: number) => Observable>; /** * Configure the `searchSourceStrategy` for requesting data using searchSourceFactory: * `default` - need total count * `lazy` - items will be fetched only when reaching bottom of the list (no need of total count) */ searchSourceStrategy: 'default' | 'lazy'; /** * A display value factory, generally used to compute the display value for multiple items. * By `default`, a display value factory is generated that does an array.join. * */ displayValueFactory?: (value?: ISuggestValue[]) => string; customValueLabelTranslator: (value: string) => string; /** * Configure the `fetchStrategy` for requesting data using searchSourceFactory * `eager` - makes calls to searchSourceFactory onInit * `onOpen` - makes calls to searchSourceFactory onOpen * */ set fetchStrategy(strategy: 'eager' | 'onOpen'); /** * Configure the minimum number of characters that triggers the searchSourceFactory call * This will have priority over the fetch strategy if set. * */ get minChars(): number; set minChars(value: number); /** * Configure the `control` width. * */ get width(): string; set width(value: string); /** * Configure the `maximum` search length. * */ maxLength?: number; /** * The search event debounce interval in `ms`. * */ debounceTime: number; /** * The maximum number of items rendered in the viewport. * */ get displayCount(): number; set displayCount(value: number); /** * Configure if the component allows selection clearing. * */ clearable: boolean; /** * Configure the `default` selected value. * */ defaultValue: string; /** * Configure if the tooltip should be disabled. * */ disableTooltip: boolean; /** * Use compact summary info instead of chips * */ compact: boolean; /** * The template to use for compact summary * */ compactSummaryTemplate?: TemplateRef; /** * The config used to describe suggest when the maximum number of selected items is reached. * */ maxSelectionConfig: SuggestMaxSelectionConfig; /** * Emits `once` when `data` is retrieved for the `first time`. * */ sourceInitialized: EventEmitter; /** * Emits `every` time item data is retrieved. * */ sourceUpdated: EventEmitter; /** * Emits when the overlay is hidden (dropdown close). * */ closed: EventEmitter; /** * Emits when an item is selected. * */ itemSelected: EventEmitter; /** * Emits when the overlay is displayed (dropdown open). * */ opened: EventEmitter; /** * Emits on losing or receiving focus. * */ focusEvent: EventEmitter; /** * @ignore */ VirtualScrollItemStatus: typeof VirtualScrollItemStatus; /** * Configures the dropdown open state. * * @ignore */ set isOpen(isOpen: boolean); get isOpen(): boolean; /** * The current selected item index. * * @ignore */ activeIndex: number; /** * The component loading state source. * * @ignore */ loading$: BehaviorSubject; /** * Stream that triggers focusing. * * @ignore */ focus$: Subject; upPosition: ConnectedPosition; downPosition: ConnectedPosition; dropdownPosition: ConnectedPosition[]; suggestContainerWidth: number; suggestContainer: ElementRef; displayContainer?: ElementRef; protected set _virtualScrollerQuery(value: CdkVirtualScrollViewport); private _hasCustomValue$; private _reset$; private get _isOpenDisabled(); private get _hasValue(); private _readonly; private _displayCount?; private _width?; private _observer; private _suggestContainerObserver; private _height$; private _searchSub?; private _disabled$; private _multiple; private _lastSetItems; private _enableCustomValue; private _minChars; private _triggerViewportRefresh$; private _destroyed$; private _scrollTo$; private _rangeLoad$; private _fetchStrategy$; private _isOpen$; private _headerItems; private _virtualScroller?; private _visibleRange; private _inputChange$; private _drillDown; private _lazyLoadLastArgument; private _matListElement?; /** * @ignore */ constructor(elementRef: ElementRef, cd: ChangeDetectorRef, errorStateMatcher: ErrorStateMatcher, parentForm: NgForm, parentFormGroup: FormGroupDirective, ngControl: NgControl, intl: UiSuggestIntl, _liveAnnouncer: LiveAnnouncer, _zone: NgZone); /** * Configure if each individual chip can be removed * */ canRemoveChip: (value: ISuggestValue) => boolean; /** * @ignore */ ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; /** * @ignore */ ngOnDestroy(): void; /** * @ignore */ ngAfterViewInit(): void; /** * Computed index offset in items list when prepending header items * * @param index * @returns */ computedItemsOffset(index: number): number; /** * Is called every time a new range needs to be loaded. * * @ignore */ rangeLoad: (range: ListRange) => void; /** * Disable state hook for the `form`. * * @param isDisabled The truth of of the `disabled` state. * @ignore */ setDisabledState(isDisabled: boolean): void; /** * Handles `click` events on the `form-control` container. * * @ignore */ onContainerClick(event: MouseEvent): void; /** * Notifies focus changes to the `form`. * * @ignore */ onBlur(event: FocusEvent): void; /** * Notifies focus changes to the `form`. * * @ignore */ onFocus(event: FocusEvent): void; /** * Toggle the dropdown state (opened/closed); * */ toggle(): void; /** * Opens the dropdown. * */ open(): void; /** * Closes the dropdown. * * @param [refocus=true] If the dropdown should be focused after closing. */ close(refocus?: boolean): void; /** * Resets the component state. * */ reset(): void; /** * Removes the active dropdown selection. * * @param [ev] `Mouse` or `Keyboard`. */ removeSelection(ev?: Event | KeyboardEvent | MouseEvent): void; /** * Navigates through the items by looking up the next focused / active index. * * @param increment The increment that should be applied to the current index. * @param [ev] The navigation trigger event. * @ignore */ navigate(increment: number, ev?: Event): void; /** * Selects the current active item. * * @ignore */ setSelectedItem(): void; /** * Determines if the provided `item` is currently selected. * * @param [item] The `item` that needs to be checked. * @returns If the provided `item` is selected. */ isItemSelected(item?: ISuggestValue): boolean; /** * Updates the component value. * * @param inputValue The value that needs to be selected. * @param [closeAfterSelect=true] If the dropdown should close after the value is selected. * @param [refocus=true] If the search input should regain focus after selection. */ updateValue(inputValue: ISuggestValue | string, closeAfterSelect?: boolean, refocus?: boolean): void; /** * @ignore */ preventDefault(ev?: Event): void; /** * Triggers a refetch of data, calling the `searchSourceFactory` with the provided search term. * * @param searchValue The search value that should be used for the `fetch`. */ fetch: (searchValue?: string) => void; /** * `NgFor` track method. * * @ignore */ trackById: TrackByFunction; deselectItem(option: ISuggestValue): void; backspaceBehavior(): void; computeDisplayValue(): string; onOptionsDropdownTabPressed(): void; private _getDropdownPositionAccordingToDirection; private _initOverlayPositions; private _setDropdownOrigin; private _setDropdownOffset; private _initResizeObserver; private _selectActiveItem; private _findItemIndex; private _safeCycleIncrement; private _checkCustomValue; private _setHasCustomValue; private _virtualScrollTo; private _announceNavigate; private _setLoadingState; private _focusChanged; private _setInitialItems; private _setActiveIndex; private _setAndScrollToActiveIndex; private _scrollToFirst; private _deselectValuesFrom; private _pushEntry; private _clearSelection; private _removeEntry; private _rangeLoad; private _resetIfTotalCountChange; private _gotoBottomAsync; private _focusChipInput; private _checkUnsuportedScenarios; private _getValueSummary; private _defaultDisplayValueFactory; private _cantNavigate; private get _isLazyMode(); private _removeUnresolvedElements; private _shouldAddLoadingElementInLazyMode; private _addLoadingElementInLazyMode; private _shouldLoadMoreOnUpDirection; private _loadMore; private _announceSelectStatus; private _isCheckbox; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; }