mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 07:06:06 +00:00
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: {
|
||||
resource: collectionField?.target,
|
||||
},
|
||||
// for DynamicExpression
|
||||
sourceCollection: form?.values.sourceCollection,
|
||||
style: {
|
||||
width: '100%',
|
||||
verticalAlign: 'top',
|
||||
|
@ -1132,7 +1132,7 @@ SchemaSettings.EnableChildCollections = function EnableChildCollections(props) {
|
||||
// 是否显示默认值配置项
|
||||
export const isShowDefaultValue = (collectionField: CollectionFieldOptions, getInterface) => {
|
||||
return (
|
||||
!['o2o', 'oho', 'obo', 'o2m', 'attachment'].includes(collectionField?.interface) &&
|
||||
!['o2o', 'oho', 'obo', 'o2m', 'attachment', 'expression'].includes(collectionField?.interface) &&
|
||||
!isSystemField(collectionField, getInterface)
|
||||
);
|
||||
};
|
||||
|
@ -10,7 +10,7 @@ import { NAMESPACE } from '../locale';
|
||||
import { useCollectionFieldOptions } from '../variable';
|
||||
|
||||
const InternalExpression = observer((props: any) => {
|
||||
const { onChange, sourceCollection } = props;
|
||||
const { onChange } = props;
|
||||
const { values } = useForm();
|
||||
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} />;
|
||||
});
|
||||
|
||||
function Result(props) {
|
||||
const { sourceCollection } = props;
|
||||
const { t } = useTranslation();
|
||||
const values = useRecord();
|
||||
const options = useMemo(
|
||||
() => useCollectionFieldOptions({ collection: sourceCollection || values.sourceCollection }),
|
||||
[values.sourceCollection, values.sourceCollection, sourceCollection],
|
||||
() => useCollectionFieldOptions({ collection: values.sourceCollection }),
|
||||
[values.sourceCollection, values.sourceCollection],
|
||||
);
|
||||
return props.value ? (
|
||||
<Variable.TextArea {...props} scope={options} />
|
||||
|
Loading…
Reference in New Issue
Block a user