Skip to content

Commit 810ebd8

Browse files
committed
fix
1 parent d1bcb17 commit 810ebd8

File tree

5 files changed

+23
-10
lines changed

5 files changed

+23
-10
lines changed

src/common/components/mock-components/front-rich-components/input-stepper.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,17 @@ export const getInputStepperShapeSizeRestrictions = (): ShapeSizeRestrictions =>
2222
const shapeType: ShapeType = 'inputStepper';
2323

2424
export const InputStepperShape = forwardRef<any, ShapeProps>((props, ref) => {
25-
const { x, y, width, height, id, onSelected, otherProps, ...shapeProps } =
26-
props;
25+
const {
26+
x,
27+
y,
28+
width,
29+
height,
30+
id,
31+
text,
32+
onSelected,
33+
otherProps,
34+
...shapeProps
35+
} = props;
2736

2837
const restrictedSize = fitSizeToShapeSizeRestrictions(
2938
InputStepperShapeSizeRestrictions,
@@ -33,7 +42,7 @@ export const InputStepperShape = forwardRef<any, ShapeProps>((props, ref) => {
3342

3443
const { width: restrictedWidth, height: restrictedHeight } = restrictedSize;
3544

36-
const handleButtonWidth = (restrictedWidth: number): number => {
45+
const getButtonWidth = (restrictedWidth: number): number => {
3746
const buttonWidth = restrictedWidth * 0.3;
3847
const minButtonWidth = 30;
3948
const maxButtonWidth = 70;
@@ -43,7 +52,7 @@ export const InputStepperShape = forwardRef<any, ShapeProps>((props, ref) => {
4352
return buttonWidth;
4453
};
4554

46-
const buttonWidth = handleButtonWidth(restrictedWidth);
55+
const buttonWidth = getButtonWidth(restrictedWidth);
4756
const buttonHeight = restrictedHeight / 2;
4857

4958
const commonGroupProps = useGroupShapeProps(
@@ -60,7 +69,6 @@ export const InputStepperShape = forwardRef<any, ShapeProps>((props, ref) => {
6069

6170
return (
6271
<Group {...commonGroupProps} {...shapeProps}>
63-
{/* Caja del input */}
6472
<Rect
6573
x={0}
6674
y={0}
@@ -77,7 +85,7 @@ export const InputStepperShape = forwardRef<any, ShapeProps>((props, ref) => {
7785
width={restrictedWidth - buttonWidth - 8}
7886
x={0} // Alinear a la derecha dependiendo de la cantidad de dígitos
7987
y={restrictedHeight / 2 - 6} // Centrar verticalmente
80-
text={'0'}
88+
text={text}
8189
fontFamily={INPUT_SHAPE.DEFAULT_FONT_FAMILY}
8290
fontSize={INPUT_SHAPE.DEFAULT_FONT_SIZE + 2}
8391
fill={textColor}

src/pods/canvas/model/inline-editable.model.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ const shapeTypesWithDefaultText = new Set<ShapeType>([
8484
'loading-indicator',
8585
'gauge',
8686
'fileTree',
87+
'inputStepper',
8788
]);
8889

8990
// Map of ShapeTypes to their default text values
@@ -125,6 +126,7 @@ const defaultTextValueMap: Partial<Record<ShapeType, string>> = {
125126
browser: 'https://example.com',
126127
modalDialog: 'Title here...',
127128
'loading-indicator': 'Loading...',
129+
inputStepper: '0',
128130
};
129131

130132
export const generateDefaultTextValue = (

src/pods/canvas/model/shape-other-props.utils.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,6 @@ export const generateDefaultOtherProps = (
292292
stroke: INPUT_SHAPE.DEFAULT_STROKE_COLOR,
293293
backgroundColor: INPUT_SHAPE.DEFAULT_FILL_BACKGROUND,
294294
textColor: INPUT_SHAPE.DEFAULT_FILL_TEXT,
295-
borderRadius: `${INPUT_SHAPE.DEFAULT_CORNER_RADIUS}`,
296-
disabled: INPUT_SHAPE.DEFAULT_DISABLED,
297295
strokeStyle: [],
298296
};
299297
default:

src/pods/canvas/model/transformer.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export const generateTypeOfTransformer = (shapeType: ShapeType): string[] => {
7171
case 'buttonBar':
7272
case 'slider':
7373
case 'chip':
74+
case 'inputStepper':
7475
return ['middle-left', 'middle-right'];
7576
case 'verticalLine':
7677
case 'verticalScrollBar':

src/pods/canvas/shape-renderer/simple-rich-components/input-stepper.renderer.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,22 @@ export const renderInputStepper = (
1313
<InputStepperShape
1414
id={shape.id}
1515
key={shape.id}
16-
ref={shapeRefs.current[shape.id]}
1716
x={shape.x}
1817
y={shape.y}
19-
name="shape"
2018
width={shape.width}
2119
height={shape.height}
20+
name="shape"
2221
draggable
2322
typeOfTransformer={shape.typeOfTransformer}
2423
onSelected={handleSelected}
24+
ref={shapeRefs.current[shape.id]}
2525
onDragEnd={handleDragEnd(shape.id)}
2626
onTransform={handleTransform}
2727
onTransformEnd={handleTransform}
28+
editType={shape.editType}
29+
isEditable={true}
30+
text={shape.text}
31+
otherProps={shape.otherProps}
2832
/>
2933
);
3034
};

0 commit comments

Comments
 (0)