tachybase_todo/packages/plugins/audit-logs/src/client/AuditLogsBlockProvider.tsx
2023-04-06 16:10:38 +08:00

31 lines
1.3 KiB
TypeScript

import {
CollectionManagerProvider,
SchemaInitializerProvider,
TableBlockProvider
} from '@nocobase/client';
import React from 'react';
import { useAuditChangesCollection, useAuditLogsCollection, useCollectionsCollection } from './collections';
import { AuditLogsTableActionColumnInitializers } from './initializers/AuditLogsTableActionColumnInitializers';
import { AuditLogsTableActionInitializers } from './initializers/AuditLogsTableActionInitializers';
import { AuditLogsTableColumnInitializers } from './initializers/AuditLogsTableColumnInitializers';
export const AuditLogsBlockProvider: React.FC = ({ children, ...restProps }) => {
const auditChangesCollection = useAuditChangesCollection();
const auditLogsCollection = useAuditLogsCollection();
const collectionsCollection = useCollectionsCollection();
return (
<SchemaInitializerProvider
initializers={{
AuditLogsTableActionInitializers,
AuditLogsTableActionColumnInitializers,
AuditLogsTableColumnInitializers,
}}
>
<CollectionManagerProvider collections={[auditLogsCollection, auditChangesCollection, collectionsCollection]}>
<TableBlockProvider {...restProps}>{children}</TableBlockProvider>
</CollectionManagerProvider>
</SchemaInitializerProvider>
);
};