vasko-retejs-angular-render-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Angular Render Plugin (copy)

Current plugin is basen on https://github.com/retejs/angular-render-plugin

Rete.js plugin

import { AngularRenderPlugin } from 'rete-angular-render-plugin';

editor.use(AngularRenderPlugin);

Import ReteModule

import { ReteModule } from 'rete-angular-render-plugin';

@NgModule({
  imports: [ReteModule]
})
export class AppModule {}

Examples

Control

import { AngularControl } from 'rete-angular-render-plugin';

export class NumControl extends Control implements AngularControl {
  component: Type<ControlComponent>
  props: {[key: string]: unknown}
  
  constructor(key) {
    super(key);
    
    this.component = ControlComponent;
    this.props = // key-value
// ...

Custom node

Extend node component

import { Component, ChangeDetectorRef } from "@angular/core";
import { NodeComponent, NodeService } from 'rete-angular-render-plugin';

@Component({
  templateUrl: './node.component.html', // copy template from src/node
  styleUrls: ['./node.component.sass'], // copy styles from src/node
  providers: [NodeService]
})
export class MyNodeComponent extends NodeComponent {
  constructor(protected service: NodeService, protected cdr: ChangeDetectorRef) {
    super(service, cdr);
  }
}

Add component to entryComponents of your module

@NgModule({
  entryComponents: [MyNodeComponent]
})
export class AppModule {}

Custom component for all nodes

editor.use(AngularRenderPlugin, { component: MyNodeComponent });

Custom component for specific node

import { Component } from 'rete';
import { AngularComponent, AngularComponentData } from 'rete-angular-render-plugin';

export class AddComponent extends Component implements AngularComponent {
  data: AngularComponentData;

  constructor() {
    super('Add');
    this.data.render = 'angular';
    this.data.component = MyNodeComponent;
  }
// ...

Package Sidebar

Install

npm i vasko-retejs-angular-render-plugin

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

104 kB

Total Files

29

Last publish

Collaborators

  • vasakorol