@ctodev/cclibrary-typings
Version:
Library typings for use with CLARC INFINITY
578 lines (577 loc) • 26.5 kB
TypeScript
import { AfterViewInit, ElementRef, EventEmitter, QueryList, TemplateRef } from '@angular/core';
import { AbstractControl, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { MatPaginator } from '@angular/material/paginator';
import { TccInputMask as _TccInputMask, TccInputMask } from '../../models/inputMask.model';
import { TccTranslation, TccKeyValuePair } from '../../../odata/models/shared.model';
import { TccChooseInputElementComponent } from './tcc-choose-input-element/tcc-choose-input-element.component';
import { PageEvent } from '@angular/material/paginator';
import { MatTabChangeEvent } from '@angular/material/tabs';
import { TccODataService } from '../../../odata';
import { TccClarcDatePipe } from '../../pipes/tcc-clarc-date/tcc-clarc-date.pipe';
import { displayElement } from './tcc-abstract-display-element';
import { TccInputElementComponent } from './tcc-display-elements/tcc-input-element/tcc-input-element.component';
import { TccSelectElementComponent } from './tcc-display-elements/tcc-select-element/tcc-select-element.component';
import { TccAutocompleteInputElementComponent } from './tcc-display-elements/tcc-autocomplete-input-element/tcc-autocomplete-input-element.component';
import { TccBooleanElementComponent } from './tcc-display-elements/tcc-boolean-element/tcc-boolean-element.component';
import { TccButtonElementComponent } from './tcc-display-elements/tcc-button-element/tcc-button-element.component';
import { TccRadioButtonElementComponent } from './tcc-display-elements/tcc-radio-button-element/tcc-radio-button-element.component';
import { TccSearchListDialogElementComponent } from './tcc-display-elements/tcc-search-list-dialog-element/tcc-search-list-dialog-element.component';
import { TccCreateListDialogElementComponent } from './tcc-display-elements/tcc-create-list-dialog-element/tcc-create-list-dialog-element.component';
import { TccCreateSimpleListDialogElementComponent } from './tcc-display-elements/tcc-create-simple-list-dialog-element/tcc-create-simple-list-dialog-element.component';
import { Observable } from 'rxjs';
import { TccTagInputDisplayElementComponent } from './tcc-display-elements/tcc-tag-input-display-element/tcc-tag-input-display-element.component';
import { TccExpansionPanelIconControllerDirective } from '../../directives/tcc-expansion-panel-icon-controller/tcc-expansion-panel-icon-controller.directive';
import { TccBankersRoundingPipe } from '../../pipes/tcc-bankers-rounding/tcc-bankers-rounding.pipe';
import { rowButtonPipeOptions } from './pipes/get-row-buttons.pipe';
import { TccSearchListDialogServiceNamespace } from '../../services/tcc-search-list-dialog/tcc-search-list-dialog.service';
import { InputMaskHTMLElement } from './directives/input-mask-htmlelement';
import { TccRedirectService } from '../../../core/services/tcc-redirect/tcc-redirect';
import { LocaleService } from '../../../core/services/tcc-locale/tcc-locale.service';
import { TccHtmlElementComponent } from './tcc-display-elements/tcc-html-element/tcc-html-element.component';
import { TccTranslationPipe } from '../../pipes/tcc-translation/tcc-translation.pipe';
import { AppContext, AppLockStates } from '../../classes/app-context';
export declare class TccInputMaskComponent implements AfterViewInit {
private fb;
private datePipe;
private translationPipe;
private bankersRoundingPipe;
private redirectService;
private localeService;
globalVarContext?: AppContext;
dataCyInputElements: boolean;
dataCyAutocompleteElements: boolean;
dataCyTagInputElements: boolean;
dataCySelectElements: boolean;
dataCyBooleanElements: boolean;
dataCyRadioButtonElements: boolean;
dataCyTranslationElements: boolean;
dataCyDatepickerElements: boolean;
dataCySearchListElements: boolean;
dataCySearchListDialogElements: boolean;
dataCyCreateListDialogElements: boolean;
dataCyCreateSimpleListDialogElements: boolean;
dataCyButtonElements: boolean;
tccChooseInputElements: QueryList<TccChooseInputElementComponent>;
chipContainer: QueryList<ElementRef<HTMLDivElement>>;
paginators: QueryList<MatPaginator>;
expPanelDir: QueryList<TccExpansionPanelIconControllerDirective>;
htmlElementsList: QueryList<InputMaskHTMLElement>;
set entity(entity: Object);
permissionLevel: number;
set options(options: _TccInputMask.options);
inputsLoaded: EventEmitter<string[]>;
submit: EventEmitter<void>;
changeTab: EventEmitter<{
id: string;
value: MatTabChangeEvent;
}>;
changeChip: EventEmitter<{
id: string;
index: number;
}>;
changePage: EventEmitter<{
id: string;
value: PageEvent;
}>;
search: EventEmitter<_TccInputMask.eventOutput<_TccInputMask.ValueUnion>>;
searchEnter: EventEmitter<_TccInputMask.eventOutput<_TccInputMask.ValueUnion>>;
valueChange: EventEmitter<_TccInputMask.eventOutput<_TccInputMask.ValueUnion>>;
valueChangeExtended: EventEmitter<_TccInputMask.eventOutput<_TccInputMask.ValueUnion>>;
focusEvent: EventEmitter<_TccInputMask.eventTrigger>;
blurEvent: EventEmitter<_TccInputMask.eventTrigger>;
inputButtonClick: EventEmitter<_TccInputMask.eventTrigger>;
rowButtonClick: EventEmitter<_TccInputMask.eventTrigger>;
buttonClick: EventEmitter<_TccInputMask.eventTrigger>;
selectOpen: EventEmitter<_TccInputMask.eventTrigger>;
searchListChange: EventEmitter<{
id: string;
value: Array<string>;
}>;
searchListChangePage: EventEmitter<{
id: string;
pagenumber: number;
searchactive: boolean;
}>;
searchListSearch: EventEmitter<{
id: string;
searchstring: string;
selection?: string;
}>;
searchListDialogClose: EventEmitter<_TccInputMask.searchListDialogEvent>;
createListDialogClose: EventEmitter<_TccInputMask.createListDialogEvent>;
createSimpleListDialogClose: EventEmitter<_TccInputMask.eventOutput<_TccInputMask.ValueUnion>>;
fieldMouseEnter: EventEmitter<_TccInputMask.eventTrigger>;
fieldMouseLeave: EventEmitter<_TccInputMask.eventTrigger>;
openAccordion: EventEmitter<string>;
/**
* emits after entity values (from this.entity) have been set
*/
entityValuesSet: EventEmitter<void>;
/**
* emits after all suggestion values have been removed or set (-> no suggestion values are present anymore)
*/
allSuggestionValuesRemoved: EventEmitter<void>;
_form: UntypedFormGroup;
_inputElements: _TccInputMask.SectionElements;
_inputMaskId: string;
private elements;
private rows;
private elementKeys;
private structureElements;
_densityClass: string;
_markLastFocused: boolean;
_sidePadding: _TccInputMask.sidePaddingOptions;
_rowWidth: number;
_noTitleContainerMargin: number;
private initLoadInputs;
lastFocusedElement: _TccInputMask.eventTrigger;
_entity: Object;
_options: _TccInputMask.options;
_showSectionStateColor: boolean;
rowButtonFound: boolean;
collectionFound: boolean;
sectionType: typeof _TccInputMask.sectionType;
toggleComplexRows: {
[complexSectionId: string]: boolean;
};
htmlElementTemplates: Array<TemplateRef<any>>;
private htmlElements;
private confidences;
maxRowCount: number;
private toggleComplexRowTimeout;
private complexOpenCloseAnimationEnd;
/**
* Array of element ids, that have a suggestion value set.
*/
private activeSuggestionValues;
_inputmaskelementtypes: typeof _TccInputMask.elementtype;
private _refreshObservable;
/**
* element id of the last clicked formField. Will only be set, if the formField and not the input Element itself was clicked. Will be resetted on element focus (only holds state between mousedown event -> blur event of old element -> focus event of the formField input)
*/
private lastClickedFormField;
get changed(): boolean;
set changed(changed: boolean);
get refreshObservable(): Observable<void>;
_lockState: AppLockStates;
private setCollectionValueCommands$;
constructor(fb: UntypedFormBuilder, datePipe: TccClarcDatePipe, translationPipe: TccTranslationPipe, bankersRoundingPipe: TccBankersRoundingPipe, redirectService: TccRedirectService, localeService: LocaleService, globalVarContext?: AppContext);
ngAfterViewInit(): void;
private displayElementsReadyState$;
displayElementsReady$: Observable<boolean>;
resolveComplexRelationships(): void;
refresh(elements: _TccInputMask.SectionElements): Observable<void>;
initHTMLElements(): void;
private setInputMaskId;
private generateCombinedComplexChildrenControl;
private getCombinedComplexChildrenValidatorErrorMessage;
private buildControl;
private setNewControls;
private addSectionInformation;
private addSectionInformationForSectionContent;
private addSectionInformationForDisplayElement;
private addSectionInformationForRow;
private getValidatorArray;
private buildGroupValidator;
private setDisplayElementTypeForCypress;
private getElementFromSectionContent;
private getTranslation;
onSubmit(): void;
_onChangeChip(chipContainer: HTMLDivElement, id: string, i: number): void;
_onChangeTab(event: MatTabChangeEvent, id: string): void;
_onChangePage(event: PageEvent, id: string): void;
_onSearch(event: {
value: string;
selected: string;
}, id: string): void;
_specialElementSearch(event: _TccInputMask.eventOutput): void;
_specialElementSearchEnter(event: _TccInputMask.eventOutput): void;
_onSelectOpen(event: _TccInputMask.eventTrigger): void;
_changeEvent(event: _TccInputMask.eventOutput): void;
_changeEventExtended(event: _TccInputMask.eventOutput): void;
_focusEvent(event: _TccInputMask.eventTrigger): void;
_blurEvent(event: _TccInputMask.eventTrigger): void;
_fieldMouseEnter(event: _TccInputMask.eventTrigger): void;
_fieldMouseLeave(event: _TccInputMask.eventTrigger): void;
_openAccordion(id: string): void;
_inputButtonClickEvent(event: _TccInputMask.eventTrigger): void;
_searchListChangePageEvent(event: {
id: string;
pagenumber: number;
searchactive: boolean;
}): void;
_searchListChangeEvent(event: {
id: string;
value: Array<string>;
}, GroupingElementId: string): void;
_searchListSearchEvent(event: {
id: string;
searchstring: string;
selection?: string;
}): void;
_onButtonClick(event: _TccInputMask.eventTrigger): void;
_searchListDialogClose(event: _TccInputMask.searchListDialogEvent): void;
_createListDialogClose(event: _TccInputMask.createListDialogEvent): void;
_createSimpleListDialogClose(event: _TccInputMask.eventOutput): void;
/**
* Opens all complex properties upwards of the element with the given id.
* @param childElementId id of the start element
* @returns If the direct parent needs to be opend returns true, if not false
*/
private openComplexParent;
private closeComplexParent;
_setConfidence(event: _TccInputMask.eventOutput<number>): void;
_displayElementAddRowEvent(event: _TccInputMask.addRowEvent): void;
_displayElementRemoveCollectionElement(event: TccInputMask.eventTrigger): void;
_createNewEntity(event: _TccInputMask.eventTrigger): void;
_onDisplayElementDestroy(displayElement: displayElement): void;
private buildStructureElementsObj;
private buildStructureElementsObjForSection;
private buildStructureElementsObjForSectionContent;
private buildStructureElementsObjForDisplayElement;
getStructureElement(id: string): _TccInputMask.SectionElement | _TccInputMask.RowElement;
getDisplayElement(id: string | {
id: string;
index: number;
}): displayElement;
getDisplayElement(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.input): TccInputElementComponent;
getDisplayElement(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.autocomplete): TccAutocompleteInputElementComponent;
getDisplayElement(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.textfield): TccInputElementComponent;
getDisplayElement(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.datepicker): TccInputElementComponent;
getDisplayElement(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.text): TccInputElementComponent;
getDisplayElement(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.translation): TccInputElementComponent;
getDisplayElement(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.select): TccSelectElementComponent;
getDisplayElement(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.checkbox): TccBooleanElementComponent;
getDisplayElement(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.switch): TccBooleanElementComponent;
getDisplayElement(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.button): TccButtonElementComponent;
getDisplayElement(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.radiobutton): TccRadioButtonElementComponent;
getDisplayElement(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.searchlistDialog): TccSearchListDialogElementComponent;
getDisplayElement(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.createListDialog): TccCreateListDialogElementComponent;
getDisplayElement(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.createSimpleListDialog): TccCreateSimpleListDialogElementComponent;
getDisplayElement(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.tagInput): TccTagInputDisplayElementComponent;
getDisplayElement(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.htmlElement): TccHtmlElementComponent;
private getInnerFormElement;
getFormElement(id: string): AbstractControl;
private setValueInComplexParent;
/**
* sets an error in an element
*
*/
setCustomError(id: string, errorMessage: string): void;
/**
* removes an error in an element
*
*/
removeCustomError(id: string): void;
setHintMessage(id: string, message: string, type?: _TccInputMask.notificationType): void;
/**
* removes the hint message of the element with the given id
*
* @param {string} id displayElement id
*/
removeHintMessage(id: string): void;
/**
* adds a notification to the element with the given id
* @param {string} id displayElement id
* @param {TccInputMask.notification} notification notification to <address></address>
*/
setNotification(id: string, notification: TccInputMask.notification): void;
/**
* removes the notification of the element with the given id
* @param {string} id displayElement id
*/
removeNotification(id: string): void;
/**
* accepts all suggested value
*/
acceptAllSuggestions(): void;
/**
* accepts the suggested value for field with given id
* @param id fieldId
*/
acceptSuggestionValue(id: string): void;
/**
* discards all suggested values
*/
discardAllSuggestions(): void;
/**
* discards the suggested value for field with given id
* @param id fieldId
*/
discardSuggestionValue(id: string): void;
/**
* registers a suggestionValue as set
*/
_suggestionValueSet(elementId: string): void;
/**
* removes the registration of a suggestion value
*/
_suggestionValueRemoved(elementId: string): void;
/**
* sets the value of an element (if the element is a collection element, setValue sets only the value of this element)
*
* @returns an observable, that fires when all elements are ready
*/
setValueAsync(id: string, value: _TccInputMask.ValueUnion | _TccInputMask.ValueUnion[], options?: _TccInputMask.setValueOptions): Observable<void>;
/**
* sets the value of an element (if the element is a collection element, setValue sets only the value of this element)
*
* @returns element.value
*/
setValue(id: string, value: _TccInputMask.ValueUnion | _TccInputMask.ValueUnion[], options?: _TccInputMask.setValueOptions): void;
/**
* sets the values of a collection element asynchronous bevause displayElements have to be created first
*/
private processSetCollectionValue;
/**
* sets a value suggestion of an element (if the element is a collection element, setValue sets only the value of this element)
*
* @returns element.value
*/
setValueSuggestion(id: string, value: _TccInputMask.ValueUnion | _TccInputMask.ValueUnion[], options?: _TccInputMask.setValueSuggestionOptions): void;
/**
* sets all values using the entity and the provided path from TccInputMask.DisplayPathElement
*/
private setValuesByEntity;
/**
* sets the value using the entity and the provided path from TccInputMask.DisplayPathElement
*/
private setValueByEntity;
private getEntityValueByPath;
/**
* checks an object, if the inputMask would be valid with the given data. Does NOT affect the inputMask in any way.
*
* @param entity object to check
*/
checkEntity(entity: Object): boolean;
/**
* resets the Value of the Element with the given id
*
* @param id id of the element
*/
resetValue(id: string): void;
setSelections(id: string, selections: Array<string> | Array<TccKeyValuePair>): void;
addToSelection(id: string, value: string | TccKeyValuePair, allowDuplicates?: boolean): void;
removeFromSelection(id: string, value: string | TccKeyValuePair): void;
refreshSelectionList(id: string): void;
setAutocomplete(id: string, list: Array<string | TccKeyValuePair>): void;
setReadonly(id: string, readonly: boolean): void;
setPaginatorCount(id: string, count: number): void;
resetPaginator(id?: string): void;
setActiveChip(id: string, chipId: string): void;
startLoadOptions(id: string): void;
endLoadOptions(id: string): void;
/**
* resets the fromGroup. Will not reset elements, that have more complex data that isnt saved in the form. For complete resets use reset/resetChanges/resetValue
*/
clearValues(): void;
hideElements(ids: Array<string>): void;
hideElement(id: string): void;
showElements(ids: Array<string>): void;
showElement(id: string): void;
hideSectionElement(id: string): void;
showSectionElement(id: string): void;
private getSectionById;
getFirstVisibleElementOfSection(sectionId: string): string;
private getSectionByCaption;
verify(): boolean;
_formFieldContainerMouseDown(event: TccInputMask.eventTrigger): void;
/**
* focus requested from the displayElement, so the inputMask can open potentially closed parents (complex elements)
*/
_focusRequested(complexSectionId: string): void;
focus(id: string, index?: number): void;
onComplexOpened(id: any): void;
focusNextElement(): void;
getFocusedElement(): displayElement;
getNextErrorElement(): displayElement;
getFirstErrorElement(): displayElement;
private _getNextErrorElement;
private getFirstElement;
clearValueChanges(): void;
get valueChanges(): _TccInputMask.valueChanges;
get values(): _TccInputMask.valueChanges;
private getValueObject;
private setValueObjectForRow;
private setValueObjectForDisplayElement;
getValue(id: string | {
id: string;
index: number;
}): _TccInputMask.ValueUnion;
getValue(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.datepicker): string;
getValue(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.translation): TccTranslation;
getValue(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.text): string;
getValue(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.button): string;
getValue(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.switch): boolean;
getValue(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.checkbox): boolean;
getValue(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.select): string | number;
getValue(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.textfield): string | number;
getValue(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.input): string | number;
getValue(id: string | {
id: string;
index: number;
}, type: _TccInputMask.elementtype.createListDialog): Array<TccKeyValuePair>;
/**
* Resets all Values in valueChanges to its init value and clears valueChanges
*/
resetChanges(): void;
/**
* resets everything to its init state
*/
reset(): void;
private removeClonedRows;
private _removeClonedRows;
/**
* deletes displayElements from elements and collectionOrig _siblings.#activeElement.
* Will not delete children from complex elements
* @param displayElements
*/
private deleteSiblingElements;
setDefaults(keepSetDefaults?: boolean): void;
setDefault(id: string, keepSetDefaults?: boolean): void;
_rowButtonClick(section: _TccInputMask.SectionElement, row: _TccInputMask.RowElement, rowButton: rowButtonPipeOptions): void;
addRowToCollection(sectionElementId: string, rowElementId: string, index?: number, value?: _TccInputMask.ValueUnion | _TccInputMask.complexValueObjectChildren): void;
_addRowToCollection(sectionElementId: string, rowElementId: string, index?: number, value?: _TccInputMask.ValueUnion | _TccInputMask.complexValueObjectChildren): Observable<void>;
_displayElementAddRowForSuggestionEvent(event: TccInputMask.addRowForSuggestionEvent): void;
private _addRowsToCollection;
private findRowForCloneing_Section;
private findRowForCloneing_Row;
private findRowForCloneing_DisplayElement;
private replaceRowIds;
private _replaceRowIds;
private replaceDisplayElementIds;
private _replaceDisplayElementIds;
private adjustSiblingIndices;
private deleteCollectionSiblingElement;
deleteRowFromCollection(rowElementId: any): void;
/**
* clone a row for collection rows (clone all children, if row has collection = true, clone only collection elements, if row has clone = false)
* @param {_TccInputMask.RowElement} row row to clone
* @returns {_TccInputMask.RowElement} new row
*/
private cloneRow;
private _cloneRow;
private setUnclonableObjects;
private removeValidatorsAnd_elements;
private removeValidatorsAnd_elementsForDisplayElement;
toggleComplexRow(complexSection: _TccInputMask.SectionElement): void;
openComplexRow(complexSection: _TccInputMask.SectionElement): void;
openComplexRowById(complexSectionId: string): void;
closeComplexRow(complexSection: _TccInputMask.SectionElement): void;
closeComplexRowById(complexSectionId: string): void;
private setOpenCloseComplexRowTimeout;
setSearchListDialogService<T>(elementId: string, chipId: string, service: TccODataService<T>): void;
setSearchListDialogActiveItems(elementId: string, chipId: string, activeItems: Array<TccSearchListDialogServiceNamespace.item>): void;
setSearchListDialogPermanentItems(elementId: string, chipId: string, permanentItems: TccSearchListDialogServiceNamespace.item[]): void;
/**
* sets all possible items (if they do not nedd to be loaded from the server); needs to be called AFTER initSearchListDialogElement;
* @param elementId
* @param chipId
* @param allItems
*/
setSearchListDialogAllItems(elementId: string, chipId: string, allItems: Array<TccSearchListDialogServiceNamespace.item>): void;
setSearchListDialogDisabledItems(elementId: string, chipId: string, disabledItems: string[]): void;
initSearchListDialogElement(): void;
setCreateListDialogActiveItems(elementId: string, chipId: string, activeItems: _TccInputMask.createListDialogActiveItem[]): void;
setCreateSimpleListDialogActiveItems(elementId: string, activeItems: string[]): void;
initCreateListDialogElement(): void;
initCreateSimpleListDialogElement(): void;
private getLastEntityObjectByPath;
setEntityValueChanges(entity?: Object, valueChanges?: _TccInputMask.valueChanges): void;
/**
* disables/enables all currently visible elements
* @param disable true: disable all, false; enable all
* @param omitExplicitlySetElements if true, omits all elements, that have disabled explicitly set to true
*/
disableInputmask(disable: boolean, omitExplicitlySetElements?: boolean): void;
/**
* registers the element in this.elements and if this._entity is set, sets the value using the path property of the element
* @param element the displayElement
* @param sectionId
* @param rowId
*/
registerElement(element: displayElement, sectionId: string, rowId: string): void;
private registerDisplayElementState;
private unregisterDisplayElementState;
togglePanelIcon(state: boolean, index: number): void;
highlightElement(elementId: string): void;
setTooltip(elementId: string, value: string): void;
addInputButton(elementId: string, options: TccInputMask.extraButtonOptions): void;
deleteInputButton(elementId: string): void;
private setInputElements;
}