UNPKG

@evan.network/ui-angular-core

Version:

The angular-core operates as an global and central library for the evan.network Angular 5 frontend development. Using this project you will be able to to the following things:

152 lines (151 loc) 4.94 kB
import { ChangeDetectorRef, ControlValueAccessor, ElementRef, EventEmitter, MenuController } from 'angular-libs'; import { AsyncComponent } from '../../classes/AsyncComponent'; import { EvanAddressBookService } from '../../services/bcc/address-book'; import { EvanCoreService } from '../../services/bcc/core'; import { EvanQueue } from '../../services/bcc/queue'; import { EvanVerificationService } from '../../services/bcc/verifications'; import { EvanBCCService } from '../../services/bcc/bcc'; /**************************************************************************************************/ /** * Component to select an account or contract address. For autocompletion processes, the addressbook * of the current user is used. But also wildcard addresses can be inserted. * * @class Component AddressInputComponent */ export declare class AddressInputComponent extends AsyncComponent implements ControlValueAccessor { private addressBook; private bcc; private core; private element; private menuController; private queueService; private verificationsService; ref: ChangeDetectorRef; /***************** inputs & outpus *****************/ /** * this component is displayed like an ionic input, defines property or hides it */ label?: string; /** * replace input placeholder */ placeholder?: string; /** * show display or add mode */ readonly?: boolean; /** * Should the select component be disabled? */ disabled?: boolean; /** * Event trigger that is called when something has changed (account moved / removed) */ onChange: EventEmitter<any>; /** * Event trigger that is called when the input has been submitted */ onSubmit: EventEmitter<any>; /***************** variables *****************/ /** * search input reference for autofocus */ searchInput: any; /** * contact keys of current address book */ private inputValue; /** * contact keys of current address book */ private contactKeys; /** * show member count or member tags, member tags will be hidden, when they * overflow the screen */ private showSuggestions; /** * addressbook */ private contacts; /** * account suggestions that were genrated during member search */ private suggestions; /** * specify, if the contract members input were adjusted */ touched: boolean; /** * From ControlValueAccessor interface */ private onTouchedCallback; /** * highlight current active suggestions */ private activeSuggestion; /** * Prefilled topic selectors */ verificationTopicSelect: any; /***************** initialization *****************/ constructor(addressBook: EvanAddressBookService, bcc: EvanBCCService, core: EvanCoreService, element: ElementRef, menuController: MenuController, queueService: EvanQueue, verificationsService: EvanVerificationService, ref: ChangeDetectorRef); /** * loads active account & addressbook, group members and trigger empty search */ _ngOnInit(): Promise<void>; /** * remove the right menu on element destroy */ _ngOnDestroy(): Promise<void>; /** * Append this functions to handle a correct formular reaction including name, required and so on. */ /** * Takes the current ng model input and pass it to the ngModel input. * * @param {string} value the input value */ writeValue(value: string): void; /** * placeholder and will be replaced with registerOnChange. */ propagateChange: (_: any) => void; /** * Takes the propagateChange function and overwrites it * * @param {Function} fn the propagate change function */ registerOnChange(fn: any): void; registerOnTouched(fn: any): void; /***************** functions *****************/ /** * Filter contacts for the current search term. * * @param {any} $event input event */ private contactSearchChanged; /** * Handle keypress for accessing suggestions easier. * * @param {any} $event the keydown input event */ private handleKeyPress; /** * return an contact alias from address book, if its available * * @param {string} accountId account id to get the alias for * @return {<type>} The contact alias. */ private getContactAlias; /** * If the menu was closed, we need to set the component to touched, so a using component can show * an required error or something. */ private setTouched; private setShowSuggestions; /** * Run detectChanges directly and after and timeout again, to update select fields. */ detectTimeout(): void; }