From df552619dd8d4ec5c3703494377354e3969d0b27 Mon Sep 17 00:00:00 2001 From: Dunqing Date: Mon, 16 Oct 2023 18:59:48 -0500 Subject: [PATCH] feat(custom-request): improve x button of variable (#2829) * fix: revert the modal style * feat: improve x button of variable --- .../schema-component/antd/variable/Input.tsx | 11 ++++++++++- .../antd/variable/JSONInput.tsx | 18 +++++++++++++++++- .../antd/variable/RawTextArea.tsx | 12 ++++++++++++ .../antd/variable/TextArea.tsx | 15 ++++++++++++++- .../antd/variable/VariableSelect.tsx | 9 +++++---- .../schema-component/antd/variable/XButton.tsx | 4 +++- .../src/schema-settings/SchemaSettings.tsx | 4 ---- 7 files changed, 61 insertions(+), 12 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/variable/Input.tsx b/packages/core/client/src/schema-component/antd/variable/Input.tsx index 176e35a4f..055183041 100644 --- a/packages/core/client/src/schema-component/antd/variable/Input.tsx +++ b/packages/core/client/src/schema-component/antd/variable/Input.tsx @@ -333,7 +333,16 @@ export function Input(props) { changeOnSelect={changeOnSelect} fieldNames={fieldNames} > - {button ?? } + {button ?? ( + + )} ) : null} , diff --git a/packages/core/client/src/schema-component/antd/variable/JSONInput.tsx b/packages/core/client/src/schema-component/antd/variable/JSONInput.tsx index 376c74c4d..940ec089a 100644 --- a/packages/core/client/src/schema-component/antd/variable/JSONInput.tsx +++ b/packages/core/client/src/schema-component/antd/variable/JSONInput.tsx @@ -2,7 +2,23 @@ import React from 'react'; import { Input } from '../input'; import { RawTextArea } from './RawTextArea'; +import { css } from '@emotion/css'; export function JSONInput(props) { - return ; + return ( +
+ + ; +
+ ); } diff --git a/packages/core/client/src/schema-component/antd/variable/RawTextArea.tsx b/packages/core/client/src/schema-component/antd/variable/RawTextArea.tsx index 6af0771b6..de9fd6b1e 100644 --- a/packages/core/client/src/schema-component/antd/variable/RawTextArea.tsx +++ b/packages/core/client/src/schema-component/antd/variable/RawTextArea.tsx @@ -17,6 +17,7 @@ function setNativeInputValue(input, value) { } export function RawTextArea(props): JSX.Element { + console.log('🚀 ~ file: RawTextArea.tsx:20 ~ RawTextArea ~ props:', props); const inputRef = useRef(null); const { changeOnSelect, component: Component = Input.TextArea, ...others } = props; const scope = typeof props.scope === 'function' ? props.scope() : props.scope; @@ -58,6 +59,17 @@ export function RawTextArea(props): JSX.Element { `} > {!disabled ? ( - + ) : null} , ); diff --git a/packages/core/client/src/schema-component/antd/variable/VariableSelect.tsx b/packages/core/client/src/schema-component/antd/variable/VariableSelect.tsx index 536337942..f9652261a 100644 --- a/packages/core/client/src/schema-component/antd/variable/VariableSelect.tsx +++ b/packages/core/client/src/schema-component/antd/variable/VariableSelect.tsx @@ -1,9 +1,10 @@ import { cx } from '@emotion/css'; -import { Button, Cascader } from 'antd'; +import { Cascader } from 'antd'; import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useToken } from '../__builtins__'; import useStyles from './VariableSelect.style'; +import { XButton } from './XButton'; export function VariableSelect({ options, @@ -11,6 +12,7 @@ export function VariableSelect({ onInsert, changeOnSelect = false, fieldNames = {}, + className, }): JSX.Element { const { t } = useTranslation(); const [selectedVar, setSelectedVar] = useState([]); @@ -26,8 +28,7 @@ export function VariableSelect({ } return wrapSSR( - , +
, ); } diff --git a/packages/core/client/src/schema-component/antd/variable/XButton.tsx b/packages/core/client/src/schema-component/antd/variable/XButton.tsx index 186ba76a7..294a2c1ed 100644 --- a/packages/core/client/src/schema-component/antd/variable/XButton.tsx +++ b/packages/core/client/src/schema-component/antd/variable/XButton.tsx @@ -1,4 +1,6 @@ +import { css } from '@emotion/css'; import { Button, ButtonProps } from 'antd'; +import { cx } from 'antd-style'; import React, { forwardRef, useMemo } from 'react'; export const XButton = forwardRef((props: ButtonProps, ref: any) => { @@ -11,7 +13,7 @@ export const XButton = forwardRef((props: ButtonProps, ref: any) => { return ( ); }); diff --git a/packages/core/client/src/schema-settings/SchemaSettings.tsx b/packages/core/client/src/schema-settings/SchemaSettings.tsx index 3bc328b6d..c8637b7b3 100644 --- a/packages/core/client/src/schema-settings/SchemaSettings.tsx +++ b/packages/core/client/src/schema-settings/SchemaSettings.tsx @@ -895,10 +895,6 @@ SchemaSettings.ActionModalItem = React.memo((props: any) => {