import { KbqAutocompleteModule } from '@koobiq/components/autocomplete';

KbqAutocomplete

componentСкопировать ссылку на KbqAutocomplete
@Component({ selector: 'kbq-autocomplete', exportAs: 'kbqAutocomplete' })
class KbqAutocomplete implements KbqOptionParentComponent {
readonly displayWith = input<((value: any) => string) | null>(null);
readonly panelWidth = input<KbqPanelWidth | undefined>();
readonly panelMinWidth = input<number>(KBQ_PANEL_DEFAULT_MIN_WIDTH);
readonly panelMaxWidth = input<KbqPanelMaxWidth>(null);
readonly hostClass = input<string>('', { alias: 'class' });
readonly autoActiveFirstOption = input<boolean>(
!!this.defaultOptions.autoActiveFirstOption
);
readonly openOnFocus = input<boolean>(true);
readonly optionSelected = output<KbqAutocompleteSelectedEvent>();
readonly opened = output<void>();
readonly closed = output<void>();
readonly id: string;
readonly template: Signal<TemplateRef<any>>;
readonly panel: Signal<ElementRef<any>>;
get options(): QueryList<KbqOption>;
readonly optionGroups: Signal<readonly KbqOptgroup[]>;
readonly isOpen: Signal<boolean>;
}
displayWithinputСкопировать ссылку на displayWith((value: any) => string) | null

Function that maps an option's control value to its display value in the trigger.

panelWidthinputСкопировать ссылку на panelWidthKbqPanelWidth | undefined

Specify the width of the autocomplete panel. If set to auto, the panel will match the width of its host, but will never be narrower than panelMinWidth. Any other CSS sizing value is used as an exact width, and panelMinWidth is not applied. When not set, the panel sizes to its content and is at least as wide as its host.

panelMinWidthinputСкопировать ссылку на panelMinWidthnumber

Minimum width of the panel in pixels. When panelWidth is not set, the panel will be at least as wide as its host and no less than panelMinWidth.

panelMaxWidthinputСкопировать ссылку на panelMaxWidthKbqPanelMaxWidth

Maximum width of the panel in pixels. Caps how far the panel grows with its content — it never makes the panel narrower than its host, and never clamps an explicit panelWidth. When null, the --kbq-panel-size-width-max token applies.

classinputСкопировать ссылку на classstring

Classes set on the host kbq-autocomplete element. They are applied to the panel inside the overlay container instead, to allow for easy styling.

Accepts every shape Angular's own [class] binding does. The binding value arrives here raw: Angular converts it to a string before handing it to a styling-shadowing input only when the element carries a static class attribute, which <kbq-autocomplete> does not.

autoActiveFirstOptioninputСкопировать ссылку на autoActiveFirstOptionboolean

Whether the first option should be highlighted when the autocomplete panel is opened. Can be configured globally through the KBQ_AUTOCOMPLETE_DEFAULT_OPTIONS token.

openOnFocusinputСкопировать ссылку на openOnFocusboolean

Whether the panel opens as soon as the trigger receives focus.

optionSelectedoutputСкопировать ссылку на optionSelectedKbqAutocompleteSelectedEvent

Event that is emitted whenever an option from the list is selected.

openedoutputСкопировать ссылку на openedvoid

Event that is emitted when the autocomplete panel is opened.

closedoutputСкопировать ссылку на closedvoid

Event that is emitted when the autocomplete panel is closed.

idСкопировать ссылку на idstring

Unique id, rendered as the panel element's id.

isOpenСкопировать ссылку на isOpenSignal<boolean>

Whether the panel is visible: attached by the trigger and holding at least one option.

KbqAutocompleteFooter

directiveСкопировать ссылку на KbqAutocompleteFooter

Footer that is rendered below the autocomplete options panel.

@Directive({ selector: '[kbqAutocompleteFooter], kbq-autocomplete-footer' })
class KbqAutocompleteFooter {}

KbqAutocompleteOrigin

