Implement events for external use + Rename interfaces with a I prefix + add some documentation (#26)
All checks were successful
continuous-integration/drone/push Build is passing

Implement events for external use
Rename interfaces with a I prefix
Add some documentation

Co-authored-by: Eric NGUYEN <enguyen@techform.fr>
Reviewed-on: https://git.siklos-chaneru.duckdns.org/Siklos/svg-layout-designer-react/pulls/26
This commit is contained in:
Siklos 2022-08-12 06:36:14 -04:00
parent 6c601429b9
commit c81a6fe44b
38 changed files with 228 additions and 116 deletions

View file

@ -1,9 +0,0 @@
import { AvailableContainer } from './AvailableContainer';
import { AvailableSymbolModel } from './AvailableSymbol';
/** Model of configuration for the application to configure it */
export interface Configuration {
AvailableContainers: AvailableContainer[]
AvailableSymbols: AvailableSymbolModel[]
MainContainer: AvailableContainer
}

View file

@ -2,7 +2,7 @@ import React from 'react';
import { XPositionReference } from '../Enums/XPositionReference';
/** Model of available container used in application configuration */
export interface AvailableContainer {
export interface IAvailableContainer {
Type: string
Width: number
Height: number

View file

@ -1,12 +1,12 @@
import { XPositionReference } from '../Enums/XPositionReference';
import { Image } from './Image';
import { IImage } from './IImage';
/**
* Model of available symbol to configure the application */
export interface AvailableSymbolModel {
export interface IAvailableSymbol {
Name: string
XPositionReference: XPositionReference
Image: Image
Image: IImage
Width: number
Height: number
}

View file

@ -0,0 +1,9 @@
import { IAvailableContainer } from './IAvailableContainer';
import { IAvailableSymbol } from './IAvailableSymbol';
/** Model of configuration for the application to configure it */
export interface IConfiguration {
AvailableContainers: IAvailableContainer[]
AvailableSymbols: IAvailableSymbol[]
MainContainer: IAvailableContainer
}

View file

@ -1,21 +1,21 @@
import Properties from './Properties';
import IProperties from './IProperties';
export interface IContainerModel {
children: IContainerModel[]
parent: IContainerModel | null
properties: Properties
properties: IProperties
userData: Record<string, string | number>
}
export class ContainerModel implements IContainerModel {
public children: IContainerModel[];
public parent: IContainerModel | null;
public properties: Properties;
public properties: IProperties;
public userData: Record<string, string | number>;
constructor(
parent: IContainerModel | null,
properties: Properties,
properties: IProperties,
children: IContainerModel[] = [],
userData = {}) {
this.parent = parent;

View file

@ -0,0 +1,8 @@
import { IConfiguration } from './IConfiguration';
import { IHistoryState } from './IHistoryState';
export interface IEditorState {
history: IHistoryState[]
historyCurrentStep: number
configuration: IConfiguration
}

View file

@ -1,6 +1,6 @@
import { IContainerModel } from './ContainerModel';
import { IContainerModel } from './IContainerModel';
export interface HistoryState {
export interface IHistoryState {
LastAction: string
MainContainer: IContainerModel
SelectedContainer: IContainerModel | null

View file

@ -1,5 +1,5 @@
/** Model of an image with multiple source */
export interface Image {
export interface IImage {
Name: string
Url: string
Base64Image: string

View file

@ -1,4 +1,4 @@
export interface Point {
export interface IPoint {
x: number
y: number
}

View file

@ -1,7 +1,7 @@
import * as React from 'react';
import { XPositionReference } from '../Enums/XPositionReference';
export default interface Properties extends React.CSSProperties {
export default interface IProperties extends React.CSSProperties {
id: string
parentId: string | null
x: number

View file

@ -3,7 +3,7 @@
* x being the address where the pointer is pointing
* width being the overall (un)allocated space affected to the address
*/
export interface SizePointer {
export interface ISizePointer {
x: number
width: number
}