mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
fix: association collection field should not support sortable (#4288)
* fix: association collection field should not support sortable * fix: association collection field should not support sortable
This commit is contained in:
parent
7fc8af7e7b
commit
c9c14df4f0
@ -19,6 +19,7 @@ import { useColumnSchema } from '../../../../schema-component/antd/table-v2/Tabl
|
|||||||
import { SchemaSettingsDefaultValue } from '../../../../schema-settings/SchemaSettingsDefaultValue';
|
import { SchemaSettingsDefaultValue } from '../../../../schema-settings/SchemaSettingsDefaultValue';
|
||||||
import { useFieldComponentName } from './utils';
|
import { useFieldComponentName } from './utils';
|
||||||
import { isPatternDisabled } from '../../../../schema-settings/isPatternDisabled';
|
import { isPatternDisabled } from '../../../../schema-settings/isPatternDisabled';
|
||||||
|
import { useCollection } from '../../../../data-source';
|
||||||
|
|
||||||
export const tableColumnSettings = new SchemaSettings({
|
export const tableColumnSettings = new SchemaSettings({
|
||||||
name: 'fieldSettings:TableColumn',
|
name: 'fieldSettings:TableColumn',
|
||||||
@ -122,12 +123,15 @@ export const tableColumnSettings = new SchemaSettings({
|
|||||||
name: 'sortable',
|
name: 'sortable',
|
||||||
type: 'switch',
|
type: 'switch',
|
||||||
useVisible() {
|
useVisible() {
|
||||||
|
const collection = useCollection();
|
||||||
const { collectionField } = useColumnSchema();
|
const { collectionField } = useColumnSchema();
|
||||||
const { getInterface } = useCollectionManager_deprecated();
|
const { getInterface } = useCollectionManager_deprecated();
|
||||||
const interfaceCfg = getInterface(collectionField?.interface);
|
const interfaceCfg = getInterface(collectionField?.interface);
|
||||||
const { currentMode } = useAssociationFieldContext();
|
const { currentMode } = useAssociationFieldContext();
|
||||||
|
|
||||||
return interfaceCfg?.sortable === true && !currentMode;
|
return (
|
||||||
|
interfaceCfg?.sortable === true && !currentMode && collection?.name === collectionField?.collectionName
|
||||||
|
);
|
||||||
},
|
},
|
||||||
useComponentProps() {
|
useComponentProps() {
|
||||||
const field: any = useField();
|
const field: any = useField();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user