Unrefactor Properties form to allow more freedom on the input types and form (#32)
All checks were successful
continuous-integration/drone/push Build is passing

- The css style is now in IProperties.Style again.
- Forms are divided in DynamicForm and StaticForm
- Faster because less logic
- Add RadioGroupButton
- Add InputGroup
- Fix Children Dimensions not using x for their origin

Co-authored-by: Eric NGUYEN <enguyen@techform.fr>
Reviewed-on: https://git.siklos-chaneru.duckdns.org/Siklos/svg-layout-designer-react/pulls/32
This commit is contained in:
Siklos 2022-08-16 08:57:54 -04:00
parent 3d7baafc17
commit 5f8e011bc6
19 changed files with 529 additions and 134 deletions

View file

@ -3,6 +3,7 @@ import * as React from 'react';
import { fireEvent, render, screen } from '../../utils/test-utils';
import { ElementsSidebar } from './ElementsSidebar';
import { IContainerModel } from '../../Interfaces/IContainerModel';
import { XPositionReference } from '../../Enums/XPositionReference';
describe.concurrent('Elements sidebar', () => {
it('With a MainContainer', () => {
@ -17,6 +18,7 @@ describe.concurrent('Elements sidebar', () => {
y: 0,
width: 2000,
height: 100,
XPositionReference: XPositionReference.Left,
isRigidBody: false,
isAnchor: false
},
@ -49,7 +51,8 @@ describe.concurrent('Elements sidebar', () => {
width: 2000,
height: 100,
isRigidBody: false,
isAnchor: false
isAnchor: false,
XPositionReference: XPositionReference.Left
},
userData: {}
};
@ -105,6 +108,7 @@ describe.concurrent('Elements sidebar', () => {
y: 0,
width: 2000,
height: 100,
XPositionReference: XPositionReference.Left,
isRigidBody: false,
isAnchor: false
},
@ -123,7 +127,8 @@ describe.concurrent('Elements sidebar', () => {
width: 0,
height: 0,
isRigidBody: false,
isAnchor: false
isAnchor: false,
XPositionReference: XPositionReference.Left
},
userData: {}
}
@ -140,6 +145,7 @@ describe.concurrent('Elements sidebar', () => {
y: 0,
width: 0,
height: 0,
XPositionReference: XPositionReference.Left,
isRigidBody: false,
isAnchor: false
},
@ -178,6 +184,7 @@ describe.concurrent('Elements sidebar', () => {
y: 0,
width: 2000,
height: 100,
XPositionReference: XPositionReference.Left,
isRigidBody: false,
isAnchor: false
},
@ -194,6 +201,7 @@ describe.concurrent('Elements sidebar', () => {
y: 0,
width: 0,
height: 0,
XPositionReference: XPositionReference.Left,
isRigidBody: false,
isAnchor: false
},

View file

@ -1,7 +1,6 @@
import * as React from 'react';
import { FixedSizeList as List } from 'react-window';
import { Properties } from '../Properties/Properties';
import ContainerProperties from '../../Interfaces/IProperties';
import { IContainerModel } from '../../Interfaces/IContainerModel';
import { getDepth, MakeIterator } from '../../utils/itertools';
import { Menu } from '../Menu/Menu';
@ -14,8 +13,8 @@ interface IElementsSidebarProps {
isOpen: boolean
isHistoryOpen: boolean
SelectedContainer: IContainerModel | null
OnPropertyChange: (key: string, value: string | number | boolean) => void
OnPropertiesSubmit: (event: React.FormEvent<HTMLFormElement>, properties: ContainerProperties) => void
OnPropertyChange: (key: string, value: string | number | boolean, isStyle?: boolean) => void
OnPropertiesSubmit: (event: React.FormEvent<HTMLFormElement>) => void
SelectContainer: (container: IContainerModel) => void
DeleteContainer: (containerid: string) => void
AddContainer: (index: number, type: string, parent: string) => void