mirror of
https://github.com/nocobase/nocobase.git
synced 2026-09-01 14:57:36 +08:00
refactor: revert to RecursionField version
This commit is contained in:
@@ -7,10 +7,9 @@
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { observer, useField, useFieldSchema } from '@formily/react';
|
||||
import { observer, RecursionField, useField, useFieldSchema } from '@formily/react';
|
||||
import React from 'react';
|
||||
import { useActionContext } from '.';
|
||||
import { NocoBaseRecursionField } from '../../../formily/NocoBaseRecursionField';
|
||||
import { useOpenModeContext } from '../../../modules/popup/OpenModeProvider';
|
||||
import { ComposedActionDrawer } from './types';
|
||||
|
||||
@@ -38,7 +37,7 @@ ActionContainer.Footer = observer(
|
||||
() => {
|
||||
const field = useField();
|
||||
const schema = useFieldSchema();
|
||||
return <NocoBaseRecursionField basePath={field.address} schema={schema} onlyRenderProperties />;
|
||||
return <RecursionField basePath={field.address} schema={schema} />;
|
||||
},
|
||||
{ displayName: 'ActionContainer.Footer' },
|
||||
);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
import { css } from '@emotion/css';
|
||||
import { observer, useField, useFieldSchema } from '@formily/react';
|
||||
import { observer, RecursionField, useField, useFieldSchema } from '@formily/react';
|
||||
import { Modal, ModalProps } from 'antd';
|
||||
import classNames from 'classnames';
|
||||
import React, { useMemo } from 'react';
|
||||
@@ -123,7 +123,7 @@ export const InternalActionModal: React.FC<ActionDrawerProps<ModalProps>> = obse
|
||||
)}
|
||||
footer={
|
||||
showFooter ? (
|
||||
<NocoBaseRecursionField
|
||||
<RecursionField
|
||||
basePath={field.address}
|
||||
schema={schema}
|
||||
onlyRenderProperties
|
||||
@@ -136,7 +136,7 @@ export const InternalActionModal: React.FC<ActionDrawerProps<ModalProps>> = obse
|
||||
)
|
||||
}
|
||||
>
|
||||
<NocoBaseRecursionField
|
||||
<RecursionField
|
||||
basePath={field.address}
|
||||
schema={schema}
|
||||
onlyRenderProperties
|
||||
|
||||
@@ -7,11 +7,10 @@
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { observer, useFieldSchema } from '@formily/react';
|
||||
import { observer, RecursionField, useFieldSchema } from '@formily/react';
|
||||
import React, { useMemo } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { useActionContext } from '.';
|
||||
import { NocoBaseRecursionField } from '../../../formily/NocoBaseRecursionField';
|
||||
import { BackButtonUsedInSubPage } from '../page/BackButtonUsedInSubPage';
|
||||
import { TabsContextProvider, useTabsContext } from '../tabs/context';
|
||||
import { useActionPageStyle } from './Action.Page.style';
|
||||
@@ -40,7 +39,7 @@ export function ActionPage({ level }) {
|
||||
<div className={`${componentCls} ${hashId}`} style={style}>
|
||||
<TabsContextProvider {...tabContext} tabBarExtraContent={<BackButtonUsedInSubPage />}>
|
||||
<zIndexContext.Provider value={style.zIndex}>
|
||||
<NocoBaseRecursionField schema={filedSchema} onlyRenderProperties />
|
||||
<RecursionField schema={filedSchema} onlyRenderProperties />
|
||||
</zIndexContext.Provider>
|
||||
</TabsContextProvider>
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
import { Field } from '@formily/core';
|
||||
import { observer, Schema, useField, useFieldSchema, useForm } from '@formily/react';
|
||||
import { observer, RecursionField, Schema, useField, useFieldSchema, useForm } from '@formily/react';
|
||||
import { isPortalInBody } from '@nocobase/utils/client';
|
||||
import { App, Button } from 'antd';
|
||||
import classnames from 'classnames';
|
||||
@@ -23,7 +23,6 @@ import {
|
||||
useCollectionRecordData,
|
||||
useDataBlockRequestGetter,
|
||||
} from '../../../data-source';
|
||||
import { NocoBaseRecursionField } from '../../../formily/NocoBaseRecursionField';
|
||||
import { withDynamicSchemaProps } from '../../../hoc/withDynamicSchemaProps';
|
||||
import { Icon } from '../../../icon';
|
||||
import { TreeRecordProvider } from '../../../modules/blocks/data-blocks/table/TreeRecordProvider';
|
||||
@@ -301,7 +300,7 @@ const InternalAction: React.FC<InternalActionProps> = observer(function Com(prop
|
||||
fieldSchema={fieldSchema}
|
||||
setSubmitted={setSubmitted}
|
||||
>
|
||||
{popover && <NocoBaseRecursionField basePath={field.address} onlyRenderProperties schema={fieldSchema} />}
|
||||
{popover && <RecursionField basePath={field.address} onlyRenderProperties schema={fieldSchema} />}
|
||||
{!popover && <RenderButton {...buttonProps} />}
|
||||
<VariablePopupRecordProvider>{!popover && props.children}</VariablePopupRecordProvider>
|
||||
{element}
|
||||
|
||||
@@ -8,12 +8,11 @@
|
||||
*/
|
||||
|
||||
import { cx } from '@emotion/css';
|
||||
import { observer, useFieldSchema } from '@formily/react';
|
||||
import { observer, RecursionField, useFieldSchema } from '@formily/react';
|
||||
import { Space, SpaceProps, theme } from 'antd';
|
||||
import React, { CSSProperties, useContext } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { useSchemaInitializerRender } from '../../../application';
|
||||
import { NocoBaseRecursionField } from '../../../formily/NocoBaseRecursionField';
|
||||
import { withDynamicSchemaProps } from '../../../hoc/withDynamicSchemaProps';
|
||||
import { DndContext } from '../../common';
|
||||
import { useDesignable, useProps } from '../../hooks';
|
||||
@@ -82,7 +81,7 @@ export const ActionBar = withDynamicSchemaProps(
|
||||
<div>
|
||||
<Space {...spaceProps} style={{ flexWrap: 'wrap', ...(spaceProps?.style || {}) }}>
|
||||
{fieldSchema.mapProperties((schema, key) => {
|
||||
return <NocoBaseRecursionField key={key} name={key} schema={schema} />;
|
||||
return <RecursionField key={key} name={key} schema={schema} />;
|
||||
})}
|
||||
</Space>
|
||||
</div>
|
||||
@@ -129,7 +128,7 @@ export const ActionBar = withDynamicSchemaProps(
|
||||
if (schema['x-align'] !== 'left') {
|
||||
return null;
|
||||
}
|
||||
return <NocoBaseRecursionField key={key} name={key} schema={schema} />;
|
||||
return <RecursionField key={key} name={key} schema={schema} />;
|
||||
})}
|
||||
</Space>
|
||||
<Space {...spaceProps} style={{ flexWrap: 'wrap', ...(spaceProps?.style || {}) }}>
|
||||
@@ -137,7 +136,7 @@ export const ActionBar = withDynamicSchemaProps(
|
||||
if (schema['x-align'] === 'left') {
|
||||
return null;
|
||||
}
|
||||
return <NocoBaseRecursionField key={key} name={key} schema={schema} />;
|
||||
return <RecursionField key={key} name={key} schema={schema} />;
|
||||
})}
|
||||
</Space>
|
||||
</DndContext>
|
||||
|
||||
@@ -7,12 +7,11 @@
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { useFieldSchema } from '@formily/react';
|
||||
import { RecursionField, useFieldSchema } from '@formily/react';
|
||||
import { Empty } from 'antd';
|
||||
import _ from 'lodash';
|
||||
import React from 'react';
|
||||
import { useDataBlockRequestData } from '../../../data-source';
|
||||
import { NocoBaseRecursionField } from '../../../formily/NocoBaseRecursionField';
|
||||
import { withDynamicSchemaProps } from '../../../hoc/withDynamicSchemaProps';
|
||||
import { withSkeletonComponent } from '../../../hoc/withSkeletonComponent';
|
||||
import { FormV2 } from '../form-v2';
|
||||
@@ -28,7 +27,7 @@ export const Details = withDynamicSchemaProps(
|
||||
return (
|
||||
<>
|
||||
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
||||
<NocoBaseRecursionField schema={schema.properties.pagination} name="pagination" />
|
||||
<RecursionField schema={schema.properties.pagination} name="pagination" />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
import { css } from '@emotion/css';
|
||||
import { FormLayout, IFormLayoutProps } from '@formily/antd-v5';
|
||||
import { Field, Form as FormilyForm, createForm, onFieldInit, onFormInputChange } from '@formily/core';
|
||||
import { FieldContext, FormContext, observer, useField, useFieldSchema } from '@formily/react';
|
||||
import { createForm, Field, Form as FormilyForm, onFieldInit, onFormInputChange } from '@formily/core';
|
||||
import { FieldContext, FormContext, observer, RecursionField, useField, useFieldSchema } from '@formily/react';
|
||||
import { uid } from '@formily/shared';
|
||||
import { ConfigProvider, theme } from 'antd';
|
||||
import React, { useEffect, useMemo } from 'react';
|
||||
@@ -18,7 +18,6 @@ import { useActionContext } from '..';
|
||||
import { useAttach, useComponent } from '../..';
|
||||
import { getCardItemSchema } from '../../../block-provider';
|
||||
import { useTemplateBlockContext } from '../../../block-provider/TemplateBlockProvider';
|
||||
import { NocoBaseRecursionField } from '../../../formily/NocoBaseRecursionField';
|
||||
import { withDynamicSchemaProps } from '../../../hoc/withDynamicSchemaProps';
|
||||
import { bindLinkageRulesToFiled } from '../../../schema-settings/LinkageRules/bindLinkageRulesToFiled';
|
||||
import { forEachLinkageRule } from '../../../schema-settings/LinkageRules/forEachLinkageRule';
|
||||
@@ -69,7 +68,7 @@ const FormComponent: React.FC<FormProps> = (props) => {
|
||||
}
|
||||
`}
|
||||
>
|
||||
<NocoBaseRecursionField basePath={f.address} schema={fieldSchema} onlyRenderProperties isUseFormilyField />
|
||||
<RecursionField basePath={f.address} schema={fieldSchema} onlyRenderProperties />
|
||||
</div>
|
||||
</FormLayout>
|
||||
</FormContext.Provider>
|
||||
@@ -92,12 +91,7 @@ const FormDecorator: React.FC<FormProps> = (props) => {
|
||||
<FormLayout layout={'vertical'} {...others}>
|
||||
<FieldContext.Provider value={f}>
|
||||
<Component {...field.componentProps}>
|
||||
<NocoBaseRecursionField
|
||||
basePath={f.address}
|
||||
schema={fieldSchema}
|
||||
onlyRenderProperties
|
||||
isUseFormilyField
|
||||
/>
|
||||
<RecursionField basePath={f.address} schema={fieldSchema} onlyRenderProperties />
|
||||
</Component>
|
||||
</FieldContext.Provider>
|
||||
{/* <FieldContext.Provider value={f}>{children}</FieldContext.Provider> */}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
import { TinyColor } from '@ctrl/tinycolor';
|
||||
import { useDndContext, useDndMonitor, useDraggable, useDroppable } from '@dnd-kit/core';
|
||||
import { ISchema, Schema, observer, useField, useFieldSchema } from '@formily/react';
|
||||
import { ISchema, RecursionField, Schema, observer, useField, useFieldSchema } from '@formily/react';
|
||||
import { uid } from '@formily/shared';
|
||||
import cls from 'classnames';
|
||||
import _ from 'lodash';
|
||||
@@ -17,7 +17,6 @@ import React, { createContext, useCallback, useContext, useEffect, useMemo, useR
|
||||
import { SchemaComponent, useDesignable, useSchemaInitializerRender } from '../../../';
|
||||
import { useFormBlockContext } from '../../../block-provider/FormBlockProvider';
|
||||
import { FilterBlockProvider } from '../../../filter-provider/FilterProvider';
|
||||
import { NocoBaseRecursionField } from '../../../formily/NocoBaseRecursionField';
|
||||
import { DndContext, DndContextProps } from '../../common/dnd-context';
|
||||
import { useToken } from '../__builtins__';
|
||||
import useStyles from './Grid.style';
|
||||
@@ -376,7 +375,7 @@ export const Grid: any = observer(
|
||||
{distributedValue ? (
|
||||
<SchemaComponent name={schema.name} schema={schema} distributed />
|
||||
) : (
|
||||
<NocoBaseRecursionField name={schema.name} schema={schema} isUseFormilyField />
|
||||
<RecursionField name={schema.name} schema={schema} />
|
||||
)}
|
||||
{showDivider ? (
|
||||
<RowDivider
|
||||
@@ -444,7 +443,7 @@ Grid.Row = observer(
|
||||
{cols.map((schema, index) => {
|
||||
return (
|
||||
<React.Fragment key={index}>
|
||||
<NocoBaseRecursionField name={schema.name} schema={schema} isUseFormilyField />
|
||||
<RecursionField name={schema.name} schema={schema} />
|
||||
{showDivider && (
|
||||
<ColDivider
|
||||
cols={cols}
|
||||
|
||||
+2
-2
@@ -7,9 +7,9 @@
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { RecursionField } from '@formily/react';
|
||||
import React, { useMemo } from 'react';
|
||||
import { useCollection } from '../../../../data-source';
|
||||
import { NocoBaseRecursionField } from '../../../../formily/NocoBaseRecursionField';
|
||||
import { useRecord } from '../../../../record-provider';
|
||||
|
||||
export const ColumnFieldProvider = (props: { schema: any; basePath: any; children: any }) => {
|
||||
@@ -45,7 +45,7 @@ export const ColumnFieldProvider = (props: { schema: any; basePath: any; childre
|
||||
},
|
||||
},
|
||||
};
|
||||
return <NocoBaseRecursionField basePath={basePath} schema={newSchema} onlyRenderProperties isUseFormilyField />;
|
||||
return <RecursionField basePath={basePath} schema={newSchema} onlyRenderProperties />;
|
||||
}
|
||||
return props.children;
|
||||
};
|
||||
|
||||
@@ -7,10 +7,9 @@
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { IRecursionFieldProps, ISchemaFieldProps, Schema } from '@formily/react';
|
||||
import { IRecursionFieldProps, ISchemaFieldProps, RecursionField, Schema } from '@formily/react';
|
||||
import { useUpdate } from 'ahooks';
|
||||
import React, { memo, useContext, useMemo } from 'react';
|
||||
import { NocoBaseRecursionField } from '../../formily/NocoBaseRecursionField';
|
||||
import { SchemaComponentContext } from '../context';
|
||||
import { SchemaComponentOptions } from './SchemaComponentOptions';
|
||||
|
||||
@@ -68,7 +67,7 @@ const RecursionSchemaComponent = memo((props: ISchemaFieldProps & SchemaComponen
|
||||
return (
|
||||
<SchemaComponentContext.Provider value={value}>
|
||||
<SchemaComponentOptions inherit components={components} scope={scope}>
|
||||
<NocoBaseRecursionField {...others} schema={schema} isUseFormilyField />
|
||||
<RecursionField {...others} schema={schema} />
|
||||
</SchemaComponentOptions>
|
||||
</SchemaComponentContext.Provider>
|
||||
);
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { NocoBaseRecursionField, SchemaComponentOptions, useCurrentRoles } from '@nocobase/client';
|
||||
import { RecursionField } from '@formily/react';
|
||||
import { SchemaComponentOptions, useCurrentRoles } from '@nocobase/client';
|
||||
import React from 'react';
|
||||
import { ExpiresSelect } from './ExpiresSelect';
|
||||
import { configurationSchema } from './schema';
|
||||
@@ -16,7 +17,7 @@ export const Configuration = () => {
|
||||
const currentRoles = useCurrentRoles();
|
||||
return (
|
||||
<SchemaComponentOptions scope={{ currentRoles }} components={{ ExpiresSelect }}>
|
||||
<NocoBaseRecursionField schema={configurationSchema} />
|
||||
<RecursionField schema={configurationSchema} />
|
||||
</SchemaComponentOptions>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user