@ctodev/cclibrary-typings
Version:
Library typings for use with CLARC INFINITY
170 lines (169 loc) • 7.79 kB
TypeScript
import { TccBoProperties, TccBoProperty, TccBoPropertyState, TccSimpleNote, TccZone } from '../../odata/models/shared.model';
import { TccET_BIZOBJ } from '../../odata/models/bizobj.model';
import { TccGetBoPropertyService } from '../services/tcc-get-bo-property/tcc-get-bo-property.service';
import { TccGetBoProperty } from './tcc-get-bo-property.class';
export declare namespace TccBoPropValue {
enum ValueType {
primitive = 0,
primitivecollection = 1,
enum = 2,
enumcollection = 3,
complex = 4,
complexcollection = 5
}
interface inputMaskValueOutput {
id: string;
section: string;
row: string;
value: TccBoProperty.PrimitiveValue | TccBoProperty.PrimitiveValue[] | TccBoProperty.EnumValue | TccBoProperty.EnumValue[] | {
[propId: string]: inputMaskValueOutput;
} | {
[propId: string]: inputMaskValueOutput;
}[];
}
type SimpleProperty = PrimitiveProperty | EnumProperty | PrimitiveCollectionProperty | EnumCollectionProperty;
const SimpleProperties: Set<ValueType>;
type PropValueUnion = PrimitiveProperty | EnumProperty | ComplexProperty | PrimitiveCollectionProperty | EnumCollectionProperty | ComplexCollectionProperty;
interface iComplexValue {
[propName: string]: PropValueUnion;
}
interface iBaseProperty {
readonly propservice: TccGetBoProperty.Handler;
readonly Path: string[];
}
abstract class iProperty<T extends ValueType> implements iBaseProperty, TccBoProperty.iBoProperty {
readonly Path: string[];
protected type: T;
readonly propservice: TccGetBoProperty.Handler;
Zone: TccZone;
Confidence: number;
State: TccBoPropertyState;
Notes: TccSimpleNote[];
IsSimpleType(): this is SimpleProperty;
IsComplexCollectionType(): this is ComplexCollectionProperty;
get Name(): string;
get Type(): T;
abstract get Raw(): TccBoProperty.Property;
protected get BaseRaw(): TccBoProperty.iBoProperty;
abstract readonly BoProp: TccGetBoProperty.PropertyTypes;
constructor(prop: TccBoProperty.iBoProperty, Path: string[], type: T, propservice: TccGetBoProperty.Handler);
}
class PrimitiveProperty extends iProperty<ValueType.primitive> {
Value: TccBoProperty.PrimitiveValue;
readonly BoProp: TccET_BIZOBJ.PrimitiveProperty;
constructor(prop: TccBoProperty.Primitive, Path: string[], propservice: TccGetBoProperty.Handler, boProp?: TccET_BIZOBJ.PrimitiveProperty);
get Raw(): TccBoProperty.Primitive;
}
class EnumProperty extends iProperty<ValueType.enum> {
Value: TccBoProperty.EnumValue;
readonly BoProp: TccET_BIZOBJ.EnumerationProperty;
constructor(prop: TccBoProperty.Enum, Path: string[], propservice: TccGetBoProperty.Handler, boProp?: TccET_BIZOBJ.EnumerationProperty);
get Raw(): TccBoProperty.Enum;
}
class PrimitiveCollectionProperty extends iProperty<ValueType.primitivecollection> {
Value: TccBoProperty.PrimitiveValue[];
readonly BoProp: TccET_BIZOBJ.PrimitiveProperty;
constructor(prop: TccBoProperty.PrimitiveCollection, Path: string[], propservice: TccGetBoProperty.Handler, boProp?: TccET_BIZOBJ.PrimitiveProperty);
get Raw(): TccBoProperty.PrimitiveCollection;
}
class EnumCollectionProperty extends iProperty<ValueType.enumcollection> {
Value: TccBoProperty.EnumValue[];
readonly BoProp: TccET_BIZOBJ.EnumerationProperty;
constructor(prop: TccBoProperty.EnumCollection, Path: string[], propservice: TccGetBoProperty.Handler, boProp?: TccET_BIZOBJ.EnumerationProperty);
get Raw(): TccBoProperty.EnumCollection;
}
class ComplexValue {
private owner;
private val;
private get propservice();
constructor(owner: iBaseProperty, val?: TccBoProperty.ComplexValue);
protected set Value(val: TccBoProperty.ComplexValue);
get serializedValue(): TccBoProperty.ComplexValue;
get Values(): PropValueUnion[];
getChild(childname: string): PropValueUnion;
addById(id: string): PropValueUnion;
addChild(name: string): PropValueUnion;
protected _addByPath(path: string[]): PropValueUnion;
addByPath(path: string[]): PropValueUnion;
protected _getByPath(path: string[]): PropValueUnion;
getByPath(path: string[]): PropValueUnion;
private checkForPath;
private createProperty;
private inferTccBoPropertyValueType;
}
class ComplexProperty extends iProperty<ValueType.complex> {
Value: ComplexValue;
readonly BoProp: TccET_BIZOBJ.ComplexProperty;
constructor(prop: TccBoProperty.Complex, Path: string[], propservice: TccGetBoProperty.Handler, boProp?: TccET_BIZOBJ.ComplexProperty);
get Raw(): TccBoProperty.Complex;
}
class ComplexCollectionProperty extends iProperty<ValueType.complexcollection> {
Value: ComplexProperty[];
readonly BoProp: TccET_BIZOBJ.ComplexProperty;
constructor(prop: TccBoProperty.ComplexCollection, Path: string[], propservice: TccGetBoProperty.Handler, boProp?: TccET_BIZOBJ.ComplexProperty);
private set Raw(value);
get Raw(): TccBoProperty.ComplexCollection;
getChild(name: string, rowIndex?: number): PropValueUnion;
deleteRow(index: number): void;
addRow(index?: number): ComplexProperty;
/**
* generates a new row without adding it to the data object
* @param index row index
* @returns the generated row
*/
generateRow(index?: number): ComplexProperty;
/**
*
* @param row a generated row (using generateRow)
* @param index row index
*/
addGeneratedRow(row: ComplexProperty, index?: number): ComplexProperty;
clear(): void;
}
class RootProperty extends ComplexValue {
constructor(prop: TccBoProperties, propservice: TccGetBoProperty.Handler);
get Raw(): TccBoProperties;
}
class Controller {
private _boProp;
get boProp(): TccGetBoProperty.Handler;
private boPropService;
private originalvalues;
private root;
constructor(getBoPropertyService?: TccGetBoPropertyService);
set BusinessObject(bo: TccET_BIZOBJ.BusinessObject);
set noBO(bool: boolean);
get Root(): RootProperty;
clear(): void;
set PropertyValues(val: TccBoProperties);
get PropertyValues(): TccBoProperties;
private normalizePath;
getByPath(path: string | string[]): PropValueUnion;
addByPath(path: string | string[]): PropValueUnion;
getById(id: string): PropValueUnion;
/**
* Gibt alle MetaDataValues außer die Tabellen/Arrays zurück. Werden auf die Id gemappt
* @param metadata metadata to traverse
* @returns all propertyvalues by id
*/
getMetaDataValueRecursive(): {
[propid: string]: any;
};
private getMetaDataRecursive;
/**
* For getValue
* @param metadata Properties
* @param propertyId bo propertyId of a primitive or enum property
* @returns the value of the property
*/
getMetaDataValue(propertyId: string): any;
/**
* For complexCollectionProperties all rows must be provided
* @param propertyId
* @param value
*/
setMetaDataValue(propertyId: string, value: inputMaskValueOutput, skipProperties?: string[]): void;
private _setMetaDataValue;
private fetchEditableProperty;
}
}