@ctodev/cclibrary-typings
Version:
Library typings for use with CLARC INFINITY
122 lines (121 loc) • 6.17 kB
TypeScript
import { Observable, OperatorFunction } from "rxjs";
import { TccODataQuery } from "../../odata/services/tcc-odata-query/tcc-odata-query";
import { TccInfinityScrollComponent } from "../components/tcc-infinity-scroll/tcc-infinity-scroll.component";
import { IExpandable, TccC4Node, TccKeyValuePair } from "../../odata/models/shared.model";
import { TccErrorResponse } from "../../odata/interceptors/tcc-error-translation/tcc-error-translation.interceptor";
import { TccSnackBarService } from "../../core/services/tcc-snackbar/tcc-snackbar.service";
import { TccTranslationPipe } from "../pipes/tcc-translation/tcc-translation.pipe";
import { Router } from "@angular/router";
import { MatDialogRef } from "@angular/material/dialog";
export declare namespace tccCommonFunction {
interface returnType<T> {
errors: {
[entityKey: string]: TccErrorResponse;
};
results: T[];
}
}
export declare class TccCommonFunction {
static compare(a: number | string | boolean, b: number | string | boolean, isAsc: boolean): number;
/**
* creates a keyFalue list from a string[]
*/
static getTccKeyValueListFromStringArray(values: string[] | TccKeyValuePair[]): Array<TccKeyValuePair>;
/**
* deprecated use initScrolling
* @param obs
* @param Query
* @param infinityScroll
* @param length
* @returns
*/
static checkScroll<T>(obs: Observable<T[]>, Query: TccODataQuery<T>, infinityScroll: TccInfinityScrollComponent, length: number): Observable<T[]>;
static getNodeNames(Nodes: TccC4Node[], idArr: string[]): {
[id: string]: string;
};
static capitalizeString(str: string): string;
static execMultiOperation<T>(observables: {
[key: string]: Observable<T>;
}): Observable<tccCommonFunction.returnType<T>>;
/**
* @description generates a selectionList for an enum from modelTranslations
*
* @param type string z.B.: TccAnyscan_Translations
* @param enumname string z.B.: Technology
* @param enumeration enum z.B.: TccAnyscan.Technology
* @returns KeyValuePair List für SelectionBox
*/
static generateSelectionList(type: string, enumname: string, enumeration: any, inverted?: boolean): TccKeyValuePair[];
/**
* @description generates a selectionList for an enum from modelTranslations
*
* @param type string z.B.: TccAnyscan_Translations
* @param enumname string z.B.: Technology
* @param enumeration enum z.B.: TccAnyscan.Technology
* @param filterValues stringArray of values, that should be excluded z.B.: [TccAnyscan.Technology]
* @returns KeyValuePair List für SelectionBox
*/
static generateSelectionListFiltered(type: string, enumname: string, enumeration: any, filterValues: string[], inverted?: boolean): TccKeyValuePair[];
/**
* @description generates a selectionList for any enum
*
* @param {enumeration} enumeration the enumeration, that will be used to make the selection list
* @param {boolean} inverted inverts Key and Value
* @param {integer} removeFromStart removes that number of chars from the start of every value. To Remove the Constant Prefix
* @param {{start?: string, end?: string}} addString adds additional chars to the start or end of the enum value
* @returns KeyValuePair List für SelectionBox
*/
static generateSelectionListFromEnum(enumeration: any, inverted?: boolean, removeFromStart?: number, addString?: {
start?: string;
end?: string;
}): TccKeyValuePair[];
private static addChars;
/**
*
* @param nodes TccC4Node[] Array of Nodes which should be selectable in Selectionbox
* @returns KeyValuePair List für SelectionBox
*/
static generateSelectionListForNodes(nodes: TccC4Node[], translationPipe: TccTranslationPipe): TccKeyValuePair[];
/**
* Loads inital Data for infinityScroll. Loads until able to scroll or no more elements
* unintentionally loads one page too many
* @param query
* @param PageSize
* @param infinityScroll
* @param initCheck checks scroll even before the query is used to get data
* @returns
*/
static initScrolling<T>(query: TccODataQuery<T>, PageSize: number, infinityScroll: TccInfinityScrollComponent, callbackFunction: (entities: T[]) => Observable<T[]>, initCheck?: boolean): Observable<T[]>;
static catchError<T>(snackBar: TccSnackBarService): OperatorFunction<T, T | never>;
static checkForErrorResponse(err: any): boolean;
/**
* Creates a filter string for odataFilter. Use for search functionality, until server fullTextSearch is implemented
* @param properties all properties, in which the searchStr should be searched
* @param searchStr string, that gets searched
*/
static getSearchFilterString(properties: string[], searchStr: string): string;
/**
* @description Searches through an object, and returns the value based on the provided path
* @param obj object, in which the path should be searched
* @param path path, that gets searched
*/
static findData(obj: any, path: string[]): any;
static isValueInStringEnum<E extends string>(strEnum: Record<string, E>): (value: string) => value is E;
static primitiveToBoolean(value: string | number | boolean | null | undefined): boolean;
static isUndefinedOrNull(val: any): boolean;
static transformTccMessageItem(text: string, args?: string[]): string;
static CreateUUID(): string;
/**
* @description Sets a browser cookie
* @param name string, name of the cookie
* @param value object, value of the cookie
* @param expiration number, time until the cookie expires (miliseconds), default is 7 days if not set
*/
static setCookie(name: string, value: object, expiration?: number): void;
/**
* @description Gets a browser cookie, returns null if none is found
* @param name string, name of the cookie
*/
static getCookie(name: string): IExpandable | null;
static closeDialogOnNavigate(router: Router, dialogRef: MatDialogRef<any, any>): void;
}