chore: remove link to field and association fields filter

This commit is contained in:
chenos 2023-05-17 17:04:33 +08:00
parent 390c12ab2d
commit be50cb5929
3 changed files with 48 additions and 49 deletions

View File

@ -1,6 +1,6 @@
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import { ArrayTable } from '@formily/antd'; import { ArrayTable } from '@formily/antd';
import { useForm, useField } from '@formily/react'; import { useField, useForm } from '@formily/react';
import { uid } from '@formily/shared'; import { uid } from '@formily/shared';
import { Button, Dropdown, Menu } from 'antd'; import { Button, Dropdown, Menu } from 'antd';
import { cloneDeep } from 'lodash'; import { cloneDeep } from 'lodash';
@ -9,11 +9,11 @@ import { useTranslation } from 'react-i18next';
import { useRequest } from '../../api-client'; import { useRequest } from '../../api-client';
import { RecordProvider, useRecord } from '../../record-provider'; import { RecordProvider, useRecord } from '../../record-provider';
import { ActionContext, SchemaComponent, useActionContext, useCompile } from '../../schema-component'; import { ActionContext, SchemaComponent, useActionContext, useCompile } from '../../schema-component';
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
import { useCancelAction } from '../action-hooks'; import { useCancelAction } from '../action-hooks';
import { useCollectionManager } from '../hooks'; import { useCollectionManager } from '../hooks';
import { useOptions } from '../hooks/useOptions'; import { useOptions } from '../hooks/useOptions';
import { IField } from '../interfaces/types'; import { IField } from '../interfaces/types';
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
import * as components from './components'; import * as components from './components';
import { getOptions } from './interfaces'; import { getOptions } from './interfaces';
@ -249,7 +249,7 @@ export const AddFieldAction = (props) => {
option.children.length > 0 && ( option.children.length > 0 && (
<Menu.ItemGroup key={option.label} title={compile(option.label)}> <Menu.ItemGroup key={option.label} title={compile(option.label)}>
{option.children {option.children
.filter((child) => !['o2o', 'subTable'].includes(child.name)) .filter((child) => !['o2o', 'subTable', 'linkTo'].includes(child.name))
.map((child) => { .map((child) => {
return ( return (
<Menu.Item key={child.name} data-targetScope={child.targetScope}> <Menu.Item key={child.name} data-targetScope={child.targetScope}>

View File

@ -1,4 +1,4 @@
import { Schema, useFieldSchema } from '@formily/react'; import { useFieldSchema } from '@formily/react';
import { useCollection } from '../../'; import { useCollection } from '../../';
// 表格操作配置 // 表格操作配置
@ -81,33 +81,33 @@ export const TableActionInitializers = {
return (collection as any).template !== 'view'; return (collection as any).template !== 'view';
}, },
}, },
{ // {
type: 'item', // type: 'item',
title: "{{t('Association fields filter')}}", // title: "{{t('Association fields filter')}}",
component: 'ActionBarAssociationFilterAction', // component: 'ActionBarAssociationFilterAction',
schema: { // schema: {
'x-align': 'left', // 'x-align': 'left',
}, // },
find: (schema: Schema) => { // find: (schema: Schema) => {
const resultSchema = Object.entries(schema.parent.properties).find( // const resultSchema = Object.entries(schema.parent.properties).find(
([, value]) => value['x-component'] === 'AssociationFilter', // ([, value]) => value['x-component'] === 'AssociationFilter',
)?.[1]; // )?.[1];
return resultSchema; // return resultSchema;
}, // },
visible: () => { // visible: () => {
const collection = useCollection(); // const collection = useCollection();
const schema = useFieldSchema(); // const schema = useFieldSchema();
return (collection as any).template !== 'view' && schema['x-initializer'] !== 'GanttActionInitializers'; // return (collection as any).template !== 'view' && schema['x-initializer'] !== 'GanttActionInitializers';
}, // },
}, // },
{ // {
type: 'divider', // type: 'divider',
visible: () => { // visible: () => {
const collection = useCollection(); // const collection = useCollection();
const schema = useFieldSchema(); // const schema = useFieldSchema();
return (collection as any).template !== 'view' && schema['x-initializer'] !== 'GanttActionInitializers'; // return (collection as any).template !== 'view' && schema['x-initializer'] !== 'GanttActionInitializers';
}, // },
}, // },
{ {
type: 'subMenu', type: 'subMenu',
title: '{{t("Customize")}}', title: '{{t("Customize")}}',

View File

@ -1,4 +1,3 @@
import { Schema } from '@formily/react';
// 操作记录表格操作配置 // 操作记录表格操作配置
export const AuditLogsTableActionInitializers = { export const AuditLogsTableActionInitializers = {
@ -30,22 +29,22 @@ export const AuditLogsTableActionInitializers = {
}, },
], ],
}, },
{ // {
type: 'divider', // type: 'divider',
}, // },
{ // {
type: 'item', // type: 'item',
title: "{{t('Association fields filter')}}", // title: "{{t('Association fields filter')}}",
component: 'ActionBarAssociationFilterAction', // component: 'ActionBarAssociationFilterAction',
schema: { // schema: {
'x-align': 'left', // 'x-align': 'left',
}, // },
find: (schema: Schema) => { // find: (schema: Schema) => {
const resultSchema = Object.entries(schema.parent.properties).find( // const resultSchema = Object.entries(schema.parent.properties).find(
([, value]) => value['x-component'] === 'AssociationFilter', // ([, value]) => value['x-component'] === 'AssociationFilter',
)?.[1]; // )?.[1];
return resultSchema; // return resultSchema;
}, // },
}, // },
], ],
}; };