From d824227fe5ce6c0decf2e01b0e349ba97c2f2131 Mon Sep 17 00:00:00 2001 From: manugallegob Date: Wed, 7 Aug 2024 18:27:19 +0200 Subject: [PATCH] make combobox editable inline --- src/common/components/front-components/combobox-shape.tsx | 4 ++-- src/pods/canvas/canvas.model.ts | 3 +++ .../shape-renderer/simple-component/combobox.renderer.tsx | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/common/components/front-components/combobox-shape.tsx b/src/common/components/front-components/combobox-shape.tsx index e567724d..3b39ac10 100644 --- a/src/common/components/front-components/combobox-shape.tsx +++ b/src/common/components/front-components/combobox-shape.tsx @@ -17,7 +17,7 @@ export const getComboBoxShapeSizeRestrictions = (): ShapeSizeRestrictions => comboBoxShapeRestrictions; export const ComboBoxShape = forwardRef( - ({ x, y, width, height, id, onSelected, ...shapeProps }, ref) => { + ({ x, y, width, height, id, onSelected, text, ...shapeProps }, ref) => { const { width: restrictedWidth, height: restrictedHeight } = fitSizeToShapeSizeRestrictions(comboBoxShapeRestrictions, width, height); @@ -53,7 +53,7 @@ export const ComboBoxShape = forwardRef( { switch (shapeType) { case 'input': case 'label': + case 'combobox': return true; default: return false; @@ -103,6 +104,8 @@ const generateDefaultTextValue = (shapeType: ShapeType): string | undefined => { return ''; case 'label': return 'Label'; + case 'combobox': + return 'Select an option'; default: return undefined; } diff --git a/src/pods/canvas/shape-renderer/simple-component/combobox.renderer.tsx b/src/pods/canvas/shape-renderer/simple-component/combobox.renderer.tsx index 64610a25..87f9e807 100644 --- a/src/pods/canvas/shape-renderer/simple-component/combobox.renderer.tsx +++ b/src/pods/canvas/shape-renderer/simple-component/combobox.renderer.tsx @@ -23,6 +23,8 @@ export const renderComboBox = ( onDragEnd={handleDragEnd(shape.id)} onTransform={handleTransform} onTransformEnd={handleTransform} + isEditable={shape.allowsInlineEdition} + text={shape.text} /> ); };