UNPKG

@microsoft/windows-admin-center-sdk

Version:

Microsoft - Windows Admin Center Shell

145 lines (144 loc) 6.18 kB
import { EventEmitter, Injector, OnInit, TemplateRef } from '@angular/core'; import { FormControl } from '@angular/forms'; import { ValidationAlerts } from '../../../form/validation-alert/validation-alert'; import { ArrayPropertySchemaFieldLoaderComponent } from '../../../schema/schema-field-host.component'; import { SmeInternalFormFieldComponent } from '../form-field.component'; import { FormFieldIsolatorComponent } from '../isolator/isolator.component'; import { ArrayFormFieldAccessibilityManagerService } from './array-form-field-accessibility-manager.service'; import * as i0 from "@angular/core"; export interface AskForNewItemEventArgs { item: any; } export interface AskForItemHeaderArgs { headerEvalFunc: MsftSme.Func2<any, number, string>; } export interface AskForRemoveEvalFuncArgs { removeEvalFunc: MsftSme.Func2<any, number, boolean>; } export declare class ArrayFormFieldLoaderComponent extends ArrayPropertySchemaFieldLoaderComponent { private arrayFormFieldComponent; askForNewItem($event: any): void; shouldAdjustControlButtonLocation(): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<ArrayFormFieldLoaderComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<ArrayFormFieldLoaderComponent, "ng-component", never, {}, {}, never, never, false, never>; } /** * Accessible Implementation of a form field for .sme-array */ export declare class ArrayFormFieldComponent extends SmeInternalFormFieldComponent<any[]> implements OnInit { protected arrayFormFieldAccessibilityManagerService: ArrayFormFieldAccessibilityManagerService; private _itemTitle; /** * The source name to use for logging */ protected get logSourceName(): string; /** * Gets the item template from either the subFormTemplate or subFieldIsolator if provided. */ get itemTemplate(): TemplateRef<any>; /** * If provided, the sub field isolator prevents child ngmodels from registering with the form. * Instead, we will use it to manage our own validity */ subFieldIsolator: FormFieldIsolatorComponent; /** * When no "newItem" is provided. This output will be called anytime a new item is required. */ askForNewItem: EventEmitter<AskForNewItemEventArgs>; askForItemHeader: EventEmitter<AskForItemHeaderArgs>; askForRemoveEvaluator: EventEmitter<AskForRemoveEvalFuncArgs>; /** * Indicates that the array item button locations should be adjusted to account for no item label. */ adjustControlButtonLocation: boolean; /** * Input for generating a new item from an existing object */ newItem: any; /** * Indicates if the add and remove actions should be shown */ showAdd: boolean; /** * Indicates if the remove actions should be shown for all items */ showRemove: boolean; /** * Indicates if the move actions should be shown */ showMove: boolean; canCloseAll: boolean; canCloseAny: boolean; canOpenMultiple: boolean; /** * Maximum number of items in the array */ maxItems: number; addButtonText: string; headerTemplate: TemplateRef<any>; set itemTitle(value: string); get itemTitle(): string; /** * The aria label for this instance. */ get ariaLabel(): string; /** * When updated, the screen reader will announce this string */ screenReaderEvent: string; private addButton; /** * Initializes a new instance of the JsonFormFieldComponent */ constructor(injector: Injector, arrayFormFieldAccessibilityManagerService: ArrayFormFieldAccessibilityManagerService); /** * The method called after the component is initialized. */ ngOnInit(): void; /** * Updates a hidden aria-live region with information about changes to the page; if the same event is being repeated, the event string * is set in lowercase, so the screen reader thinks it's a new string. Clearing and re-setting the field does not prompt the screen * reader to read the aria-live region. * @param event the string to be announced */ private updateScreenReaderEvent; /** * Adds an item to the array */ add(): void; /** * Deletes an item from the array */ delete(item: any): void; /** * Decreases the index of an item by 1 */ moveUp(item: any): void; /** * Increases the index of an item by 1 */ moveDown(item: any): void; /** * The method called when a <select> element's value changes. */ triggerValueChange(): void; getItemAriaId(index: number, idName: string): any; getItemTitle(item: any, index: number): string; getShowRemove(item: any, index: number): boolean; /** * Performs validation that is internal to this control * @param c The form control attached to this instance */ protected validate(c: FormControl): ValidationAlerts; /** * Creates the idBag used by this component to store unique element ids. * id values will be assigned be the @see BaseComponent super class. */ protected createIdBag(): MsftSme.StringMap<string>; /** * Generates a new item to be added to the array */ private getNewItem; static ɵfac: i0.ɵɵFactoryDeclaration<ArrayFormFieldComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<ArrayFormFieldComponent, "sme-form-field[type=\"array\"]", never, { "adjustControlButtonLocation": "adjustControlButtonLocation"; "newItem": "newItem"; "showAdd": "showAdd"; "showRemove": "showRemove"; "showMove": "showMove"; "canCloseAll": "canCloseAll"; "canCloseAny": "canCloseAny"; "canOpenMultiple": "canOpenMultiple"; "maxItems": "maxItems"; "addButtonText": "addButtonText"; "headerTemplate": "headerTemplate"; "itemTitle": "itemTitle"; }, { "askForNewItem": "askForNewItem"; "askForItemHeader": "askForItemHeader"; "askForRemoveEvaluator": "askForRemoveEvaluator"; }, ["subFieldIsolator"], never, false, never>; }