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 { 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 { ISchema, observer, useField, useFieldSchema } from '@formily/react';
import { Select } from 'antd';
@ -70,6 +70,7 @@ export const FormItem: any = observer(
const variablesCtx = useVariablesCtx();
const { getCollectionJoinField } = useCollectionManager();
const collectionField = getCollectionJoinField(schema['x-collection-field']);
useEffect(() => {
if (ctx?.block === 'form') {
ctx.field.data = ctx.field.data || {};

View File

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