Merge branch 'main' into next

This commit is contained in:
katherinehhh 2024-08-20 17:45:17 +08:00
commit 4cb9d6b037
2 changed files with 16 additions and 6 deletions

View File

@ -8,6 +8,7 @@
*/
import { Input, Select } from 'antd';
import { css } from '@emotion/css';
import React, { useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useFormBlockContext } from '../../block-provider/FormBlockProvider';
@ -47,7 +48,7 @@ export const ValueDynamicComponent = (props: ValueDynamicComponentProps) => {
blockCollectionName: collectionName,
});
const constantStyle = useMemo(() => {
return { minWidth: 150, maxWidth: 430, marginLeft: 5 };
return { minWidth: 150, maxWidth: 430 };
}, []);
const handleChangeOfConstant = useCallback(
(value) => {
@ -73,7 +74,7 @@ export const ValueDynamicComponent = (props: ValueDynamicComponentProps) => {
[collectionName, mode, setValue],
);
const textAreaStyle = useMemo(() => {
return { minWidth: 460 };
return { minWidth: 460, borderRadius: 0 };
}, []);
const compatScope = useMemo(() => {
return compatOldVariables(scope, {
@ -83,7 +84,16 @@ export const ValueDynamicComponent = (props: ValueDynamicComponentProps) => {
const modeMap = {
// 常量
constant: (
<div role="button" aria-label="dynamic-component-linkage-rules" style={constantStyle}>
<div
role="button"
aria-label="dynamic-component-linkage-rules"
style={constantStyle}
className={css`
.ant-input-affix-wrapper {
border-radius: 0px;
}
`}
>
{React.createElement(DynamicComponent, {
value: fieldValue?.value,
schema,
@ -140,7 +150,7 @@ export const ValueDynamicComponent = (props: ValueDynamicComponentProps) => {
onChange={(value) => {
setMode(value);
setValue({
mode: value,
mode: fieldValue?.mode,
});
}}
>
@ -150,7 +160,7 @@ export const ValueDynamicComponent = (props: ValueDynamicComponentProps) => {
</Option>
))}
</Select>
{modeMap[mode]}
{modeMap[fieldValue?.mode || mode]}
</Input.Group>
);
};

View File

@ -27,7 +27,7 @@ const LinkageRulesTitle = (props) => {
const value = array?.field?.value[index];
return (
<Input.TextArea
value={value.title}
value={value.title || t('Linkage rule')}
defaultValue={t('Linkage rule')}
onChange={(ev) => {
ev.stopPropagation();