mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 07:25:15 +00:00
parent
950495c292
commit
d83c102492
@ -325,6 +325,25 @@ const anyVar = '';
|
||||
app.addScopes({ useSomeThing, anyVar })
|
||||
```
|
||||
|
||||
### app.getCollectionManager()
|
||||
|
||||
Get the [collection manager](/core/data-source/collection-manager) instance of the specified data source.
|
||||
|
||||
- Type
|
||||
|
||||
```tsx | pure
|
||||
class Application {
|
||||
getCollectionManager(dataSource?: string): CollectionManager;
|
||||
}
|
||||
```
|
||||
|
||||
- Example
|
||||
|
||||
```tsx | pure
|
||||
app.getCollectionManager() // Get the default data source collection manager
|
||||
app.getCollectionManager('test') // Get the specified data source collection manager
|
||||
```
|
||||
|
||||
## Hooks
|
||||
|
||||
### useApp()
|
||||
|
@ -324,6 +324,25 @@ const anyVar = '';
|
||||
app.addScopes({ useSomeThing, anyVar })
|
||||
```
|
||||
|
||||
### app.getCollectionManager()
|
||||
|
||||
获取指定数据源的 [collection manager](/core/data-source/collection-manager) 实例。
|
||||
|
||||
- 类型
|
||||
|
||||
```tsx | pure
|
||||
class Application {
|
||||
getCollectionManager(dataSource?: string): CollectionManager;
|
||||
}
|
||||
```
|
||||
|
||||
- 示例
|
||||
|
||||
```tsx | pure
|
||||
app.getCollectionManager() // 获取默认数据源的 collection manager
|
||||
app.getCollectionManager('test') // 获取指定数据源的 collection manager
|
||||
```
|
||||
|
||||
## Hooks
|
||||
|
||||
### useApp()
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
import { ComponentType } from 'react';
|
||||
import {
|
||||
SchemaSettingsActionModalItemProps,
|
||||
SchemaSettingsCascaderItemProps,
|
||||
SchemaSettingsItemProps,
|
||||
SchemaSettingsModalItemProps,
|
||||
@ -77,7 +78,7 @@ export type SchemaSettingItemModalType = SchemaSettingsItemCommon<SchemaSettings
|
||||
type: 'modal';
|
||||
};
|
||||
|
||||
export type SchemaSettingItemActionModalType = SchemaSettingsItemCommon<SchemaSettingsSelectItemProps> & {
|
||||
export type SchemaSettingItemActionModalType = SchemaSettingsItemCommon<SchemaSettingsActionModalItemProps> & {
|
||||
type: 'actionModal';
|
||||
};
|
||||
|
||||
|
@ -30,6 +30,7 @@ export interface ActionContextProps {
|
||||
modalProps?: ModalProps;
|
||||
submitted?: boolean;
|
||||
setSubmitted?: (v: boolean) => void;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
export type UseActionType = (callback?: () => void) => {
|
||||
|
@ -40,4 +40,5 @@ export interface ISchemaComponentOptionsProps {
|
||||
scope?: any;
|
||||
components?: SchemaReactComponents;
|
||||
inherit?: boolean;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import { render, waitFor, screen } from '@testing-library/react';
|
||||
import { sleep } from '../web';
|
||||
|
||||
export * from './utils';
|
||||
@ -22,6 +22,19 @@ function customRender(ui: React.ReactElement, options = {}) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function waitForApp() {
|
||||
return waitFor(() => {
|
||||
// @ts-ignore
|
||||
expect(screen.queryByText('Loading...')).not.toBeInTheDocument();
|
||||
});
|
||||
}
|
||||
|
||||
export async function renderApp(element: React.JSX.Element) {
|
||||
const res = render(element);
|
||||
await waitForApp();
|
||||
return res;
|
||||
}
|
||||
|
||||
export * from '@testing-library/react';
|
||||
export { default as userEvent } from '@testing-library/user-event';
|
||||
// override render export
|
||||
|
Loading…
Reference in New Issue
Block a user