fix: record provider required for read pretty

This commit is contained in:
chenos 2022-08-11 23:48:13 +08:00
parent 538a28d0bd
commit 38c3e3e4cc
3 changed files with 11 additions and 3 deletions

View File

@ -2,6 +2,7 @@ import { createForm } from '@formily/core';
import { useField } from '@formily/react'; import { useField } from '@formily/react';
import { Spin } from 'antd'; import { Spin } from 'antd';
import React, { createContext, useContext, useEffect, useMemo, useRef } from 'react'; import React, { createContext, useContext, useEffect, useMemo, useRef } from 'react';
import { RecordProvider } from '../record-provider';
import { BlockProvider, useBlockRequestContext } from './BlockProvider'; import { BlockProvider, useBlockRequestContext } from './BlockProvider';
export const FormBlockContext = createContext<any>({}); export const FormBlockContext = createContext<any>({});
@ -33,7 +34,13 @@ const InternalFormBlockProvider = (props) => {
formBlockRef, formBlockRef,
}} }}
> >
{readPretty ? (
<RecordProvider record={service?.data?.data}>
<div ref={formBlockRef}>{props.children}</div> <div ref={formBlockRef}>{props.children}</div>
</RecordProvider>
) : (
<div ref={formBlockRef}>{props.children}</div>
)}
</FormBlockContext.Provider> </FormBlockContext.Provider>
); );
}; };

View File

@ -1,7 +1,7 @@
import { ArrayField } from '@formily/core'; import { ArrayField } from '@formily/core';
import { Schema, useField, useFieldSchema } from '@formily/react'; import { Schema, useField, useFieldSchema } from '@formily/react';
import React, { createContext, useContext, useEffect } from 'react'; import React, { createContext, useContext, useEffect } from 'react';
import { useCollection, useCollectionManager } from '../collection-manager'; import { useCollectionManager } from '../collection-manager';
import { useRecord } from '../record-provider'; import { useRecord } from '../record-provider';
import { BlockProvider, useBlockRequestContext } from './BlockProvider'; import { BlockProvider, useBlockRequestContext } from './BlockProvider';
import { useFormBlockContext } from './FormBlockProvider'; import { useFormBlockContext } from './FormBlockProvider';
@ -60,7 +60,7 @@ export const TableSelectorProvider = (props) => {
if (props.dragSort) { if (props.dragSort) {
params['sort'] = ['sort']; params['sort'] = ['sort'];
} }
if (appends?.length) { if (!Object.keys(params).includes('appends')) {
params['appends'] = appends; params['appends'] = appends;
} }
if (collectionField) { if (collectionField) {

View File

@ -52,6 +52,7 @@ export const ExportActionInitializer = (props) => {
exportSettings: [], exportSettings: [],
}, },
'x-designer': 'ExportDesigner', 'x-designer': 'ExportDesigner',
'x-decorator': 'ACLActionProvider',
'x-component': 'Action', 'x-component': 'Action',
'x-component-props': { 'x-component-props': {
icon: 'clouddownloadoutlined', icon: 'clouddownloadoutlined',