Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EditorComponent

Provides a full-featured Diazo editor, including a searchable New Node list and a powerful property sheet implementation.

<dz-editor [graph]="myGraph" [availableNodes]="myDefinedNodes"></dz-editor>

Here,

  • [graph] is the graph that should be rendered. Any changes made by the user will be applied to the bound object.
  • [availableNodes] is an array of {@linkcode DiazoNode} objects made available to the user in the New Node menu

See More

  • {@linkcode DiazoGraph} - Represents a graph, composed of its nodes and edges
  • {@linkcode DiazoValueType} - Edges are "values", and their types are represented by "value types"
  • {@linkcode DiazoContext} - Most useful instrumentation of the Diazo editor is done via the Context layer

Hierarchy

  • EditorComponent

Index

Properties

active

active: boolean = undefined

When true, the edges of the graph will be rendered with a flow animation. Use this to indicate that the graph is currently "running".

container

container: GraphComponent

Provides access to the underlying component which implements the Diazo renderer.

contextChanged

contextChanged: Subject<DiazoContext> = new Subject<DiazoContext>()

Fired when the DiazoContext has been acquired from the underlying Diazo component. DiazoContext represents the operating state (model) of the Diazo editor.

customPropertyTypes

customPropertyTypes: DiazoCustomPropertyType[] = []

Specify a set of custom components that will be used to render specific types of properties. Each custom property type specifies a "namespace" and an "id". You use this custom type in the properties declaration on a node (or via universalPropertySets) by specifying property.type = "namespace:id" (for example).

graphChanged

graphChanged: Subject<DiazoGraph> = new Subject<DiazoGraph>()

Fired when the graph has been changed by the user. More technically this is fired when a change transaction is "committed" to the Diazo Context. These change transactions underpin Diazo's support for Undo/Redo.

graphContext

graphContext: DiazoContext

Stores the current graph context object. This represents the state logic for the graph being edited within the Diazo editor

locked

locked: boolean = false

If true, the Diazo editor will allow no changes to the graph whatsoever. When this is true, readonly is also considered to be true. The difference between locked and readonly is mainly that the nodes cannot be moved around by the user.

matchingNodeSets

matchingNodeSets: DiazoNodeSet[]

Provides the NodeSets which are currently visible in the New Node menu, subject to the search query entered by the user.

matchingNodes

matchingNodes: DiazoNode[]

Provides the Nodes which are currently visible in the New Node menu, subject to the search query entered by the user. This is a flattening of the nodes found in matchingNodeSets.

newNodePosition

newNodePosition: Position

nodeMenuKeyboardMode

nodeMenuKeyboardMode: boolean = false

When true, the Node Menu is in keyboard mode, and certain keystrokes (up/down/enter) can be used to select and insert a node visible in the menu, This works in concert with matchingNodes.

nodeMenuPosition

nodeMenuPosition: Position

nodeTypeMap

nodeTypeMap: Record<string, any>

Specify a set of custom components that will be used to render specific types of nodes. The key of this map should match the "$.type" property of a node you wish to use a custom component with. The value is the Angular component class.

The custom component can inject the DiazoNodeContext instance in order to interact with the node state.

optionSources

optionSources: Record<string, Record<string, DiazoPropertyOptionGroup[]>>

Allows the consumer to specify dynamic option sources for use with properties of type "select". Since properties are static declarations, it is generally not possible to dynamically populate the options of a "select" property. The "optionSources" system provides a good way to do this. To use it, define a property such as {type: "select", optionSource: "mySource"} and specify "optionSources" as { mySource: { option1: "Option 1", option2: "Option 2"}}. The Diazo editor will automatically populate these options into the select box in the Properties panel.

propertyManipulator

propertyManipulator: any

A proxy object which is capable of getting or setting property values across the nodes that are currently selected in the editor. The keys of this object are interpreted as either JSONPath (when the key starts with '$') or Diazo's custom object path format (otherwise).

providers

providers: Provider[] = []

Allows the consumer to pass in a set of dependency injection providers which will be used whenever a custom property editor or custom node is created. Use this to pass in services needed by your custom controls.

readonly

readonly: boolean = false

If true, the Diazo editor will be placed in Read Only mode. The user can still move nodes around, but new nodes cannot be created, existing nodes cannot be removed, and edges cannot be changed.

saveRequested

saveRequested: Subject<void> = new Subject<void>()

