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 { Input, Select } from 'antd';
import { css } from '@emotion/css';
import React, { useCallback, useMemo, useState } from 'react'; import React, { useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useFormBlockContext } from '../../block-provider/FormBlockProvider'; import { useFormBlockContext } from '../../block-provider/FormBlockProvider';
@ -47,7 +48,7 @@ export const ValueDynamicComponent = (props: ValueDynamicComponentProps) => {
blockCollectionName: collectionName, blockCollectionName: collectionName,
}); });
const constantStyle = useMemo(() => { const constantStyle = useMemo(() => {
return { minWidth: 150, maxWidth: 430, marginLeft: 5 }; return { minWidth: 150, maxWidth: 430 };
}, []); }, []);
const handleChangeOfConstant = useCallback( const handleChangeOfConstant = useCallback(
(value) => { (value) => {
@ -73,7 +74,7 @@ export const ValueDynamicComponent = (props: ValueDynamicComponentProps) => {
[collectionName, mode, setValue], [collectionName, mode, setValue],
); );
const textAreaStyle = useMemo(() => { const textAreaStyle = useMemo(() => {
return { minWidth: 460 }; return { minWidth: 460, borderRadius: 0 };
}, []); }, []);
const compatScope = useMemo(() => { const compatScope = useMemo(() => {
return compatOldVariables(scope, { return compatOldVariables(scope, {
@ -83,7 +84,16 @@ export const ValueDynamicComponent = (props: ValueDynamicComponentProps) => {
const modeMap = { const modeMap = {
// 常量 // 常量
constant: ( 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, { {React.createElement(DynamicComponent, {
value: fieldValue?.value, value: fieldValue?.value,
schema, schema,
@ -140,7 +150,7 @@ export const ValueDynamicComponent = (props: ValueDynamicComponentProps) => {
onChange={(value) => { onChange={(value) => {
setMode(value); setMode(value);
setValue({ setValue({
mode: value, mode: fieldValue?.mode,
}); });
}} }}
> >
@ -150,7 +160,7 @@ export const ValueDynamicComponent = (props: ValueDynamicComponentProps) => {
</Option> </Option>
))} ))}
</Select> </Select>
{modeMap[mode]} {modeMap[fieldValue?.mode || mode]}
</Input.Group> </Input.Group>
); );
}; };

View File

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