fix: hide default value for expression (#1765)
This commit is contained in:
parent
07d1c7ccc0
commit
e45b3ce95c
@ -440,8 +440,6 @@ FormItem.Designer = function Designer() {
|
|||||||
service: {
|
service: {
|
||||||
resource: collectionField?.target,
|
resource: collectionField?.target,
|
||||||
},
|
},
|
||||||
// for DynamicExpression
|
|
||||||
sourceCollection: form?.values.sourceCollection,
|
|
||||||
style: {
|
style: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
verticalAlign: 'top',
|
verticalAlign: 'top',
|
||||||
|
@ -1132,7 +1132,7 @@ SchemaSettings.EnableChildCollections = function EnableChildCollections(props) {
|
|||||||
// 是否显示默认值配置项
|
// 是否显示默认值配置项
|
||||||
export const isShowDefaultValue = (collectionField: CollectionFieldOptions, getInterface) => {
|
export const isShowDefaultValue = (collectionField: CollectionFieldOptions, getInterface) => {
|
||||||
return (
|
return (
|
||||||
!['o2o', 'oho', 'obo', 'o2m', 'attachment'].includes(collectionField?.interface) &&
|
!['o2o', 'oho', 'obo', 'o2m', 'attachment', 'expression'].includes(collectionField?.interface) &&
|
||||||
!isSystemField(collectionField, getInterface)
|
!isSystemField(collectionField, getInterface)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -10,7 +10,7 @@ import { NAMESPACE } from '../locale';
|
|||||||
import { useCollectionFieldOptions } from '../variable';
|
import { useCollectionFieldOptions } from '../variable';
|
||||||
|
|
||||||
const InternalExpression = observer((props: any) => {
|
const InternalExpression = observer((props: any) => {
|
||||||
const { onChange, sourceCollection } = props;
|
const { onChange } = props;
|
||||||
const { values } = useForm();
|
const { values } = useForm();
|
||||||
const [collection, setCollection] = useState(values?.sourceCollection);
|
const [collection, setCollection] = useState(values?.sourceCollection);
|
||||||
|
|
||||||
@ -24,18 +24,17 @@ const InternalExpression = observer((props: any) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const options = useCollectionFieldOptions({ collection: sourceCollection || collection });
|
const options = useCollectionFieldOptions({ collection: collection });
|
||||||
|
|
||||||
return <Variable.TextArea {...props} scope={options} />;
|
return <Variable.TextArea {...props} scope={options} />;
|
||||||
});
|
});
|
||||||
|
|
||||||
function Result(props) {
|
function Result(props) {
|
||||||
const { sourceCollection } = props;
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const values = useRecord();
|
const values = useRecord();
|
||||||
const options = useMemo(
|
const options = useMemo(
|
||||||
() => useCollectionFieldOptions({ collection: sourceCollection || values.sourceCollection }),
|
() => useCollectionFieldOptions({ collection: values.sourceCollection }),
|
||||||
[values.sourceCollection, values.sourceCollection, sourceCollection],
|
[values.sourceCollection, values.sourceCollection],
|
||||||
);
|
);
|
||||||
return props.value ? (
|
return props.value ? (
|
||||||
<Variable.TextArea {...props} scope={options} />
|
<Variable.TextArea {...props} scope={options} />
|
||||||
|
Loading…
Reference in New Issue
Block a user