flow-document-container-module.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. import { ContainerModule } from 'inversify';
  6. import { FlowOperationBaseService } from './typings/flow-operation';
  7. import { FlowDragService } from './services/flow-drag-service';
  8. import { FlowGroupService, FlowOperationBaseServiceImpl } from './services';
  9. import { HorizontalFixedLayout, VerticalFixedLayout } from './layout';
  10. import { FlowDocumentContribution } from './flow-document-contribution';
  11. import { FlowDocumentConfig } from './flow-document-config';
  12. import { FlowDocument, FlowDocumentProvider } from './flow-document';
  13. export const FlowDocumentContainerModule = new ContainerModule((bind) => {
  14. bind(FlowDocument).toSelf().inSingletonScope();
  15. bind(FlowDocumentProvider)
  16. .toDynamicValue((ctx) => () => ctx.container.get(FlowDocument))
  17. .inSingletonScope();
  18. bind(FlowDocumentConfig).toSelf().inSingletonScope();
  19. bind(VerticalFixedLayout).toSelf().inSingletonScope();
  20. bind(HorizontalFixedLayout).toSelf().inSingletonScope();
  21. bind(FlowDragService).toSelf().inSingletonScope();
  22. bind(FlowOperationBaseService).to(FlowOperationBaseServiceImpl).inSingletonScope();
  23. bind(FlowGroupService).toSelf().inSingletonScope();
  24. bind(FlowDocumentContribution).toDynamicValue((ctx) => ({
  25. registerDocument: (document: FlowDocument) => {
  26. document.registerLayout(ctx.container.get(VerticalFixedLayout));
  27. document.registerLayout(ctx.container.get(HorizontalFixedLayout));
  28. },
  29. }));
  30. });