@visa/nova-angular
Version:
Visa Product Design System Nova Angular library
72 lines (71 loc) • 4.34 kB
TypeScript
/**
* Copyright (c) 2025 Visa, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**/
import { AppReadyService } from '../_utilities/services/app-stable-check.service';
import { ListboxItemComponent } from '../listbox-item/listbox-item.component';
import { ComboboxDirective } from './combobox.directive';
import * as i0 from "@angular/core";
/**
* Service containing optional functions for the ComboboxDirective.
*/
export declare class ComboboxService {
private appReadyService;
constructor(appReadyService: AppReadyService);
/**
* The closeMenuOnItemClick method automatically closes the menu when an item is selected. <br />
* To keep the menu open after an item is selected, you must provide <code>[closeOnClick]="false"</code> to the combobox component.
* @param combobox Combobox to apply behavior to.
*/
closeMenuOnItemClick(combobox: ComboboxDirective): void;
/**
* The selectHighlightedOnMenuClose method selects the last highlighted item when the menu is closed.
* This method is called by default within <code>autoSelectItem</code>. <br />
* @param combobox Combobox to apply behavior to.
*/
selectHighlightedOnMenuClose(combobox: ComboboxDirective): void;
/**
* The autoFilterDisplayedItems method automatically filters the items shown in the combobox on initial render.
* If the items displayed on page load are not the full list you want to filter, please use a different function. This method filters items based on selection and input value changes. <br />
* To access the filtered list of <code>ListboxItemsDirective[]</code>, subscribe to the <code>filteredListEmitter</code>.
* @param combobox Combobox to apply behavior to.
*/
autoFilterDisplayedItems(combobox: ComboboxDirective): void;
/**
* The autoFilterBasedOnList method filters items in the combobox based on a specified list, which can differ from the initial list rendered. <br />
* This method allows customization of the filtering criteria, enabling you to filter items based on properties such as id, label, value, etc. To access the filtered list, subscribe to <code>the filteredListEmitter</code>, which emits the filtered list in the same shape as <code>fullList</code>. <br />
* This method is recommended over <code>autoFilterDisplayedItems</code> and can achieve the same functionality by calling <code>autoFilterBasedOnList(combobox, list, 'label')</code>.
* @param combobox Combobox to apply filter function to.
* @param fullList Full list of items to filter.
* @param condition Condition on which to filter items in fullList (this would be a property you've provided to the items in fullList).
*/
autoFilterBasedOnList(combobox: ComboboxDirective, fullList: any[], condition: string): void;
/**
* The updateList method updates the combobox component with the given filtered list items,
setting the active and highlighted index appropriately. <br />
* This method is called by default within <code>autoFilterDisplayedItems</code> and <code>autoFilterBasedOnList</code>.
* @param combobox Combobox to update.
* @param filteredListItems Filtered array of listbox items.
*/
updateList(combobox: ComboboxDirective, filteredListItems: ListboxItemComponent[]): void;
/**
* The autoSelectItem method highlights the first list item based on user input. <br />
* This ensures that when the menu closes, if an input value was entered, an item is selected.
* @param combobox Combobox to apply automatic selection to.
*/
autoSelectItem(combobox: ComboboxDirective): void;
static ɵfac: i0.ɵɵFactoryDeclaration<ComboboxService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ComboboxService>;
}