import { Point } from '../../util/canvas-util'; import { HorizontalAlign, Side, VerticalAlign } from '../../util/svg-util'; import { CollabTimestamp } from '../collab/primitives'; import { FieldConfig } from '../config/diagram-config'; import { FieldLook, FieldLookConfig } from '../config/diagram-look-config'; import { DiagramElement, DiagramElementSet } from './diagram-element'; import { DiagramModel } from './diagram-model'; /** * Default values of the parameters of a diagram field. * @private * @see DiagramField */ export declare const DIAGRAM_FIELD_DEFAULTS: { editable: boolean; margin: number; padding: number; horizontalAlign: HorizontalAlign; verticalAlign: VerticalAlign; orientation: Side; multiline: boolean; fit: boolean; shrink: boolean; look: { fillColor: string; fontColor: string; fontFamily: string; fontSize: number; fontWeight: number; }; }; export interface LabeledElement { label?: DiagramField; } /** * A field which displays text and is part of a diagram element. * @public * @see DiagramNode * @see DiagramPort * @see DiagramSection */ export declare class DiagramField extends DiagramElement { #private; /** * Element that this field belongs to. * @public */ rootElement?: LabeledElement & DiagramElement; /** * Coordinates of this field. * @public */ coords: Point; /** * Dimension of this field along the x axis. * @public */ width: number; /** * Dimension of this field along the y axis. * @public */ height: number; /** * Horizontal alignment of the text of this field. * @public */ horizontalAlign: HorizontalAlign; /** * Vertical alignment of the text of this field. * @public */ verticalAlign: VerticalAlign; /** * Orientation of the text of this field. * @public */ orientation: number; /** * Whether this field can have multiple lines. * @public */ multiline: boolean; /** * Default text that this field's text resets to when empty. * @public */ defaultText: string; /** * Text contents of this field. * @public */ get text(): string; set text(value: string | undefined | null); /** * Collaborative timestamp for text. * @public */ textTimestamp: CollabTimestamp | null; /** * Whether this field's text can be edited by the user. * @public */ editable: boolean; /** * Whether this field's size can adapt to the size of the text. * @public */ fit: boolean; /** * Whether when `fit` is enabled should the root element of the field also shrink if there is excess space. * @public */ shrink: boolean; private defaultLook; private selectedLook; private highlightedLook; private selectedAndHighlightedLook; /** * Current look of this field. * @private */ get look(): FieldLook; constructor(model: DiagramModel, rootElement: (LabeledElement & DiagramElement) | undefined, coords: Point, width: number, height: number, horizontalAlign: HorizontalAlign, verticalAlign: VerticalAlign, orientation: Side | number, multiline: boolean, look: FieldLookConfig, text: string, editable: boolean, fit: boolean, shrink: boolean); get removed(): boolean; updateInView(): void; raise(): void; /** * Change the coordinates of this field to the given coordinates. * @public * @param coords A point in the diagram. */ move(coords: Point): void; getPriority(): number; } export declare class DiagramFieldSet extends DiagramElementSet { #private; /** * Instance a set of fields for the given model. This method is used internally. * @private */ constructor(model: DiagramModel); /** * Instance a new field and add it to this set. This method is normally called when instancing an element with a field and it is rarely called by itself. * @private */ new(rootElement: (LabeledElement & DiagramElement) | undefined, coords: Point, width: number, height: number, horizontalAlign: HorizontalAlign, verticalAlign: VerticalAlign, orientation: Side | number, multiline: boolean, look: FieldLookConfig, text: string, editable: boolean, fit: boolean, shrink: boolean): DiagramField; remove(id: string): void; } export declare const getBottomMargin: (config?: FieldConfig | null) => number; export declare const getLeftMargin: (config?: FieldConfig | null) => number; export declare const getRightMargin: (config?: FieldConfig | null) => number; export declare const getTopMargin: (config?: FieldConfig | null) => number; export declare const getBottomPadding: (config?: FieldConfig | null) => number; export declare const getLeftPadding: (config?: FieldConfig | null) => number; export declare const getRightPadding: (config?: FieldConfig | null) => number; export declare const getTopPadding: (config?: FieldConfig | null) => number;