Skip to content
D
Documentation

PropertyPanelService

reference
1 min readUpdated

Import it from @grafloria/angular.

Core service for managing property schemas and property values. Acts as bridge between property panel UI and diagram engine.

ts
@Injectable({ providedIn: 'root' })
export class PropertyPanelService

Properties

NameTypeDefaultDescription
propertyChanged$Observable that emits when any property changes. Can be filtered by node ID or property key.

Methods

  • registerSchema(nodeType: string, schema: PropertySchema): void — Register a property schema for a node type.
  • registerSchemaFromJSON(nodeType: string, schemaJson: string): void — Register schema from JSON string. Enables loading schemas from database or config files.
  • extendSchema( nodeType: string, parentType: string, overrides: Partial<PropertySchema> ): void — Extend an existing schema to create a specialized type. Child inherits all parent properties and can override or add new ones.
  • getSchema(nodeType: string): PropertySchema | null — Get property schema for a node type. Returns fully resolved schema (including inherited properties).
  • hasSchema(nodeType: string): boolean — Check if schema is registered for node type.
  • getAllTypes(): string[] — Get list of all registered node types.
  • unregisterSchema(nodeType: string): boolean — Unregister the schema for a node type. Since {@link registerSchema} rejects duplicates, this is the only way to replace a schema (e.g. hot-reloading schemas from a config source).
  • clearSchemas(): void — Remove all registered schemas. Useful when tearing down a diagram context or isolating test state.
  • getPropertyValue(node: PropertyDiagramNode, propertyKey: string): any — Get property value from a node. Supports nested property paths (e.g., 'style.fill.color').
  • setPropertyValue(node: PropertyDiagramNode, propertyKey: string, value: any): any — Set property value on a node. Validates value against schema before setting.
  • setPropertyValues( nodes: PropertyDiagramNode[], propertyKey: string, value: any ): string[] — Set property value on multiple nodes simultaneously. Validates once and applies to all nodes. Rolls back all changes if any validation fails.
  • validateProperty(value: any, property: PropertyDefinition): ValidationResult — Validate a property value against its definition.
  • isPropertyVisible(node: PropertyDiagramNode, property: PropertyDefinition): boolean — Check if property is visible based on condition. Evaluates condition expression against current node properties.
  • applyDefaults(node: PropertyDiagramNode, schema: PropertySchema): void — Apply default values from schema to node. Only sets properties that are currently undefined.
  • getPropertyGroups(schema: PropertySchema): Map<string, PropertyDefinition[]> — Get properties organized by groups. Properties without group go to 'General' group.
  • getPropertyChangesForNode(nodeId: string): Observable<PropertyChangeEvent> — Filter property change events by node ID.
  • getPropertyChangesForKey(propertyKey: string): Observable<PropertyChangeEvent> — Filter property change events by property key.

Was this page helpful?

PropertyPanelService — Grafloria