import { Point } from '../../util/canvas-util'; import { Side } from '../../util/svg-util'; import { FieldConfig, PortConfig, SectionConfig, SectionGridConfig } from '../config/diagram-config'; import { ImageLookConfig, ShapedLookConfig, StretchableImageLookConfig } from '../config/diagram-look-config'; import { DiagramConnection } from './diagram-connection'; import { DiagramDecorator } from './diagram-decorator'; import { DiagramElement, DiagramElementSet } from './diagram-element'; import { DiagramField, LabeledElement } from './diagram-field'; import { DiagramModel } from './diagram-model'; import { DiagramNode, NodeLook } from './diagram-node'; import { DiagramPort } from './diagram-port'; import { DiagramResizer } from './diagram-resizer'; /** * Default value of the default width of a diagram section. * @private * @see DiagramSection */ export declare const DIAGRAM_SECTION_DEFAULT_WIDTH = 1; /** * Default value of the default height of a diagram section. * @private * @see DiagramSection */ export declare const DIAGRAM_SECTION_DEFAULT_HEIGHT = 1; /** * Default value of the minimum width of a diagram section. * @private * @see DiagramSection */ export declare const DIAGRAM_SECTION_MIN_WIDTH = 1; /** * Default value of the minimum height of a diagram section. * @private * @see DiagramSection */ export declare const DIAGRAM_SECTION_MIN_HEIGHT = 1; export type DiagramSectionGeometry = { readonly coords: Point; readonly width: number; readonly height: number; }; /** * A grid of sections which a node has. * @public * @see DiagramNode * @see SectionGridConfig */ export declare class DiagramSectionGrid { defaultWidths: number[] | null; defaultHeights: number[] | null; minWidths: number[] | null; minHeights: number[] | null; margin: number; sections: DiagramSectionType[][]; constructor(options: SectionGridConfig); } export declare class DiagramSectionType { label: FieldConfig | null; ports: PortConfig[]; defaultLook: NodeLook; selectedLook: NodeLook; highlightedLook: NodeLook; selectedAndHighlightedLook: NodeLook; priority: number; resizerX: DiagramResizer | undefined; resizerY: DiagramResizer | undefined; resizerXY: DiagramResizer | undefined; constructor(options: SectionConfig); } /** * A section of a node which can have connections and display a property of the node. * @public * @see DiagramConnection * @see DiagramNode * @see DiagramPort */ export declare class DiagramSection extends DiagramElement implements LabeledElement { /** * Node that this section belongs to. * @public */ node?: DiagramNode; /** * X index of this section in the parent node's section array. */ indexXInNode: number; /** * Y index of this section in the parent node's section array. */ indexYInNode: number; /** * Label of this section. * @public */ label?: DiagramField; /** * Ports of this section. * @public */ ports: DiagramPort[]; /** * Decorators of this section. * @public */ decorators: DiagramDecorator[]; /** * Coordinates of the top left corner of this section. * @public */ coords: Point; /** * Dimension of this section along the x axis. * @public */ width: number; /** * Dimension of this section along the y axis. * @public */ height: number; /** * Name of this section. Alias for this section's label's text. * @public */ get name(): string; set name(name: string); private _lookConfig?; private _defaultLook?; private _selectedLook?; private _highlightedLook?; private _selectedAndHighlightedLook?; /** * Current look of this port. * @private */ get look(): NodeLook; /** * An alias for the `lookConfig` attribute. * @private */ set look(look: ShapedLookConfig | ImageLookConfig | StretchableImageLookConfig | undefined); /** * Look configuration used to derive the current look of this section. * @private */ get lookConfig(): ShapedLookConfig | ImageLookConfig | StretchableImageLookConfig | undefined; /** * Sets the look configuration of the look to override the one determined by the type. * `undefined` resets it to the one determined by the type. * @private */ set lookConfig(lookConfig: ShapedLookConfig | ImageLookConfig | StretchableImageLookConfig | undefined); constructor(model: DiagramModel, node: DiagramNode | undefined, indexXInNode: number, indexYInNode: number, coords: Point, width: number, height: number, id: string); get removed(): boolean; updateInView(): void; raise(): void; get type(): DiagramSectionType | undefined; getMinWidth(): number; getMinHeight(): number; getPriority(): number; /** * Returns the horizontal resizer of this section. * @public */ getResizerX(): DiagramResizer; /** * Returns the vertical resizer of this section. * @public */ getResizerY(): DiagramResizer; /** * Returns the diagonal resizer of this section. * @public */ getResizerXY(): DiagramResizer; /** * Returns whether this section can be resized horizontally. * If the section has a specific resizableX setting, it uses that. * Otherwise, it inherits from the parent node's resizableX setting. * @public */ getResizableX(): boolean; /** * Returns whether this section can be resized vertically. * If the section has a specific resizableY setting, it uses that. * Otherwise, it inherits from the parent node's resizableY setting. * @public */ getResizableY(): boolean; /** * Returns whether this section can be resized diagonally. * If the section has a specific resizableXY setting, it uses that. * Otherwise, it inherits from the parent node's resizableXY setting. * @public */ getResizableXY(): boolean; /** * Get the port of this section which is closest to the given coordinates. * @param coords A point in the diagram. * @returns The port of this section closest to the given coordinates, `undefined` if this section has no ports. */ getClosestPortToPoint(coords: Point): DiagramPort | undefined; /** * Get all incoming connections of all ports of this section. * @public * @returns A list of connections. */ getIncomingConnections(includeRemoved?: boolean): DiagramConnection[]; /** * Get all outgoing connections of all ports of this section. * @public * @returns A list of connections. */ getOutgoingConnections(includeRemoved?: boolean): DiagramConnection[]; /** * Get all connections of all ports of this section. * @public * @returns A list of connections. */ getConnections(includeRemoved?: boolean): DiagramConnection[]; /** * Change the coordinates of this section to the given coordinates and move its ports and labels correspondingly. * @public * @param coords A point in the diagram. */ move(coords: Point): void; /** * Change the dimensions of this section in the given direction by the given amount. * @public * @param direction A direction. * @param distance A distance. */ stretch(direction: Side, distance: number): void; /** * Returns the current values of all geometric properties (coordinates and dimensions) of this section. * @public */ getGeometry(): DiagramSectionGeometry; /** * Sets all geometric properties (coordinates and dimensions) of this section. * @public */ setGeometry(geometry: DiagramSectionGeometry): void; } export declare class DiagramSectionSet extends DiagramElementSet { #private; /** * Instance a set of sections for the given model. This method is used internally. * @private */ constructor(model: DiagramModel); /** * Instance a new section and add it to this set. This method is normally called when instancing an element with a section and it is rarely called by itself. * @private */ new(node: DiagramNode, indexXInNode: number, indexYInNode: number, coords: Point, width: number, height: number, id: string): DiagramSection; remove(id: string): void; }