nocobase/packages/plugins/@nocobase/plugin-calendar/src/client/index.tsx
Dunqing e112a644ea
feat(plugin-calendar): add calendar plugin (#3109)
* feat: init calendar plugin

* feat: move files to plugin

* feat: handle CalendarBlockInitializer in plugin

* feat: add todo

* feat: move collection template to plugin and fix i18n

* chore: update deps

* feat: export genStyleHook

* feat: handle i18n

* chore: remove react-i18next

* docs: update info

* test: move e2e test

* test: move to client

* chore: update version

* fix: merge revert

* fix: merge revert

* fix: missing SchemaSettings.xxx

* test: fix e2e failed

* test: update

* test: fix case failed

* fix: data blocks

* fix: remove provider

* fix: missing CalendarV2

* fix: missing CalendarActionInitializers

* fix: version

* fix: error

* fix: calender block form action should support print

---------

Co-authored-by: chenos <chenlinxh@gmail.com>
Co-authored-by: katherinehhh <katherine_15995@163.com>
2023-12-23 15:16:41 +08:00

29 lines
1.2 KiB
TypeScript

import { Plugin, registerTemplate } from '@nocobase/client';
import { generateNTemplate } from '../locale';
import { CalendarV2 } from './calendar';
import { calendar } from './collection-templates/calendar';
import { CalendarBlockProvider, useCalendarBlockProps } from './schema-initializer/CalendarBlockProvider';
import { CalendarActionInitializers, CalendarFormActionInitializers } from './schema-initializer/initializers';
import { CalendarBlockInitializer, RecordAssociationCalendarBlockInitializer } from './schema-initializer/items';
export class PluginCalendarClient extends Plugin {
async load() {
this.app.schemaInitializerManager.addItem('BlockInitializers', 'dataBlocks.calendar', {
title: generateNTemplate('Calendar'),
Component: 'CalendarBlockInitializer',
});
this.app.addComponents({
CalendarBlockProvider,
CalendarBlockInitializer,
RecordAssociationCalendarBlockInitializer,
CalendarV2,
});
this.app.addScopes({ useCalendarBlockProps });
this.app.schemaInitializerManager.add(CalendarActionInitializers);
this.app.schemaInitializerManager.add(CalendarFormActionInitializers);
registerTemplate('calendar', calendar);
}
}
export default PluginCalendarClient;