From 6e9ca106448a91b237a301abea58f9615eb96a23 Mon Sep 17 00:00:00 2001 From: Junyi Date: Wed, 15 May 2024 18:38:28 +0800 Subject: [PATCH] fix(plugin-workflow-request): fix value fields overflowing (#4354) --- .../antd/variable/TextArea.tsx | 7 +++++ .../src/client/RequestInstruction.tsx | 28 ++++++++++++++++++- .../src/client/nodes/calculation.tsx | 4 +-- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/variable/TextArea.tsx b/packages/core/client/src/schema-component/antd/variable/TextArea.tsx index 92d95c0633..1d910ecc56 100644 --- a/packages/core/client/src/schema-component/antd/variable/TextArea.tsx +++ b/packages/core/client/src/schema-component/antd/variable/TextArea.tsx @@ -389,6 +389,7 @@ export function TextArea(props) { .ant-input { flex-grow: 1; min-width: 200px; + word-break: break-all; } .ant-input-disabled { .ant-tag { @@ -412,6 +413,7 @@ export function TextArea(props) { onPaste={onPaste} onCompositionStart={onCompositionStart} onCompositionEnd={onCompositionEnd} + placeholder={props.placeholder} className={cx( hashId, 'ant-input', @@ -420,6 +422,11 @@ export function TextArea(props) { overflow: auto; white-space: ${multiline ? 'normal' : 'nowrap'}; + &[placeholder]:empty::before { + content: attr(placeholder); + color: #ccc; + } + .ant-tag { display: inline; line-height: 19px; diff --git a/packages/plugins/@nocobase/plugin-workflow-request/src/client/RequestInstruction.tsx b/packages/plugins/@nocobase/plugin-workflow-request/src/client/RequestInstruction.tsx index b6d28a49d6..5747ca2515 100644 --- a/packages/plugins/@nocobase/plugin-workflow-request/src/client/RequestInstruction.tsx +++ b/packages/plugins/@nocobase/plugin-workflow-request/src/client/RequestInstruction.tsx @@ -20,7 +20,7 @@ import { } from '@nocobase/plugin-workflow/client'; import { NAMESPACE } from '../locale'; -import { SchemaComponent } from '@nocobase/client'; +import { SchemaComponent, css } from '@nocobase/client'; const BodySchema = { 'application/json': { @@ -173,6 +173,18 @@ export default class extends Instruction { space: { type: 'void', 'x-component': 'Space', + 'x-component-props': { + style: { + flexWrap: 'nowrap', + maxWidth: '100%', + }, + className: css` + & > .ant-space-item:first-child, + & > .ant-space-item:last-child { + flex-shrink: 0; + } + `, + }, properties: { name: { type: 'string', @@ -188,6 +200,7 @@ export default class extends Instruction { 'x-component': 'WorkflowVariableTextArea', 'x-component-props': { useTypedConstant: true, + placeholder: `{{t("Value")}}`, }, }, remove: { @@ -218,6 +231,18 @@ export default class extends Instruction { space: { type: 'void', 'x-component': 'Space', + 'x-component-props': { + style: { + flexWrap: 'nowrap', + maxWidth: '100%', + }, + className: css` + & > .ant-space-item:first-child, + & > .ant-space-item:last-child { + flex-shrink: 0; + } + `, + }, properties: { name: { type: 'string', @@ -233,6 +258,7 @@ export default class extends Instruction { 'x-component': 'WorkflowVariableTextArea', 'x-component-props': { useTypedConstant: true, + placeholder: `{{t("Value")}}`, }, }, remove: { diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/calculation.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/calculation.tsx index 3e06b505e5..5473e5b966 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/calculation.tsx +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/calculation.tsx @@ -82,8 +82,8 @@ export default class extends Instruction { return null; } return { - [fieldNames.value]: key, - [fieldNames.label]: title, + value: key, + label: title, }; } useInitializers(node): SchemaInitializerItemType {