mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 15:55:39 +00:00
chore: attachement field
This commit is contained in:
parent
14e7b1a4b5
commit
796d4d0c2f
@ -1,8 +1,8 @@
|
||||
import { Field } from '@formily/core';
|
||||
import { useField, useFieldSchema } from '@formily/react';
|
||||
import { useCollectionField } from '../data-source/collection-field/CollectionFieldProvider';
|
||||
import { useIsFileField } from '../schema-component/antd/form-item/FormItem.Settings';
|
||||
import { useColumnSchema } from '../schema-component/antd/table-v2/Table.Column.Decorator';
|
||||
import { useCollectionField } from '../data-source/collection-field/CollectionFieldProvider';
|
||||
|
||||
export function useFieldComponentName(): string {
|
||||
const { fieldSchema: tableColumnSchema, collectionField: tableColumnField } = useColumnSchema();
|
||||
|
@ -2,7 +2,7 @@ import { Field } from '@formily/core';
|
||||
import { useField, useFieldSchema } from '@formily/react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings';
|
||||
import { useDesignable } from '../../../../schema-component';
|
||||
import { useColumnSchema, useDesignable } from '../../../../schema-component';
|
||||
import { useIsFieldReadPretty } from '../../../../schema-component/antd/form-item/FormItem.Settings';
|
||||
|
||||
export const uploadAttachmentComponentFieldSettings = new SchemaSettings({
|
||||
@ -12,8 +12,10 @@ export const uploadAttachmentComponentFieldSettings = new SchemaSettings({
|
||||
name: 'size',
|
||||
type: 'select',
|
||||
useVisible() {
|
||||
const { fieldSchema: tableColumnSchema } = useColumnSchema();
|
||||
const readPretty = useIsFieldReadPretty();
|
||||
return readPretty;
|
||||
const isInTable = tableColumnSchema?.parent?.['x-component'] === 'TableV2.Column';
|
||||
return readPretty && !isInTable;
|
||||
},
|
||||
useComponentProps() {
|
||||
const { t } = useTranslation();
|
||||
|
@ -12,6 +12,7 @@ import {
|
||||
useCollectionManager_deprecated,
|
||||
useCollection_deprecated,
|
||||
} from '../../../collection-manager';
|
||||
import { useCollectionManager } from '../../../data-source';
|
||||
import { useFlag } from '../../../flag-provider';
|
||||
import { useRecord } from '../../../record-provider';
|
||||
import { useColumnSchema } from '../../../schema-component/antd/table-v2/Table.Column.Decorator';
|
||||
@ -979,9 +980,9 @@ export function useIsAssociationField() {
|
||||
}
|
||||
|
||||
export function useIsFileField() {
|
||||
const { getCollection } = useCollectionManager_deprecated();
|
||||
const cm = useCollectionManager();
|
||||
const collectionField = useFormItemCollectionField();
|
||||
const targetCollection = getCollection(collectionField?.target);
|
||||
const targetCollection = cm.getCollection(collectionField?.target);
|
||||
const isFileField = isFileCollection(targetCollection as any);
|
||||
return isFileField;
|
||||
}
|
||||
|
@ -281,6 +281,7 @@ test.describe('table column & table', () => {
|
||||
await showSettingsMenu(page, 'attachment');
|
||||
},
|
||||
supportedOptions: ['Custom column title', 'Column width', 'Delete'],
|
||||
unsupportedOptions: ['Size'],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user