tachybase_todo/packages/client/src/block-provider/BlockSchemaComponentProvider.tsx

39 lines
1.4 KiB
TypeScript
Raw Normal View History

import React from 'react';
import { SchemaComponentOptions } from '../schema-component/core/SchemaComponentOptions';
import { useParamsFromRecord, useSourceIdFromParentRecord, useSourceIdFromRecord } from './BlockProvider';
import { CalendarBlockProvider, useCalendarBlockProps } from './CalendarBlockProvider';
import { FormBlockProvider, useFormBlockProps } from './FormBlockProvider';
import * as bp from './hooks';
import { KanbanBlockProvider, useKanbanBlockProps } from './KanbanBlockProvider';
import { TableBlockProvider, useTableBlockProps } from './TableBlockProvider';
import { TableFieldProvider, useTableFieldProps } from './TableFieldProvider';
import { TableSelectorProvider, useTableSelectorProps } from './TableSelectorProvider';
export const BlockSchemaComponentProvider: React.FC = (props) => {
return (
<SchemaComponentOptions
components={{
CalendarBlockProvider,
TableFieldProvider,
TableBlockProvider,
TableSelectorProvider,
FormBlockProvider,
KanbanBlockProvider,
}}
scope={{
...bp,
useSourceIdFromRecord,
useSourceIdFromParentRecord,
useParamsFromRecord,
useCalendarBlockProps,
useFormBlockProps,
useTableFieldProps,
useTableBlockProps,
useTableSelectorProps,
useKanbanBlockProps,
}}
>
{props.children}
</SchemaComponentOptions>
);
};