Bind to this event to receive Save events from the user (Diazo Editor does not do anything special with a Save request by default, that is up to the consumer). This fires when the user presses Ctrl+S / Cmd+S.

selectedMatchingNodeIndex

selectedMatchingNodeIndex: number = 0

The index of a node in the New Node menu that the user has selected via Keyboard Mode.

selectedNodeContext

selectedNodeContext: DiazoNodeContext

Get the currently selected node context (the first one if multiple nodes are currently selected)

selectedNodeContexts

selectedNodeContexts: DiazoNodeContext[] = []

Get the currently selected node-contexts

selectedPropertySets

selectedPropertySets: DiazoPropertySet[] = []

Provides the PropertySets which are currently visible subject to the search query entered by the user.

universalPropertySets

universalPropertySets: DiazoPropertySet[] = []

Specify an array of PropertySets which will be shown for all nodes that exist in the graph. These PropertySets will be shown after the ones defined on the node itself.

valueTypes

valueTypes: { constructor: any }[] = []

Specify a set of "value types" which are used to declare the types of edges that can be created within the graph. The value type system supports compatibility by class heirarchy by default, and custom value type classes can even redefine the notion of compatibility however they want. Compatibility here refers to whether a slot with one "value" is allowed to be connected to a slot with another "value".

Value types also define the color and appearance of the edge when rendered within Diazo.

Accessors

availableNodes

  • get availableNodes(): DiazoNodeSet[]
  • set availableNodes(value: DiazoNodeSet[]): void
  • Allows the consumer to pass in the set of nodes that will be available for the user to add to the graph via the New Node menu (right click).

    Returns DiazoNodeSet[]

  • Allows the consumer to pass in the set of nodes that will be available for the user to add to the graph via the New Node menu (right click).

    Parameters

    • value: DiazoNodeSet[]

    Returns void

graph

  • get graph(): DiazoGraph
  • set graph(value: DiazoGraph): void
  • Specify the Diazo object that this editor should work with. The object is passed by reference here, and the object will be modified by the Diazo editor in place. Note that you can also receive immutable snapshots of the graph via the graphChanged event.

    Returns DiazoGraph

  • Specify the Diazo object that this editor should work with. The object is passed by reference here, and the object will be modified by the Diazo editor in place. Note that you can also receive immutable snapshots of the graph via the graphChanged event.

    Parameters

    • value: DiazoGraph

    Returns void

nodeSearch

  • get nodeSearch(): string
  • set nodeSearch(value: string): void

propertySearch

  • get propertySearch(): string
  • set propertySearch(value: string): void

selectedNode

  • get selectedNode(): DiazoNode

selectedNodes

  • get selectedNodes(): DiazoNode[]

selectionReadOnly

  • get selectionReadOnly(): boolean
  • This is true if the selection of nodes is considered "readonly". The selection is considered readonly if any selected node is marked as "readonly".

    Returns boolean

showProperties

  • get showProperties(): boolean
  • set showProperties(value: boolean): void
  • True when the user has made the Properties sidebar visible. False when the user has hidden it. This also has special behavior if the user has not yet shown/hidden the sidebar -- if the screen size is small enough to be considered "mobile", then this will return false. Otherwise it will be true.

    Returns boolean

  • True when the user has made the Properties sidebar visible. False when the user has hidden it. This also has special behavior if the user has not yet shown/hidden the sidebar -- if the screen size is small enough to be considered "mobile", then this will return false. Otherwise it will be true.

    Parameters

    • value: boolean

    Returns void

Methods

hideNodeMenu

  • hideNodeMenu(): void

showNodeMenu

  • showNodeMenu(): void

Object literals

jsonMonacoOptions

jsonMonacoOptions: object

Options used for Monaco when editing JSON.

automaticLayout

automaticLayout: boolean = true

language

language: string = "json"

theme

theme: string = "vs-dark"

markdownMonacoOptions

markdownMonacoOptions: object

Options used for Monaco when editing Markdown.

automaticLayout

automaticLayout: boolean = true

language

language: string = "markdown"

theme

theme: string = "vs-dark"

tsMonacoOptions

tsMonacoOptions: object

Options used for Monaco when editing TypeScript.

automaticLayout

automaticLayout: boolean = true

language

language: string = "typescript"

theme

theme: string = "vs-dark"

Generated using TypeDoc