import { ISchema } from '@formily/react';
import { uid } from '@formily/shared';
import { generateNTemplate } from '../../locale';
export const createCalendarBlockSchema = (options) => {
const { collection, dataSource, resource, fieldNames, settings, ...others } = options;
const schema: ISchema = {
type: 'void',
'x-acl-action': `${resource || collection}:list`,
'x-decorator': 'CalendarBlockProvider',
'x-decorator-props': {
collection: collection,
dataSource,
resource: resource || collection,
action: 'list',
fieldNames: {
id: 'id',
...fieldNames,
},
params: {
paginate: false,
...others,
'x-toolbar': 'BlockSchemaToolbar',
'x-settings': settings,
'x-component': 'CardItem',
properties: {
[uid()]: {
'x-component': 'CalendarV2',
'x-component-props': {
useProps: '{{ useCalendarBlockProps }}',
toolBar: {
'x-component': 'CalendarV2.ActionBar',
style: {
marginBottom: 24,
'x-initializer': 'CalendarActionInitializers',
properties: {},
event: {
'x-component': 'CalendarV2.Event',
drawer: {
'x-component': 'Action.Drawer',
className: 'nb-action-popup',
title: generateNTemplate('View record'),
tabs: {
'x-component': 'Tabs',
'x-component-props': {},
'x-initializer': 'TabPaneInitializers',
'x-initializer-props': {
gridInitializer: 'RecordBlockInitializers',
tab1: {
title: generateNTemplate('Details'),
'x-component': 'Tabs.TabPane',
'x-designer': 'Tabs.Designer',
grid: {
'x-component': 'Grid',
actionInitializers: 'CalendarFormActionInitializers',
'x-initializer': 'RecordBlockInitializers',
};
return schema;