jomarko commented on issue #1074:
URL:
https://github.com/apache/incubator-kie-issues/issues/1074#issuecomment-2066438024
The issue is related to our `ShapeOptions.tsx` component.
Here, we display `width` form field using Patternfly `TextInput`:
```js
<TextInput
aria-label={"Width"}
data-testid={"kie-tools--dmn-editor--properties-panel-node-shape-width-input"}
type={"number"}
isDisabled={isDimensioningEnabled ? false : true}
value={isDimensioningEnabled ? boundWidth : undefined}
placeholder={isDimensioningEnabled ? "Enter a value..." : undefined}
onChange={onChangeWidth}
style={{ maxWidth: "80px", minWidth: "60px", border: "none",
backgroundColor: "transparent" }}
/>
```
to indicate invalid width, it is enough to add a property
`validated={ValidatedOptions.error}` to the `TextInput` component. So one part
of the ticket should be doable easily.

in pseudocode we would change to:
```js
{!isWidthValid&&
<TextInput
validated={ValidatedOptions.error}
aria-label={"Width"}
data-testid={"kie-tools--dmn-editor--properties-panel-node-shape-width-input"}
type={"number"}
isDisabled={isDimensioningEnabled ? false : true}
value={isDimensioningEnabled ? boundWidth : undefined}
placeholder={isDimensioningEnabled ? "Enter a value..." : undefined}
onChange={onChangeWidth}
style={{ maxWidth: "80px", minWidth: "60px", border: "none",
backgroundColor: "transparent" }}
/>
}
```
the missing part is `isWidthValid` logic. We have minimal size logic already
present in `DefaultSizes.ts`, to be more precise, `MIN_NODE_SIZES`. This is
crucial to be able to implement `isWidthValid`, however it requires knowing
node type.
However, node type is not present in the `ShapeOptions.tsx` component. We
have only `nodeIds` and `dmn store`. I somehow feel node type could be computed
thanks to `node id` and `dmn store`, but as newbie in this codebase, I am not
sure.
Any advice would be more than welcome.
For the `height` all comments are the same as for `width`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]