/** * * @license * Copyright 2017 SAP Ariba * * 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 { EventEmitter, SimpleChanges, TemplateRef } from '@angular/core'; import { Environment } from '@aribaui/core'; import { BaseFormComponent } from '../../core/base-form.component'; import { Listbox, SelectItem } from 'primeng/primeng'; import { CheckboxComponent } from '../checkbox/checkbox.component'; export declare const LB_CONTROL_VALUE_ACCESSOR: any; /** * * The List component represent a structure which contains a list of selectable items. Items * selection can be configured in single-selection, multi-selection or multi-selection with visible * checkboxes mode. * In addition it can display data inside 3 zones LEFT, MIDDLE and RIGHT in order to provide * easy way for application developer to layout its own custom content or even change out of box * behavior. * * * ### Examples * * 1. Render simple single selection list * * ```html * * * * ``` * 2. Render list - multi selection with custom RIGHT content to show a CheckMark when item * is selected * * ```html * * * * * * * * * * * * ``` * * 3. Render list - multi selection with visible checkboxes and custom MIDDLE content to change * the way item name is rendered * * * * ```html * * * * * XX-{{item.value}} * * * * ``` * * * */ export declare class ListComponent extends BaseFormComponent { env: Environment; protected parentContainer: BaseFormComponent; /** * List of option that will show in the list. Please not that this list is current used to * show limited number of items. It does not have any scrolling feature and lazy loading * */ list: any[]; /** * Items which was selected as a default values */ selection: any; /** * Component recognizes 3 modes: single, multi, multi with visible checkboxes */ selectionMode: SelectionMode; /** * Formatter used to format each selection for display. * */ valueTransformer: (value: any) => string; /** * Used when dealing with object to identify specific field on the object forcomparison */ field: string; /** * Don't render Listbox border. Used for embedding this inside other components * */ borderless: boolean; /** * Support PrimeNG readOnly options as there are situations where want to want to highlight * items */ readOnly: boolean; filter: string; /** * Triggered when we double click on the list Item * */ action: EventEmitter; /** * Event fired when user select a item * */ onSelection: EventEmitter; /** * There are situation where we want to broadcast also current clicked item for disabled or * readonly mode */ onItemClicked: EventEmitter; /** * In case we want to override default behavior or Left zone. We expose this listBox in order to * have access primeNg implementation */ pListBox: Listbox; /** * Custom templates to override default behavior. The list item is divided into 3 zones * * * ------------------------------------------------------ * | | | | * | L | M | R | * | | | | * | | | | * ------------------------------------------------------ * * */ lZoneTempl: TemplateRef; mZoneTempl: TemplateRef; rZoneTempl: TemplateRef; /** * Internal */ internalList: SelectItem[]; listStyle: { [name: string]: any; }; isMultiple: boolean; showCheckbox: boolean; constructor(env: Environment, parentContainer: BaseFormComponent); ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; /** * * Since we are using we need to have custom handling both when clicking on the * checkbox as well as item text. * * */ itemClicked(event: any, item: any, checkbox: CheckboxComponent): void; /** * Internal * */ hasRightTempl(): boolean; hasLeftTempl(): boolean; hasMiddleTempl(): boolean; /** * * Triggered by p-listbox component when item is selected. When state is managed internally * we also update FormControl model. * */ onItemSelected(event: any): void; /** * Internal. Please see ControlValueAccessor * */ writeValue(value: any): void; /** * Translates external form of the list into PrimeNG expected format where it uses * SelectionItem interface */ private initList(); /** * Generates label value for the list box. * */ private displayValue(item); } /** * List support these three selection modes * */ export declare type SelectionMode = 'single' | 'multi' | 'multiWithCheckbox';