mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 21:49:25 +08:00
fix: "Select from existing data" still showing when disable “Allow mu… (#6167)
* fix: "Select from existing data" still showing when disable “Allow multiple ” in to-many subform * fix: bug
This commit is contained in:
parent
cd50adcf5e
commit
435dc80a78
@ -2,9 +2,7 @@
|
|||||||
"version": "1.6.0-alpha.22",
|
"version": "1.6.0-alpha.22",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"useWorkspaces": true,
|
"useWorkspaces": true,
|
||||||
"npmClientArgs": [
|
"npmClientArgs": ["--ignore-engines"],
|
||||||
"--ignore-engines"
|
|
||||||
],
|
|
||||||
"command": {
|
"command": {
|
||||||
"version": {
|
"version": {
|
||||||
"forcePublish": true,
|
"forcePublish": true,
|
||||||
|
@ -15,7 +15,7 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings';
|
import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings';
|
||||||
import { useCollectionManager_deprecated, useSortFields } from '../../../../collection-manager';
|
import { useCollectionManager_deprecated, useSortFields } from '../../../../collection-manager';
|
||||||
import { useFieldComponentName } from '../../../../common/useFieldComponentName';
|
import { useFieldComponentName } from '../../../../common/useFieldComponentName';
|
||||||
import { useCollectionManager, useRerenderDataBlock } from '../../../../data-source';
|
import { useCollectionManager, useRerenderDataBlock, useCollectionField } from '../../../../data-source';
|
||||||
import { FlagProvider } from '../../../../flag-provider/FlagProvider';
|
import { FlagProvider } from '../../../../flag-provider/FlagProvider';
|
||||||
import { withDynamicSchemaProps } from '../../../../hoc/withDynamicSchemaProps';
|
import { withDynamicSchemaProps } from '../../../../hoc/withDynamicSchemaProps';
|
||||||
import {
|
import {
|
||||||
@ -76,8 +76,11 @@ export const allowSelectExistingRecord = {
|
|||||||
name: 'allowSelectExistingRecord',
|
name: 'allowSelectExistingRecord',
|
||||||
type: 'switch',
|
type: 'switch',
|
||||||
useVisible() {
|
useVisible() {
|
||||||
|
const fieldSchema = useFieldSchema();
|
||||||
|
const { multiple } = fieldSchema['x-component-props'];
|
||||||
const readPretty = useIsFieldReadPretty();
|
const readPretty = useIsFieldReadPretty();
|
||||||
return !readPretty;
|
const collectionField = useCollectionField();
|
||||||
|
return !readPretty && multiple !== false && ['hasMany', 'belongsToMany'].includes(collectionField?.type);
|
||||||
},
|
},
|
||||||
useComponentProps() {
|
useComponentProps() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
@ -322,7 +322,7 @@ const ToManyNester = observer(
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{field.editable && allowSelectExistingRecord && currentMode === 'Nester' && (
|
{field.editable && allowSelectExistingRecord && currentMode === 'Nester' && allowMultiple && (
|
||||||
<Action.Link
|
<Action.Link
|
||||||
useAction={useNesterSelectProps}
|
useAction={useNesterSelectProps}
|
||||||
title={
|
title={
|
||||||
|
Loading…
x
Reference in New Issue
Block a user