Add DataContract on Models in SVGLDLibs

This commit is contained in:
Guillaume Tauzin 2022-10-12 15:56:00 +02:00
parent 1cd25eba03
commit d1881ae8fa
27 changed files with 153 additions and 60 deletions

62
src/dts/svgld.d.ts vendored
View file

@ -9,7 +9,8 @@ declare namespace SVGLD {
export enum AddMethod {
Append = 0,
Insert = 1,
Replace = 2
Replace = 2,
ReplaceParent = 3
}
export enum MessageType {
@ -19,6 +20,18 @@ export enum MessageType {
Error = 3
}
export enum Orientation {
Horizontal = 0,
Vertical = 1
}
export enum Position {
Left = 0,
Down = 1,
Up = 2,
Right = 3
}
export enum PositionReference {
TopLeft = 0,
TopCenter = 1,
@ -51,12 +64,6 @@ export enum PropertyType {
Margin = 2
}
export enum XPositionReference {
Left = 0,
Center = 1,
Right = 2
}
export interface IAction {
@ -74,6 +81,7 @@ export interface IAction {
/** Model of available container used in application configuration */
export interface IAvailableContainer {
/** type */
@ -159,18 +167,18 @@ export interface IAvailableContainer {
/** Hide the children in the treeview */
HideChildrenInTreeview?: boolean;
/** if true, show the dimension of the container */
ShowSelfDimensions?: boolean;
ShowSelfDimensions?: Position[];
/** if true show the overall dimensions of its children */
ShowChildrenDimensions?: boolean;
ShowChildrenDimensions?: Position[];
/**
* if true, allows a parent dimension borrower to uses its x coordinate for as a reference point for a dimension
*/
MarkPositionToDimensionBorrower?: boolean;
MarkPosition?: Orientation[];
/**
* if true, show a dimension from the edge of the container to end
* and insert dimensions marks at lift up children (see liftDimensionToBorrower)
* and insert dimensions marks at lift up children (see MarkPosition)
*/
IsDimensionBorrower?: boolean;
ShowDimensionWithMarks?: Position[];
/**
* if true, hide the entry in the sidebar (default: false)
*/
@ -210,7 +218,7 @@ export interface IAvailableSymbol {
Image: IImage;
Width?: number;
Height?: number;
XPositionReference?: PositionReference;
PositionReference?: PositionReference;
}
export interface ICategory {
@ -233,7 +241,7 @@ export interface IConfiguration {
export interface IContainerModel {
children: IContainerModel[];
children: string[];
parent: IContainerModel | null;
properties: IContainerProperties;
userData: Record<string, string | number>;
@ -243,17 +251,18 @@ export interface IContainerModel {
* Do not add methods since they will be lost during serialization
*/
export class ContainerModel implements IContainerModel {
children: IContainerModel[];
children: string[];
parent: IContainerModel | null;
properties: IContainerProperties;
userData: Record<string, string | number>;
constructor(parent: IContainerModel | null, properties: IContainerProperties, children?: IContainerModel[], userData?: {});
constructor(parent: IContainerModel | null, properties: IContainerProperties, children?: string[], userData?: {});
}
/**
* Properties of a container
*/
@ -305,19 +314,19 @@ export interface IContainerProperties {
/** Hide the children in the treeview */
hideChildrenInTreeview: boolean;
/** if true, show the dimension of the container */
showSelfDimensions: boolean;
showSelfDimensions: Position[];
/** if true show the overall dimensions of its children */
showChildrenDimensions: boolean;
showChildrenDimensions: Position[];
/**
* if true, allows a parent dimension borrower to borrow its x coordinate
* as a reference point for a dimension
*/
markPositionToDimensionBorrower: boolean;
markPosition: Orientation[];
/**
* if true, show a dimension from the edge of the container to end
* and insert dimensions marks at lift up children (see liftDimensionToBorrower)
*/
isDimensionBorrower: boolean;
showDimensionWithMarks: Position[];
/**
* Warnings of a container
*/
@ -374,7 +383,8 @@ export interface IHistoryState {
/** Last editor action */
lastAction: string;
/** Reference to the main container */
mainContainer: IContainerModel;
mainContainer: string;
containers: Map<string, IContainerModel>;
/** Id of the selected container */
selectedContainerId: string;
/** Counter of type of container. Used for ids. */
@ -455,9 +465,10 @@ export interface IPoint {
export interface ISetContainerListRequest {
/** Name of the action declared in the API */
Action: string;
Action: IAction;
/** Selected container */
Container: IContainerModel;
/** The previous sibling container */
@ -469,8 +480,10 @@ export interface ISetContainerListRequest {
}
export interface ISetContainerListResponse {
Containers: IAvailableContainer[];
AddingBehavior?: AddMethod;
}
/**
@ -501,9 +514,4 @@ export interface ISymbolModel {
linkedContainers: Set<string>;
}
export enum Orientation {
Horizontal = 0,
Vertical = 1
}
}