@ctodev/cclibrary-typings
Version:
Library typings for use with CLARC INFINITY
461 lines (460 loc) • 13 kB
TypeScript
import { ElementRef, EventEmitter, OnInit } from "@angular/core";
import { TccInputMask } from "../../models/inputMask.model";
import { UntypedFormControl } from "@angular/forms";
import { TccTranslation } from "../../../odata/models/shared.model";
import { TccValidators } from "../../models/form-error.model";
/**
* Usage Nodes: class extend displayElement
*
* - include all needed css files. (commonStyles.css is allways needed)
*
* - implement all abstract functions -> see individual function descriptions
*
* - html requirements:
* - [class.chooseInputElementInvisible]="_element.visible === false" on element container
* - use <tcc-element-notification [element]="_element" [notificationClasses]="notificationClasses"></tcc-element-notification> -> see component description for details
* - use sizeClasses string for the size of the element
* - use colorClasses string for the color of the element
* - use customClasses string to set custom classes
* - use #activeElement in the user interaction element -> see activeElement description
* - call valueChange
* - call valueChangeExtended or call this.changeEventExtended(false) in changeElement()
*
* - add type specific functions (example: addToSelection in tcc-select-element.component)
*/
export declare abstract class displayElement implements OnInit {
private _elementRef;
constructor(_elementRef: ElementRef);
/**
* the html user interaction element, example: <input #activeElement></input>; <mat-select #activeElement></mat-select>; <button #activeElement></button>;
*/
activeElement: any;
/**
* init callback
*/
initCallback: EventEmitter<displayElement>;
/**
* valueChange output
*/
valueChange: EventEmitter<TccInputMask.eventOutput<TccInputMask.ValueUnion>>;
/**
* valueChange output on every keyPress
*/
valueChangeExtended: EventEmitter<TccInputMask.eventOutput<TccInputMask.ValueUnion>>;
/**
* focusEvent output, currently implemented in input, textfield, datepicker, autocomplete, select
*/
focusEvent: EventEmitter<TccInputMask.eventTrigger>;
/**
* blurEvent output, currently implemented in input, textfield, datepicker, autocomplete, select
*/
blurEvent: EventEmitter<TccInputMask.eventTrigger>;
/**
* inputButtonClickEvent output
*/
inputButtonClick: EventEmitter<TccInputMask.eventTrigger>;
/**
*mouseEnter event on a field
*/
fieldMouseEnter: EventEmitter<TccInputMask.eventTrigger>;
/**
* mouseLeave event on a field
*/
fieldMouseLeave: EventEmitter<TccInputMask.eventTrigger>;
/**
* sets the formControl, then calls onSetForm for type specific init
*
* @param {UntypedFormControl} control
*/
set form(control: UntypedFormControl);
/**
* sets the element and inits notification, size and color classes, then calls onSetElement for type specific init
*
* @param {TccInputMask.DisplayElement} data
*/
set element(element: TccInputMask.DisplayElement);
/**
* markes element same as focused
*
* @param {boolean} markAsFocused
*/
set markAsFocused(markAsFocused: boolean);
/**
* TccInputMask.elementtype
*/
type: TccInputMask.elementtype;
/**
* id
*/
id: string;
/**
* classes added to the notification element
*/
notificationClasses: string;
/**
* classes to set the size of the element
*/
sizeClasses: string;
/**
* classes to set the color of the element
*/
colorClasses: string;
/**
* classes added to the element
*/
customClasses: string;
/**
* formControl
*/
_formControl: UntypedFormControl;
/**
* _inputmaskelementtypes only for html template access
*/
_inputmaskelementtypes: typeof TccInputMask.elementtype;
/**
* element
*/
abstract _element: TccInputMask.DisplayElement;
/**
* element name
*/
_name: string | TccTranslation;
/**
* additional class to add
*/
_class: string;
/**
* if the element is hidden
*/
_hide: boolean;
/**
* if the element is visible
*/
_visible: boolean;
/**
* notifications
*/
_notification: TccInputMask.notification;
/**
* prefix with custom icon
*/
_prefix: string;
/**
* prefix with material icon
*/
_matPrefix: string;
/**
* readonly element
*/
_readonly: boolean;
/**
* disabled element
*/
_disabled: boolean;
/**
* element color
*/
_color: TccInputMask.colors;
/**
* default value
*/
_default: TccInputMask.ValueUnion;
/**
* value
*/
_value: TccInputMask.ValueUnion;
/**
* width
*/
_width: TccInputMask.inputWidth;
/**
* width as string, accepts all css variants
*/
_widthString: string;
/**
* validators
*/
_validators: TccValidators[];
/**
* validator names. Cypress test properties need them to know, which validators should be checked. Only standard validators can be checked.
*/
_activeValidatorNamesForCypress: {
min?: number;
max?: number;
required?: boolean;
email?: boolean;
minlength?: number;
maxlength?: number;
pattern?: string;
};
/**
* if the element is a collection element
*/
_collection: boolean;
/**
* if customValidator shows an error
*/
protected customValidatorActive: boolean;
/**
* value changed by user input or setValue(..., true)
*/
protected _changedValue: TccInputMask.ValueUnion | TccInputMask.valueChanges;
/**
* builds event trigger object with id, section and row of the element
*
* @returns The eventTrigger
*/
get changedValue(): TccInputMask.eventOutput;
/**
* builds event trigger object with id, section and row of the element
*
* @returns The eventTrigger
*/
get eventTrigger(): TccInputMask.eventTrigger;
ngOnInit(): void;
/**
* builds event output object
*
* @returns The eventOutput
*/
protected buildEventOutput(): TccInputMask.eventOutput;
private setElementColor;
/**
* copies the properties from the config object to the local variables
*/
private setProperties;
private getValidators;
private getValidatorInformationForCypress;
/**
* builds notification classes string
*/
private buildNotificationClasses;
/**
* builds size classes string
*/
private buildSizeClasses;
/**
* returns the formControl
*
* @returns The formControl
*/
getControl(): UntypedFormControl;
/**
* emits the changeEvent -> only on changeEnd
* example: inputElement: after change AND focusOut; select: on select option;
*/
changeEvent(): void;
/**
* emits the changeEventExtended -> every keydown or any changes to the element
*
* @param {boolean} changeElement if the element should be changed (_element.value)
*/
changeEventExtended(changeElement?: boolean): void;
/**
* emits the focusEvent
*/
_focusEvent(): void;
/**
* focusOutEvent (blurEvent)
*/
focusOutEvent(): void;
/**
* fieldMouseEnter
*/
_fieldMouseEnter(): void;
/**
* fieldMouseLeave
*/
_fieldMouseLeave(): void;
/**
* emits the inputButtonClickEvent
*/
inputButtonClickEvent(): void;
/**
* resets the element to its complete init state (using the inputElement config)
*/
reset(): void;
/**
* sets the value to the init value.
*/
resetValue(): void;
/**
* sets or removes readonly
*
* @param {boolean} readonly true: element will be set readonly
*/
setReadonly(readonly: boolean): void;
/**
* sets or removes disabled
*
* @param {boolean} disabled true: element will be set disabed
*/
setDisabled(disabled: boolean): void;
/**
* sets the visibility of the element to the value
*
* @param {boolean} visible
*/
setVisible(visible: boolean): void;
/**
* shows or hides the element
*
* @param {boolean} hide true: element will be REMOVED from the html
*/
hideElement(hide: boolean): void;
/**
* sets the default of the element to the value
*
* @param {boolean} keepSetDefaults true: if the element already has a default other than undefined, don't set the default
*/
setDefault(keepSetDefaults?: boolean): void;
/**
* sets the value of the element
*
* @param {TccInputMask.ValueUnion} value
* @param {boolean} setValueChange true: set the value in value changes as well
*/
setValue(value: TccInputMask.ValueUnion, options?: TccInputMask.setValueOptions): void;
/**
* sets a custom error
*
* @param {string} errorMessage
*/
setCustomError(errorMessage: string): void;
/**
* removes the custom error
*/
removeCustomError(): void;
/**
* removes the valueChanges
*/
clearValueChanges(): void;
/**
* checks, if the element is focused
*
* @returns true, if the element is focused
*/
isFocused(): any;
/**
* returns, if the formControl is valid
*
* @returns returns _formControl.valid
*
*/
isValid(): boolean;
/**
* get the value of the element
*
* @returns element.value; get typed displayElement for return value type
*/
abstract getValue(): any;
/**
* refreshs the element
*/
abstract refresh(): void;
/**
* verifies the element based on the validators
*
* @returns if the inputMask is valid
*/
abstract verify(): boolean;
/**
* sets the focus to the element
*/
abstract focus(): void;
/**
* function that will be called in changeEvent, bevor the event is thrown
*/
protected abstract changeElement(): void;
/**
* function will be called, after the element is set and standard init is done
*/
protected abstract onSetElement(): void;
/**
* function will be called, after the formControl is set
*/
protected abstract onSetForm(): void;
}
export declare abstract class displayFullFieldElement extends displayElement {
setConfidence: EventEmitter<TccInputMask.eventOutput<number>>;
set element(element: TccInputMask.DisplayFullFieldElement);
private set confidence(value);
private get confidence();
/**
* placeholder in place of the input value
*/
_placeholder: string;
/**
* hint below the element
*/
_hintMessage: string;
/**
* type of the hint below the element
*/
_hintType: TccInputMask.notificationType;
/**
* label
*/
_label: boolean;
/**
* set to true to start highlighting
*/
_highlighting: boolean;
private confidenceErrorSet;
private _confidence;
private confidenceHintMessageSet;
private statusChangeSubscription;
showHintMessage: boolean;
Alerticon: {
Success: import("../..").TccLibIcons.Icon;
Error: import("../..").TccLibIcons.Icon;
Info: import("../..").TccLibIcons.Icon;
Warning: import("../..").TccLibIcons.Icon;
Question: import("../..").TccLibIcons.Icon;
};
protected afterViewInit(): void;
protected onDestroy(): void;
/**
* sets the value of the element
*
* @param {TccInputMask.ValueUnion} value
* @param {boolean} setValueChange true: set the value in value changes as well
*/
setValue(value: TccInputMask.ValueUnion, options?: TccInputMask.setValueOptions): void;
/**
* starts the highlight animation for the element
*/
highlight(): void;
/**
* emits the changeEventExtended -> every keydown or any changes to the element
*
* @param {boolean} changeElement if the element should be changed (_element.value)
*/
changeEventExtended(changeElement?: boolean): void;
/**
* sets the value of the element
*
* @param {string} errorMessage
*/
private setConfidenceError;
private initHintMessage;
/**
* sets success message. Will Only be shown, if no error is shown
*
* @param {string} message
*/
setHintMessage(message: string, type?: TccInputMask.notificationType): void;
/**
* sets success message. Will Only be shown, if no error is shown
*
* @param {string} message
*/
removeHintMessage(): void;
}
export declare abstract class displayExtraButtonFieldElement extends displayFullFieldElement {
set element(element: TccInputMask.DisplayExtraButtonFieldElement);
/**
* button options
*/
_button: TccInputMask.extraButtonOptions;
}