Fix missing key for cssinput
This commit is contained in:
parent
7494383f58
commit
b62aee978b
2 changed files with 14 additions and 13 deletions
|
@ -23,6 +23,7 @@ function GetCSSInputs(properties: IContainerProperties,
|
||||||
for (const key in properties.style) {
|
for (const key in properties.style) {
|
||||||
groupInput.push(<TextInputGroup
|
groupInput.push(<TextInputGroup
|
||||||
key={key}
|
key={key}
|
||||||
|
id={key}
|
||||||
labelText={key}
|
labelText={key}
|
||||||
inputKey={key}
|
inputKey={key}
|
||||||
labelClassName=''
|
labelClassName=''
|
||||||
|
@ -62,7 +63,7 @@ export function ContainerForm(props: IContainerFormProps): JSX.Element {
|
||||||
value={props.properties.type}
|
value={props.properties.type}
|
||||||
isDisabled={true} />
|
isDisabled={true} />
|
||||||
<TextInputGroup
|
<TextInputGroup
|
||||||
key={`${props.properties.id}-displayedText`}
|
id={`${props.properties.id}-displayedText`}
|
||||||
labelText='Displayed text'
|
labelText='Displayed text'
|
||||||
inputKey='displayedText'
|
inputKey='displayedText'
|
||||||
labelClassName=''
|
labelClassName=''
|
||||||
|
@ -71,7 +72,7 @@ export function ContainerForm(props: IContainerFormProps): JSX.Element {
|
||||||
value={props.properties.displayedText?.toString()}
|
value={props.properties.displayedText?.toString()}
|
||||||
onChange={(value) => props.onChange('displayedText', value)} />
|
onChange={(value) => props.onChange('displayedText', value)} />
|
||||||
<TextInputGroup
|
<TextInputGroup
|
||||||
key={`${props.properties.id}-x`}
|
id={`${props.properties.id}-x`}
|
||||||
labelText='x'
|
labelText='x'
|
||||||
inputKey='x'
|
inputKey='x'
|
||||||
labelClassName=''
|
labelClassName=''
|
||||||
|
@ -91,7 +92,7 @@ export function ContainerForm(props: IContainerFormProps): JSX.Element {
|
||||||
)
|
)
|
||||||
)} />
|
)} />
|
||||||
<TextInputGroup
|
<TextInputGroup
|
||||||
key={`${props.properties.id}-y`}
|
id={`${props.properties.id}-y`}
|
||||||
labelText='y'
|
labelText='y'
|
||||||
inputKey='y'
|
inputKey='y'
|
||||||
labelClassName=''
|
labelClassName=''
|
||||||
|
@ -100,7 +101,7 @@ export function ContainerForm(props: IContainerFormProps): JSX.Element {
|
||||||
value={(props.properties.y - (props.properties.margin?.top ?? 0)).toString()}
|
value={(props.properties.y - (props.properties.margin?.top ?? 0)).toString()}
|
||||||
onChange={(value) => props.onChange('y', Number(value) + (props.properties.margin?.top ?? 0))} />
|
onChange={(value) => props.onChange('y', Number(value) + (props.properties.margin?.top ?? 0))} />
|
||||||
<TextInputGroup
|
<TextInputGroup
|
||||||
key={`${props.properties.id}-minWidth`}
|
id={`${props.properties.id}-minWidth`}
|
||||||
labelText='Minimum width'
|
labelText='Minimum width'
|
||||||
inputKey='minWidth'
|
inputKey='minWidth'
|
||||||
labelClassName=''
|
labelClassName=''
|
||||||
|
@ -110,7 +111,7 @@ export function ContainerForm(props: IContainerFormProps): JSX.Element {
|
||||||
value={props.properties.minWidth.toString()}
|
value={props.properties.minWidth.toString()}
|
||||||
onChange={(value) => props.onChange('minWidth', Number(value))} />
|
onChange={(value) => props.onChange('minWidth', Number(value))} />
|
||||||
<TextInputGroup
|
<TextInputGroup
|
||||||
key={`${props.properties.id}-maxWidth`}
|
id={`${props.properties.id}-maxWidth`}
|
||||||
labelText='Maximum width'
|
labelText='Maximum width'
|
||||||
inputKey='maxWidth'
|
inputKey='maxWidth'
|
||||||
labelClassName=''
|
labelClassName=''
|
||||||
|
@ -120,7 +121,7 @@ export function ContainerForm(props: IContainerFormProps): JSX.Element {
|
||||||
value={props.properties.maxWidth.toString()}
|
value={props.properties.maxWidth.toString()}
|
||||||
onChange={(value) => props.onChange('maxWidth', Number(value))} />
|
onChange={(value) => props.onChange('maxWidth', Number(value))} />
|
||||||
<TextInputGroup
|
<TextInputGroup
|
||||||
key={`${props.properties.id}-width`}
|
id={`${props.properties.id}-width`}
|
||||||
labelText='Width'
|
labelText='Width'
|
||||||
inputKey='width'
|
inputKey='width'
|
||||||
labelClassName=''
|
labelClassName=''
|
||||||
|
@ -132,7 +133,7 @@ export function ContainerForm(props: IContainerFormProps): JSX.Element {
|
||||||
onChange={(value) => props.onChange('width', ApplyWidthMargin(Number(value), props.properties.margin.left, props.properties.margin.right))}
|
onChange={(value) => props.onChange('width', ApplyWidthMargin(Number(value), props.properties.margin.left, props.properties.margin.right))}
|
||||||
isDisabled={props.properties.isFlex} />
|
isDisabled={props.properties.isFlex} />
|
||||||
<TextInputGroup
|
<TextInputGroup
|
||||||
key={`${props.properties.id}-height`}
|
id={`${props.properties.id}-height`}
|
||||||
labelText='Height'
|
labelText='Height'
|
||||||
inputKey='height'
|
inputKey='height'
|
||||||
labelClassName=''
|
labelClassName=''
|
||||||
|
@ -142,7 +143,7 @@ export function ContainerForm(props: IContainerFormProps): JSX.Element {
|
||||||
value={(props.properties.height + (props.properties.margin?.top ?? 0) + (props.properties.margin?.bottom ?? 0)).toString()}
|
value={(props.properties.height + (props.properties.margin?.top ?? 0) + (props.properties.margin?.bottom ?? 0)).toString()}
|
||||||
onChange={(value) => props.onChange('height', Number(value) - (props.properties.margin?.top ?? 0) - (props.properties.margin?.bottom ?? 0))} />
|
onChange={(value) => props.onChange('height', Number(value) - (props.properties.margin?.top ?? 0) - (props.properties.margin?.bottom ?? 0))} />
|
||||||
<TextInputGroup
|
<TextInputGroup
|
||||||
key={`${props.properties.id}-ml`}
|
id={`${props.properties.id}-ml`}
|
||||||
labelText='Margin left'
|
labelText='Margin left'
|
||||||
inputKey='left'
|
inputKey='left'
|
||||||
labelClassName=''
|
labelClassName=''
|
||||||
|
@ -152,7 +153,7 @@ export function ContainerForm(props: IContainerFormProps): JSX.Element {
|
||||||
value={(props.properties.margin.left ?? 0).toString()}
|
value={(props.properties.margin.left ?? 0).toString()}
|
||||||
onChange={(value) => props.onChange('left', Number(value), PropertyType.Margin)} />
|
onChange={(value) => props.onChange('left', Number(value), PropertyType.Margin)} />
|
||||||
<TextInputGroup
|
<TextInputGroup
|
||||||
key={`${props.properties.id}-mb`}
|
id={`${props.properties.id}-mb`}
|
||||||
labelText='Margin bottom'
|
labelText='Margin bottom'
|
||||||
inputKey='bottom'
|
inputKey='bottom'
|
||||||
labelClassName=''
|
labelClassName=''
|
||||||
|
@ -162,7 +163,7 @@ export function ContainerForm(props: IContainerFormProps): JSX.Element {
|
||||||
value={(props.properties.margin.bottom ?? 0).toString()}
|
value={(props.properties.margin.bottom ?? 0).toString()}
|
||||||
onChange={(value) => props.onChange('bottom', Number(value), PropertyType.Margin)} />
|
onChange={(value) => props.onChange('bottom', Number(value), PropertyType.Margin)} />
|
||||||
<TextInputGroup
|
<TextInputGroup
|
||||||
key={`${props.properties.id}-mt`}
|
id={`${props.properties.id}-mt`}
|
||||||
labelText='Margin top'
|
labelText='Margin top'
|
||||||
inputKey='top'
|
inputKey='top'
|
||||||
labelClassName=''
|
labelClassName=''
|
||||||
|
@ -172,7 +173,7 @@ export function ContainerForm(props: IContainerFormProps): JSX.Element {
|
||||||
value={(props.properties.margin.top ?? 0).toString()}
|
value={(props.properties.margin.top ?? 0).toString()}
|
||||||
onChange={(value) => props.onChange('top', Number(value), PropertyType.Margin)} />
|
onChange={(value) => props.onChange('top', Number(value), PropertyType.Margin)} />
|
||||||
<TextInputGroup
|
<TextInputGroup
|
||||||
key={`${props.properties.id}-mr`}
|
id={`${props.properties.id}-mr`}
|
||||||
labelText='Margin right'
|
labelText='Margin right'
|
||||||
inputKey='right'
|
inputKey='right'
|
||||||
labelClassName=''
|
labelClassName=''
|
||||||
|
|
|
@ -2,7 +2,7 @@ import * as React from 'react';
|
||||||
|
|
||||||
interface ITextInputGroupProps {
|
interface ITextInputGroupProps {
|
||||||
/** Use key the same way as React.Key */
|
/** Use key the same way as React.Key */
|
||||||
key: string
|
id: string
|
||||||
labelKey?: string
|
labelKey?: string
|
||||||
labelText: string
|
labelText: string
|
||||||
inputKey: string
|
inputKey: string
|
||||||
|
@ -24,7 +24,7 @@ export function TextInputGroup(props: ITextInputGroupProps): JSX.Element {
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
setValue(props.value);
|
setValue(props.value);
|
||||||
}, [props.value, props.key]);
|
}, [props.value, props.id]);
|
||||||
|
|
||||||
function OnKeyUp(event: React.KeyboardEvent): void {
|
function OnKeyUp(event: React.KeyboardEvent): void {
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue