mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 03:02:19 +08:00
fix(data-vi): "Current popup record" variable issue (#5984)
This commit is contained in:
parent
b1b1dc6f13
commit
72255250fa
@ -9,17 +9,28 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { BlockRefreshButton } from '../initializers/BlockRefreshAction';
|
import { BlockRefreshButton } from '../initializers/BlockRefreshAction';
|
||||||
import { SchemaComponentOptions } from '@nocobase/client';
|
import { SchemaComponentOptions, useCurrentPopupContext, useLocalVariables } from '@nocobase/client';
|
||||||
import { GlobalAutoRefreshProvider } from './GlobalAutoRefreshProvider';
|
import { GlobalAutoRefreshProvider } from './GlobalAutoRefreshProvider';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
export const ChartBlockProvider: React.FC = (props) => {
|
export const ChartBlockProvider: React.FC = (props) => {
|
||||||
|
const currentPopupContext = useCurrentPopupContext();
|
||||||
|
const localVariables = useLocalVariables();
|
||||||
|
const popUpCtxReady =
|
||||||
|
_.isEmpty(currentPopupContext) ||
|
||||||
|
localVariables?.some((variable) => variable.name === '$nPopupRecord' && variable.ctx);
|
||||||
|
|
||||||
|
if (!popUpCtxReady) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SchemaComponentOptions
|
<SchemaComponentOptions
|
||||||
components={{
|
components={{
|
||||||
BlockRefreshButton,
|
BlockRefreshButton,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<GlobalAutoRefreshProvider> {props.children}</GlobalAutoRefreshProvider>
|
<GlobalAutoRefreshProvider>{props.children}</GlobalAutoRefreshProvider>
|
||||||
</SchemaComponentOptions>
|
</SchemaComponentOptions>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user