directiveСкопировать ссылку на KbqAutocompleteOrigin

Directive applied to an element to make it usable as a connection point for an autocomplete panel.

@Directive({
selector: '[kbqAutocompleteOrigin]',
exportAs: 'kbqAutocompleteOrigin'
})
class KbqAutocompleteOrigin {
elementRef: ElementRef<HTMLElement>;
}

KbqAutocompleteTrigger

directiveСкопировать ссылку на KbqAutocompleteTrigger
@Directive({
selector: 'input[kbqAutocomplete], textarea[kbqAutocomplete]',
exportAs: 'kbqAutocompleteTrigger'
})
class KbqAutocompleteTrigger implements ControlValueAccessor, KeyboardNavigationHandler, KbqSiblingPopup {
readonly autocomplete = input<KbqAutocomplete>(undefined, {
alias: 'kbqAutocomplete'
});
readonly connectedTo = input<KbqAutocompleteOrigin>(undefined, {
alias: 'kbqAutocompleteConnectedTo'
});
readonly autocompleteDisabled = input<boolean>(false, {
alias: 'kbqAutocompleteDisabled'
});
readonly onInputBlur = input<(event: FocusEvent) => boolean>(
(event: FocusEvent): boolean => {
const target: HTMLElement = event.relatedTarget as HTMLElement;
return !target || target.tagName !== 'KBQ-OPTION';
},
{ alias: 'kbqAutocompleteOnBlur' }
);
readonly relativeToCaret = input<boolean>(false, {
alias: 'kbqAutocompleteRelativeToCaret'
});
readonly textMode = input<boolean>(false, {
alias: 'kbqAutocompleteTextMode'
});
readonly queryTriggers = input<readonly string[]>([], {
alias: 'kbqAutocompleteTriggers'
});
readonly queryMinLength = input<number | undefined>(undefined, {
alias: 'kbqAutocompleteMinLength'
});
readonly inlineHint = input<boolean>(true, {
alias: 'kbqAutocompleteInlineHint'
});
readonly queryChange = output<KbqTextQuery | null>({
alias: 'kbqAutocompleteQueryChange'
});
get activeOption(): KbqOption | null;
get panelOpen(): boolean;
get isAttached(): boolean;
readonly openedChange: Observable<boolean>;
readonly optionSelections: Observable<KbqOptionSelectionChange>;
get panelClosingActions(): Observable<KbqOptionSelectionChange | null>;
open(): void;
closePanel(): void;
updatePosition(): void;
handleKeydown(event: KeyboardEvent): void;
handleInput(event: Event): void;
handleFocus(): void;
handleClick($event: Event): void;
scrollActiveOptionIntoView(): void;
}
kbqAutocompleteinputСкопировать ссылку на kbqAutocompleteKbqAutocomplete

The autocomplete panel to be attached to this trigger.

kbqAutocompleteConnectedToinputСкопировать ссылку на kbqAutocompleteConnectedToKbqAutocompleteOrigin

Reference relative to which to position the autocomplete panel. Defaults to the autocomplete trigger element.

kbqAutocompleteDisabledinputСкопировать ссылку на kbqAutocompleteDisabledboolean

Whether the autocomplete is disabled. When disabled, the element will act as a regular input and the user won't be able to open the panel.

kbqAutocompleteOnBlurinputСкопировать ссылку на kbqAutocompleteOnBlur(event: FocusEvent) => boolean

Event handler for input blur events. Determines whether the blur event is triggered outside the specific target

kbqAutocompleteRelativeToCaretinputСкопировать ссылку на kbqAutocompleteRelativeToCaretboolean

Whether the panel opens from the text caret instead of the field: its left edge at the caret, right below the caret's line, following the caret while it moves. The panel is only as wide as its options — panelMinWidth does not apply there, an explicit panelWidth still does.

kbqAutocompleteTextModeinputСкопировать ссылку на kbqAutocompleteTextModeboolean

