@nova-ui/bits
Version:
SolarWinds Nova Framework
99 lines (98 loc) • 4 kB
TypeScript
import { AfterViewInit, EventEmitter, NgZone, OnChanges, OnDestroy, OnInit, SimpleChanges } from "@angular/core";
import { ChipsOverflowService } from "./chips-overflow.service";
import { IChipRemoved, IChipsGroup, IChipsItem, IChipsItemsSource } from "./public-api";
import * as i0 from "@angular/core";
/**
* Control used to list groups of selected options (former ng1 nui-chiclets component).
*
* __Usage:__
*
* ```html
* <nui-chips [autoHide]="false"
* [itemsSource]="itemsSource"
* [title]="title"
* [orientation]="'vertical'"
* [allowRemoveAll]="false"
* [removeAllLinkText]="clearAllText"
* (chipRemoved)="onRemove($event)"
* (removeAll)="onRemoveAll()">
* </nui-chips>
* ```
*
*/
export declare class ChipsComponent implements OnInit, OnDestroy, OnChanges, AfterViewInit {
private zone;
private chipsOverflowService;
/**
* Whether overflow mode turned on
*/
overflow: boolean;
/**
* Limits chips lines if overflow mode
*/
overflowLinesNumber: number;
/**
* Flag for 'Clear all' link visibility.
*/
allowRemoveAll: boolean;
/**
* Expression to determine if the component is hidden when 'itemsSource' is empty.
*/
autoHide: boolean;
/**
* Value to be shown as remove all link text.
*/
removeAllLinkText: string;
/**
* Data source. Both 'flatItems' and 'groupedItems' collections could be passed simultaneously
* (previous ng1 implementation did not allow that, it handled only one type of items).
*/
itemsSource: IChipsItemsSource;
/**
* Can be set to 'vertical' to switch chips to vertical list mode. Otherwise horizontal mode is used.
*/
orientation: "horizontal" | "vertical";
/**
* Value to be shown as vertical orientation chips title.
*/
title: string;
/** */
customClass: string;
/**
* Event that is fired when single item is cleared (by clicking on item or its remove icon).
* Event data passed contains object with item clicked and its parent group.
*/
chipRemoved: EventEmitter<IChipRemoved>;
/**
* Event that is fired when 'Clear All' is clicked.
*/
removeAll: EventEmitter<MouseEvent>;
/**
* Emits overflowed chips if chips overflow
*/
chipsOverflowed: EventEmitter<IChipsItemsSource>;
isOverflowed: boolean;
private mainCell;
private set clearAll(value);
private nuiChips;
private allChips;
private set overflowCounter(value);
private readonly destroy$;
get role(): string | null;
constructor(zone: NgZone, chipsOverflowService: ChipsOverflowService);
ngOnChanges(changes: SimpleChanges): void;
ngOnInit(): void;
ngAfterViewInit(): void;
/** Handles Popup on window resize */
onWinResize(): void;
getItemsCount(): number;
onRemove(data: {
item: IChipsItem;
group?: IChipsGroup;
}): void;
onRemoveAll(event: MouseEvent): void;
ngOnDestroy(): void;
private initChipsOverflow;
static ɵfac: i0.ɵɵFactoryDeclaration<ChipsComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<ChipsComponent, "nui-chips", never, { "overflow": { "alias": "overflow"; "required": false; }; "overflowLinesNumber": { "alias": "overflowLinesNumber"; "required": false; }; "allowRemoveAll": { "alias": "allowRemoveAll"; "required": false; }; "autoHide": { "alias": "autoHide"; "required": false; }; "removeAllLinkText": { "alias": "removeAllLinkText"; "required": false; }; "itemsSource": { "alias": "itemsSource"; "required": false; }; "orientation": { "alias": "orientation"; "required": false; }; "title": { "alias": "title"; "required": false; }; "customClass": { "alias": "customClass"; "required": false; }; }, { "chipRemoved": "chipRemoved"; "removeAll": "removeAll"; "chipsOverflowed": "chipsOverflowed"; }, ["overflowCounter"], [".nui-chips-overflowed"], false, never>;
}