chore: remove Default value option for sequence field (#2488)

* chore: remove Default value option for sequence field

* chore: remove console.log
This commit is contained in:
被雨水过滤的空气-Rain 2023-08-20 12:08:07 +08:00 committed by GitHub
parent 847eacce70
commit 95e1cd390b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 11 deletions

View File

@ -1,5 +1,5 @@
import { css, cx } from '@emotion/css'; import { css, cx } from '@emotion/css';
import { ArrayCollapse, ArrayItems, FormLayout, FormItem as Item } from '@formily/antd-v5'; import { ArrayCollapse, FormLayout, FormItem as Item } from '@formily/antd-v5';
import { Field } from '@formily/core'; import { Field } from '@formily/core';
import { ISchema, observer, useField, useFieldSchema } from '@formily/react'; import { ISchema, observer, useField, useFieldSchema } from '@formily/react';
import { Select } from 'antd'; import { Select } from 'antd';
@ -70,6 +70,7 @@ export const FormItem: any = observer(
const variablesCtx = useVariablesCtx(); const variablesCtx = useVariablesCtx();
const { getCollectionJoinField } = useCollectionManager(); const { getCollectionJoinField } = useCollectionManager();
const collectionField = getCollectionJoinField(schema['x-collection-field']); const collectionField = getCollectionJoinField(schema['x-collection-field']);
useEffect(() => { useEffect(() => {
if (ctx?.block === 'form') { if (ctx?.block === 'form') {
ctx.field.data = ctx.field.data || {}; ctx.field.data = ctx.field.data || {};

View File

@ -1,6 +1,6 @@
import { css } from '@emotion/css'; import { css } from '@emotion/css';
import { ArrayCollapse, ArrayItems, FormItem, FormLayout, Input } from '@formily/antd-v5'; import { ArrayCollapse, ArrayItems, FormItem, FormLayout, Input } from '@formily/antd-v5';
import { createForm, Field, GeneralField } from '@formily/core'; import { Field, GeneralField, createForm } from '@formily/core';
import { ISchema, Schema, SchemaOptionsContext, useField, useFieldSchema, useForm } from '@formily/react'; import { ISchema, Schema, SchemaOptionsContext, useField, useFieldSchema, useForm } from '@formily/react';
import { uid } from '@formily/shared'; import { uid } from '@formily/shared';
import { error } from '@nocobase/utils/client'; import { error } from '@nocobase/utils/client';
@ -21,33 +21,34 @@ import {
} from 'antd'; } from 'antd';
import _, { cloneDeep } from 'lodash'; import _, { cloneDeep } from 'lodash';
import React, { import React, {
createContext,
ReactNode, ReactNode,
createContext,
useCallback, useCallback,
useContext, useContext,
useMemo, useMemo,
useState,
// @ts-ignore // @ts-ignore
useTransition as useReactTransition, useTransition as useReactTransition,
useState,
} from 'react'; } from 'react';
import { createPortal } from 'react-dom'; import { createPortal } from 'react-dom';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { import {
ActionContextProvider,
APIClientProvider, APIClientProvider,
ActionContextProvider,
CollectionFieldOptions, CollectionFieldOptions,
CollectionManagerContext, CollectionManagerContext,
CollectionProvider, CollectionProvider,
createDesignable,
Designable, Designable,
findFormBlock,
FormDialog, FormDialog,
FormProvider, FormProvider,
RemoteSchemaComponent, RemoteSchemaComponent,
SchemaComponent, SchemaComponent,
SchemaComponentContext, SchemaComponentContext,
SchemaComponentOptions, SchemaComponentOptions,
createDesignable,
findFormBlock,
useAPIClient, useAPIClient,
useActionContext,
useBlockRequestContext, useBlockRequestContext,
useCollection, useCollection,
useCollectionManager, useCollectionManager,
@ -57,7 +58,6 @@ import {
useGlobalTheme, useGlobalTheme,
useLinkageCollectionFilterOptions, useLinkageCollectionFilterOptions,
useSortFields, useSortFields,
useActionContext,
} from '..'; } from '..';
import { useTableBlockContext } from '../block-provider'; import { useTableBlockContext } from '../block-provider';
import { findFilterTargets, updateFilterTargets } from '../block-provider/hooks'; import { findFilterTargets, updateFilterTargets } from '../block-provider/hooks';
@ -1678,9 +1678,19 @@ SchemaSettings.SortingRule = function SortRuleConfigure(props) {
// 是否显示默认值配置项 // 是否显示默认值配置项
export const isShowDefaultValue = (collectionField: CollectionFieldOptions, getInterface) => { export const isShowDefaultValue = (collectionField: CollectionFieldOptions, getInterface) => {
return ( return (
!['o2o', 'oho', 'obo', 'o2m', 'attachment', 'expression', 'point', 'lineString', 'circle', 'polygon'].includes( ![
collectionField?.interface, 'o2o',
) && !isSystemField(collectionField, getInterface) 'oho',
'obo',
'o2m',
'attachment',
'expression',
'point',
'lineString',
'circle',
'polygon',
'sequence',
].includes(collectionField?.interface) && !isSystemField(collectionField, getInterface)
); );
}; };