Whether the autocomplete completes the text at the caret instead of the whole value. The query is the word before the caret, or the text after one of kbqAutocompleteTriggers; choosing an option replaces the query, trigger included, with the option. The form value stays the whole text.

kbqAutocompleteTriggersinputСкопировать ссылку на kbqAutocompleteTriggersreadonly string[]

Strings that start a query in text mode, such as / or @. When empty, the query is the word before the caret.

kbqAutocompleteMinLengthinputСкопировать ссылку на kbqAutocompleteMinLengthnumber | undefined

Shortest query that opens the panel in text mode. Defaults to 1 for a word and to 0 after a trigger.

kbqAutocompleteInlineHintinputСкопировать ссылку на kbqAutocompleteInlineHintboolean

Whether text mode draws the rest of the active option after the caret, to be accepted with Tab or →. The field has to be inside kbq-form-field.

kbqAutocompleteQueryChangeoutputСкопировать ссылку на kbqAutocompleteQueryChangeKbqTextQuery | null

Emits the query at the caret in text mode whenever it changes, or null once there is none. The query is read again as the user types or clicks in the field, and as the caret moves while the panel is open. It carries the trigger it starts with, which tells apart the options to show for each trigger.

activeOptionСкопировать ссылку на activeOptionKbqOption | null

The currently active option, coerced to MatOption type.

isAttachedСкопировать ссылку на isAttachedboolean

Whether the autocomplete panel is currently on screen. Part of the KbqSiblingPopup contract.

openedChangeСкопировать ссылку на openedChangeObservable<boolean>

Emits true when the panel opens and false when it closes. Part of the KbqSiblingPopup contract.

Built on top of the autocomplete signal rather than read once: the panel is bound after the consumers of this stream are created (a tooltip on the same element subscribes in its constructor).

panelClosingActionsСкопировать ссылку на panelClosingActionsObservable<KbqOptionSelectionChange | null>

A stream of actions that should close the autocomplete panel, including when an option is selected, on blur, and when TAB is pressed.

open()Скопировать ссылку на open()void

Opens the autocomplete suggestion panel.

updatePosition()Скопировать ссылку на updatePosition()void

Updates the position of the autocomplete suggestion panel to ensure that it fits all options within the viewport.

KbqAutocompleteSelectedEvent

classСкопировать ссылку на KbqAutocompleteSelectedEvent
class KbqAutocompleteSelectedEvent {
source: KbqAutocomplete;
option: KbqOption;
constructor(source: KbqAutocomplete, option: KbqOption);
}

KBQ_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY

functionСкопировать ссылку на KBQ_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY
function KBQ_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY(): KbqAutocompleteDefaultOptions;

KbqAutocompleteDefaultOptions

interfaceСкопировать ссылку на KbqAutocompleteDefaultOptions

Default kbq-autocomplete options that can be overridden.

interface KbqAutocompleteDefaultOptions {
autoActiveFirstOption?: boolean;
}
autoActiveFirstOptionoptionalСкопировать ссылку на autoActiveFirstOptionboolean

Whether the first option should be highlighted when an autocomplete panel is opened.

KBQ_AUTOCOMPLETE_DEFAULT_OPTIONS

constСкопировать ссылку на KBQ_AUTOCOMPLETE_DEFAULT_OPTIONS

Injection token to be used to override the default options for kbq-autocomplete.

const KBQ_AUTOCOMPLETE_DEFAULT_OPTIONS: InjectionToken<KbqAutocompleteDefaultOptions>;

KBQ_AUTOCOMPLETE_SCROLL_STRATEGY

constСкопировать ссылку на KBQ_AUTOCOMPLETE_SCROLL_STRATEGY

Injection token that determines the scroll handling while the autocomplete panel is open. The root default keeps the trigger usable outside KbqAutocompleteModule's injector; providing the token anywhere still wins over it.

const KBQ_AUTOCOMPLETE_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>;
Предложения по улучшению
Если вы нашли ошибку или хотите доработать статью, создайте запрос на GitHub.