/** * Based on mxgraph 4.2.0. */ export declare function MxGraphFactory(opts: { /** Specifies the path in mxClient.basePath. */ mxBasePath?: string; /** Specifies the path in mxClient.imageBasePath. */ mxImageBasePath?: string; /** Specifies the language for resources in mxClient.language. */ mxLanguage?: string; /** Array of all supported language extensions. */ mxLanguages?: string[]; /** Specifies the default language in mxClient.defaultLanguage. */ mxDefaultLanguage?: string; /** Specifies if any resources should be loaded. Default is true. */ mxLoadResources?: boolean; /** Specifies if any stylesheets should be loaded. Default is true. */ mxLoadStylesheets?: boolean; /** Force loading the JavaScript files in development mode */ mxForceIncludes?: boolean; /** Specify the extension of resource files. */ mxResourceExtension?: string; }): typeof MxGraphNS; export declare module MxGraphNS { function escape(s: string): string; function unescape(s: string): string; var mxBasePath: string; var mxImageBasePath: string; var mxLanguage: string; var mxLanguages: string[]; var mxDefaultLanguage: string; var mxLoadResources: boolean; var mxLoadStylesheets: boolean; var mxForceIncludes: boolean; var mxResourceExtension: string; var mxClient: { /** * Class: mxClient * * Bootstrapping mechanism for the mxGraph thin client. The production version * of this file contains all code required to run the mxGraph thin client, as * well as global constants to identify the browser and operating system in * use. You may have to load chrome://global/content/contentAreaUtils.js in * your page to disable certain security restrictions in Mozilla. * * Variable: VERSION * * Contains the current version of the mxGraph library. The strings that * communicate versions of mxGraph use the following format. * * versionMajor.versionMinor.buildNumber.revisionNumber * * Current version is 4.0.6. */ VERSION: number; /** * Variable: IS_IE * * True if the current browser is Internet Explorer 10 or below. Use * to detect IE 11. */ IS_IE: boolean; /** * Variable: IS_IE6 * * True if the current browser is Internet Explorer 6.x. */ IS_IE6: boolean; /** * Variable: IS_IE11 * * True if the current browser is Internet Explorer 11.x. */ IS_IE11: boolean; /** * Variable: IS_EDGE * * True if the current browser is Microsoft Edge. */ IS_EDGE: boolean; /** * Variable: IS_QUIRKS * * True if the current browser is Internet Explorer and it is in quirks mode. */ IS_QUIRKS: boolean; /** * Variable: IS_EM * * True if the browser is IE11 in enterprise mode (IE8 standards mode). */ IS_EM: boolean; /** * Variable: VML_PREFIX * * Prefix for VML namespace in node names. Default is 'v'. */ VML_PREFIX: string; /** * Variable: OFFICE_PREFIX * * Prefix for VML office namespace in node names. Default is 'o'. */ OFFICE_PREFIX: string; /** * Variable: IS_NS * * True if the current browser is Netscape (including Firefox). */ IS_NS: boolean; /** * Variable: IS_OP * * True if the current browser is Opera. */ IS_OP: boolean; /** * Variable: IS_OT * * True if -o-transform is available as a CSS style, ie for Opera browsers * based on a Presto engine with version 2.5 or later. */ IS_OT: boolean; /** * Variable: IS_SF * * True if the current browser is Safari. */ IS_SF: boolean; /** * Variable: IS_IOS * * Returns true if the user agent is an iPad, iPhone or iPod. */ IS_IOS: boolean; /** * Variable: IS_GC * * True if the current browser is Google Chrome. */ IS_GC: boolean; /** * Variable: IS_CHROMEAPP * * True if the this is running inside a Chrome App. */ IS_CHROMEAPP: boolean; /** * Variable: IS_FF * * True if the current browser is Firefox. */ IS_FF: boolean; /** * Variable: IS_MT * * True if -moz-transform is available as a CSS style. This is the case * for all Firefox-based browsers newer than or equal 3, such as Camino, * Iceweasel, Seamonkey and Iceape. */ IS_MT: boolean; /** * Variable: IS_VML * * True if the browser supports VML. */ IS_VML: boolean; /** * Variable: IS_SVG * * True if the browser supports SVG. */ IS_SVG: boolean; /** * Variable: NO_FO * * True if foreignObject support is not available. This is the case for * Opera, older SVG-based browsers and all versions of IE. */ NO_FO: boolean; /** * Variable: IS_WIN * * True if the client is a Windows. */ IS_WIN: boolean; /** * Variable: IS_MAC * * True if the client is a Mac. */ IS_MAC: boolean; /** * Variable: IS_CHROMEOS * * True if the client is a Chrome OS. */ IS_CHROMEOS: boolean; /** * Variable: IS_TOUCH * * True if this device supports touchstart/-move/-end events (Apple iOS, * Android, Chromebook and Chrome Browser on touch-enabled devices). */ IS_TOUCH: boolean; /** * Variable: IS_POINTER * * True if this device supports Microsoft pointer events (always false on Macs). */ IS_POINTER: boolean; /** * Variable: IS_LOCAL * * True if the documents location does not start with http:// or https://. */ IS_LOCAL: boolean; /** * Variable: defaultBundles * * Contains the base names of the default bundles if mxLoadResources is false. */ defaultBundles: string[]; /** * Function: isBrowserSupported * * Returns true if the current browser is supported, that is, if * or is true. * * Example: * * (code) * if (!mxClient.isBrowserSupported()) * { * mxUtils.error('Browser is not supported!', 200, false); * } * (end) */ isBrowserSupported: () => boolean; /** * Function: link * * Adds a link node to the head of the document. Use this * to add a stylesheet to the page as follows: * * (code) * mxClient.link('stylesheet', filename); * (end) * * where filename is the (relative) URL of the stylesheet. The charset * is hardcoded to ISO-8859-1 and the type is text/css. * * Parameters: * * rel - String that represents the rel attribute of the link node. * href - String that represents the href attribute of the link node. * doc - Optional parent document of the link node. * id - unique id for the link element to check if it already exists */ link: (rel: string, href: string, doc?: XMLDocument, id?: string) => void; /** * Function: loadResources * * Helper method to load the default bundles if mxLoadResources is false. * * Parameters: * * fn - Function to call after all resources have been loaded. * lan - Optional string to pass to . */ loadResources: (fn: any, lan?: string) => void; /** * Function: include * * Dynamically adds a script node to the document header. * * In production environments, the includes are resolved in the mxClient.js * file to reduce the number of requests required for client startup. This * function should only be used in development environments, but not in * production systems. */ include: (src: string) => void; /** * Variable: basePath * * Basepath for all URLs in the core without trailing slash. Default is '.'. * Set mxBasePath prior to loading the mxClient library as follows to override * this setting: * * (code) * * * (end) * * When using a relative path, the path is relative to the URL of the page that * contains the assignment. Trailing slashes are automatically removed. */ basePath: string; /** * Variable: imageBasePath * * Basepath for all images URLs in the core without trailing slash. Default is * + '/images'. Set mxImageBasePath prior to loading the * mxClient library as follows to override this setting: * * (code) * * * (end) * * When using a relative path, the path is relative to the URL of the page that * contains the assignment. Trailing slashes are automatically removed. */ imageBasePath: string; /** * Variable: language * * Defines the language of the client, eg. en for english, de for german etc. * The special value 'none' will disable all built-in internationalization and * resource loading. See for handling identifiers * with and without a dash. * * Set mxLanguage prior to loading the mxClient library as follows to override * this setting: * * (code) * * * (end) * * If internationalization is disabled, then the following variables should be * overridden to reflect the current language of the system. These variables are * cleared when i18n is disabled. * , , * , , * , , , * , , * , , * , , * , , * and * . */ language: string; /** * Variable: defaultLanguage * * Defines the default language which is used in the common resource files. Any * resources for this language will only load the common resource file, but not * the language-specific resource file. Default is 'en'. * * Set mxDefaultLanguage prior to loading the mxClient library as follows to override * this setting: * * (code) * * * (end) */ defaultLanguage: string; /** * Variable: languages * * Defines the optional array of all supported language extensions. The default * language does not have to be part of this list. See * . * * (code) * * * (end) * * This is used to avoid unnecessary requests to language files, ie. if a 404 * will be returned. */ languages: string[]; }; class mxStencil { /** * Static global variable that specifies the default value for the localized * attribute of the text element. Default is false. */ static defaultLocalized: boolean; /** * Static global switch that specifies if the use of eval is allowed for * evaluating text content and images. Default is false. Set this to true * if stencils can not contain user input. */ static allowEval: boolean; /** * Holds the XML node with the stencil description. */ desc: Element; /** * Holds an array of as defined in the shape. */ constraints: mxConnectionConstraint[]; /** * Holds the aspect of the shape. Default is 'auto'. */ aspect: string; /** * Holds the width of the shape. Default is 100. */ w0: number; /** * Holds the height of the shape. Default is 100. */ h0: number; /** * Holds the XML node with the stencil description. */ bgNode: Element; /** * Holds the XML node with the stencil description. */ fgNode: Element; /** * Holds the strokewidth direction from the description. */ strokewidth: number | string; /** * Constructs a new generic shape by setting to the given XML node and * invoking and . * * @param desc XML node that contains the stencil description. */ constructor(desc: Element); /** * Reads , , , and from . */ parseDescription(): void; /** * Reads the constraints from into using * . */ parseConstraints(): void; /** * Parses the given XML node and returns its . */ parseConstraint(node: Element): mxConnectionConstraint; /** * Gets the given attribute as a text. The return value from * is used as a key to if the localized attribute in the text * node is 1 or if is true. */ evaluateTextAttribute(node: Element, attribute: string, shape: any): string; /** * Gets the attribute for the given name from the given node. If the attribute * does not exist then the text content of the node is evaluated and if it is * a function it is invoked with as the only argument and the return * value is used as the attribute value to be returned. */ evaluateAttribute(node: Element, attribute: string, shape: any): string; /** * Draws this stencil inside the given bounds. */ drawShape(canvas: any, shape: any, x: any, y: any, w: any, h: any): void; /** * Draws this stencil inside the given bounds. */ drawChildren(canvas: any, shape: any, x: any, y: any, w: any, h: any, node: any, aspect: any, disableShadow: any): void; /** * Returns a rectangle that contains the offset in x and y and the horizontal * and vertical scale in width and height used to draw this shape inside the * given . * * shape - to be drawn. * bounds - that should contain the stencil. * direction - Optional direction of the shape to be darwn. */ computeAspect(shape: any, x: any, y: any, w: any, h: any, direction: any): mxRectangle; /** * Draws this stencil inside the given bounds. */ drawNode(canvas: any, shape: any, node: any, aspect: any, disableShadow: any): void; } class mxShape { addPoints(c: any, pts?: mxPoint[], rounded?: boolean, arcSize?: number, close?: boolean, exclude?: any, initialMove?: boolean): void; getPorts(): any; /** * Holds the dialect in which the shape is to be painted. * This can be one of the DIALECT constants in . */ dialect: any; /** * Holds the scale in which the shape is being painted. */ scale: number; /** * Rendering hint for configuring the canvas. */ antiAlias: boolean; /** * Holds the that specifies the bounds of this shape. */ bounds: mxRectangle; /** * Holds the array of that specify the points of this shape. */ points: mxPoint[]; /** * Holds the outermost DOM node that represents this shape. */ node: HTMLElement | SVGElement; /** * Optional reference to the corresponding . */ state: mxCellState; /** * Optional reference to the style of the corresponding . */ style: any[]; /** * Contains the bounding box of the shape, that is, the smallest rectangle * that includes all pixels of the shape. */ boundingBox: mxRectangle; /** * Holds the that defines the shape. */ stencil: mxStencil; /** * Event-tolerance for SVG strokes (in px). Default is 8. This is only passed * to the canvas in if is true. */ svgStrokeTolerance: number; /** * Specifies if pointer events should be handled. Default is true. */ pointerEvents: boolean; /** * Specifies if pointer events should be handled. Default is true. */ svgPointerEvents: string; /** * Specifies if pointer events outside of shape should be handled. Default * is false. */ shapePointerEvents: boolean; /** * Specifies if pointer events outside of stencils should be handled. Default * is false. Set this to true for backwards compatibility with the 1.x branch. */ stencilPointerEvents: boolean; /** * Scale for improving the precision of VML rendering. Default is 1. */ vmlScale: number; /** * Specifies if the shape should be drawn as an outline. This disables all * fill colors and can be used to disable other drawing states that should * not be painted for outlines. Default is false. This should be set before * calling . */ outline: boolean; /** * Specifies if the shape is visible. Default is true. */ visible: boolean; /** * Allows to use the SVG bounding box in SVG. Default is false for performance * reasons. */ useSvgBoundingBox: boolean; /** * Implicit variable declarations */ strokewidth: number; rotation: number; opacity: number; fillOpacity: number; strokeOpacity: number; flipH: boolean; flipV: boolean; spacing: any; fill: any; gradient: any; gradientDirection: any; stroke: any; startSize: any; endSize: any; startArrow: any; endArrow: any; direction: any; isShadow: any; isDashed: any; isRounded: any; glass: any; cursor: string; constructor(stencil?: any); /** * Initializes the shape by creaing the DOM node using * and adding it into the given container. * * @param container - DOM node that will contain the shape. */ init(container: HTMLElement): void; /** * Specifies if any VML should be added via insertAdjacentHtml to the DOM. This * is only needed in IE8 and only if the shape contains VML markup. This method * returns true. */ isParseVml(): boolean; /** * Returns true if HTML is allowed for this shape. This implementation always * returns false. */ isHtmlAllowed(): boolean; /** * Returns 0, or 0.5 if % 2 == 1. */ getSvgScreenOffset(): 0 | 0.5; /** * Creates and returns the DOM node(s) for the shape in * the given container. This implementation invokes * , or depending * on the and style settings. * * @param container - DOM node that will contain the shape. */ create(container: Element): HTMLElement | SVGGElement; /** * Creates and returns the SVG node(s) to represent this shape. */ createSvg(...args: any[]): SVGGElement; /** * Creates and returns the VML node to represent this shape. */ createVml(...args: any[]): HTMLElement; /** * Creates and returns the HTML DOM node(s) to represent * this shape. This implementation falls back to * so that the HTML creation is optional. */ createHtml(...args: any[]): HTMLDivElement; /** * Reconfigures this shape. This will update the colors etc in * addition to the bounds or points. */ reconfigure(): void; /** * Creates and returns the SVG node(s) to represent this shape. */ redraw(): void; /** * Removes all child nodes and resets all CSS. */ clear(): void; /** * Updates the bounds based on the points. */ updateBoundsFromPoints(): void; /** * Returns the for the label bounds of this shape, based on the * given scaled and translated bounds of the shape. This method should not * change the rectangle in-place. This implementation returns the given rect. */ getLabelBounds(rect: any): any; /** * Returns the scaled top, left, bottom and right margin to be used for * computing the label bounds as an , where the bottom and right * margin are defined in the width and height of the rectangle, respectively. */ getLabelMargins(rect: any): any; /** * Returns true if the bounds are not null and all of its variables are numeric. */ checkBounds(): boolean; /** * Returns the temporary element used for rendering in IE8 standards mode. */ createVmlGroup(): HTMLElement; /** * Updates the SVG or VML shape. */ redrawShape(): void; /** * Creates a new canvas for drawing this shape. May return null. */ createCanvas(): mxSvgCanvas2D | mxVmlCanvas2D; /** * Creates and returns an for rendering this shape. */ createSvgCanvas(): mxSvgCanvas2D; /** * Creates and returns an for rendering this shape. */ createVmlCanvas(): any; /** * Updates the bounds of the VML container. */ updateVmlContainer(): void; /** * Allow optimization by replacing VML with HTML. */ redrawHtmlShape(): void; /** * Allow optimization by replacing VML with HTML. */ updateHtmlFilters(node: any): void; /** * Allow optimization by replacing VML with HTML. */ updateHtmlColors(node: any): void; /** * Allow optimization by replacing VML with HTML. */ updateHtmlBounds(node: any): void; /** * Destroys the given canvas which was used for drawing. This implementation * increments the reference counts on all shared gradients used in the canvas. */ destroyCanvas(canvas: any): void; /** * Generic rendering code. */ paint(c: any): void; /** * Sets the state of the canvas for drawing the shape. */ configureCanvas(c: any, x: any, y: any, w: any, h: any): void; /** * Returns the bounding box for the gradient box for this shape. */ getGradientBounds(c: any, x: any, y: any, w: any, h: any): mxRectangle; /** * Sets the scale and rotation on the given canvas. */ updateTransform(c: any, x: any, y: any, w: any, h: any): void; /** * Paints the vertex shape. */ paintVertexShape(c: mxAbstractCanvas2D, x: number, y: number, w: number, h: number): void; /** * Hook for subclassers. This implementation is empty. */ paintBackground(c: mxAbstractCanvas2D, x: number, y: number, w: number, h: number): void; /** * Hook for subclassers. This implementation is empty. */ paintForeground(c: mxAbstractCanvas2D, x: number, y: number, w: number, h: number): void; /** * Hook for subclassers. This implementation is empty. */ paintEdgeShape(c: any, pts: any): void; /** * Returns the arc size for the given dimension. */ getArcSize(w: any, h: any): number; /** * Paints the glass gradient effect. */ paintGlassEffect(c: any, x: any, y: any, w: any, h: any, arc: any): void; /** * Paints the given points with rounded corners. */ addPoints(c: any, pts: any, rounded: any, arcSize: any, close: any, exclude: any, initialMove: any): void; /** * Resets all styles. */ resetStyles(): void; /** * Applies the style of the given to the shape. This * implementation assigns the following styles to local fields: * * - => fill * - => gradient * - => gradientDirection * - => opacity * - => fillOpacity * - => strokeOpacity * - => stroke * - => strokewidth * - => isShadow * - => isDashed * - => spacing * - => startSize * - => endSize * - => isRounded * - => startArrow * - => endArrow * - => rotation * - => direction * - => glass * * This keeps a reference to the '); * }; * (end) * * Headers: * * Apart from setting the title argument in the mxPrintPreview constructor you * can override as follows to add a header to any page: * * (code) * var oldRenderPage = mxPrintPreview.prototype.renderPage; * mxPrintPreview.prototype.renderPage = function(w, h, x, y, content, pageNumber) * { * var div = oldRenderPage.apply(this, arguments); * * var header = document.createElement('div'); * header.style.position = 'absolute'; * header.style.top = '0px'; * header.style.width = '100%'; * header.style.textAlign = 'right'; * mxUtils.write(header, 'Your header here'); * div.firstChild.appendChild(header); * * return div; * }; * (end) * * The pageNumber argument contains the number of the current page, starting at * 1. To display a header on the first page only, check pageNumber and add a * vertical offset in the constructor call for the height of the header. * * Page Format: * * For landscape printing, use as * the pageFormat in and . * Keep in mind that one can not set the defaults for the print dialog * of the operating system from JavaScript so the user must manually choose * a page format that matches this setting. * * You can try passing the following CSS directive to to set the * page format in the print dialog to landscape. However, this CSS * directive seems to be ignored in most major browsers, including IE. * * (code) * @page { * size: landscape; * } * (end) * * Note that the print preview behaves differently in IE when used from the * filesystem or via HTTP so printing should always be tested via HTTP. * * If you are using a DOCTYPE in the source page you can override * and provide the same DOCTYPE for the print preview if required. Here is * an example for IE8 standards mode. * * (code) * var preview = new mxPrintPreview(graph); * preview.getDoctype = function() * { * return ''; * }; * preview.open(); * (end) * * Constructor: mxPrintPreview * * Constructs a new print preview for the given parameters. * * Parameters: * * graph - to be previewed. * scale - Optional scale of the output. Default is 1 / . * border - Border in pixels along each side of every page. Note that the * actual print function in the browser will add another border for * printing. * pageFormat - that specifies the page format (in pixels). * This should match the page format of the printer. Default uses the * of the given graph. * x0 - Optional left offset of the output. Default is 0. * y0 - Optional top offset of the output. Default is 0. * borderColor - Optional color of the page border. Default is no border. * Note that a border is sometimes useful to highlight the printed page * border in the print preview of the browser. * title - Optional string that is used for the window title. Default * is 'Printer-friendly version'. * pageSelector - Optional boolean that specifies if the page selector * should appear in the window with the print preview. Default is true. */ class mxPrintPreview { printOverlays: boolean; printControls: boolean; printBackgroundImage: boolean; constructor(graph: any, scale?: any, pageFormat?: any, border?: any, x0?: any, y0?: any, borderColor?: any, title?: any, pageSelector?: any); /** * Returns . */ getWindow(): any; /** * Returns the string that should go before the HTML tag in the print preview * page. This implementation returns an X-UA meta tag for IE5 in quirks mode, * IE8 in IE8 standards mode and edge in IE9 standards mode. */ getDoctype(): string; /** * Adds the given graph to the existing print preview. * * Parameters: * * css - Optional CSS string to be used in the head section. * targetWindow - Optional window that should be used for rendering. If * this is specified then no HEAD tag, CSS and BODY tag will be written. */ appendGraph(graph: any, scale: any, x0: any, y0: any, forcePageBreaks: any, keepOpen: any): void; /** * Shows the print preview window. The window is created here if it does * not exist. * * Parameters: * * css - Optional CSS string to be used in the head section. * targetWindow - Optional window that should be used for rendering. If * this is specified then no HEAD tag, CSS and BODY tag will be written. */ open(css?: any, targetWindow?: any, forcePageBreaks?: any, keepOpen?: any): any; /** * Adds a page break to the given document. */ addPageBreak(doc: any): void; /** * Writes the closing tags for body and page after calling . */ closeDocument(): void; /** * Writes the HEAD section into the given document, without the opening * and closing HEAD tags. */ writeHead(doc: any, css: any): void; /** * Called before closing the body of the page. This implementation is empty. */ writePostfix(doc: any): void; /** * Creates the page selector table. */ createPageSelector(vpages: any, hpages: any): any; /** * Creates a DIV that prints a single page of the given * graph using the given scale and returns the DIV that * represents the page. * * Parameters: * * w - Width of the page in pixels. * h - Height of the page in pixels. * dx - Optional horizontal page offset in pixels (used internally). * dy - Optional vertical page offset in pixels (used internally). * content - Callback that adds the HTML content to the inner div of a page. * Takes the inner div as the argument. * pageNumber - Integer representing the page number. */ renderPage(w: any, h: any, dx: any, dy: any, content: any, pageNumber: any): HTMLDivElement; /** * Returns the root cell for painting the graph. */ getRoot(): any; /** * Adds a graph fragment to the given div. * * Parameters: * * dx - Horizontal translation for the diagram. * dy - Vertical translation for the diagram. * scale - Scale for the diagram. * pageNumber - Number of the page to be rendered. * div - Div that contains the output. * clip - Contains the clipping rectangle as an . */ addGraphFragment(dx: any, dy: any, scale: any, pageNumber: any, div: any, clip: any): void; /** * Returns the link for the given cell state. This returns null. */ getLinkForCellState(state: any): any; /** * Inserts the background image into the given div. */ insertBackgroundImage(div: any, dx: any, dy: any): void; /** * Returns the pages to be added before the print output. This returns null. */ getCoverPages(): any; /** * Returns the pages to be added after the print output. This returns null. */ getAppendices(): any; /** * Opens the print preview and shows the print dialog. * * Parameters: * * css - Optional CSS string to be used in the head section. */ print(css: any): void; /** * Closes the print preview window. */ close(): void; } /** * Defines the appearance of the cells in a graph. See for an * example of creating a new cell style. It is recommended to use objects, not * arrays for holding cell styles. Existing styles can be cloned using * and turned into a string for debugging using * . * * Default Styles: * * The stylesheet contains two built-in styles, which are used if no style is * defined for a cell: * * defaultVertex - Default style for vertices * defaultEdge - Default style for edges * * Example: * * (code) * var vertexStyle = stylesheet.getDefaultVertexStyle(); * vertexStyle[mxConstants.ROUNDED] = true; * var edgeStyle = stylesheet.getDefaultEdgeStyle(); * edgeStyle[mxConstants.STYLE_EDGE] = mxEdgeStyle.EntityRelation; * (end) * * Modifies the built-in default styles. * * To avoid the default style for a cell, add a leading semicolon * to the style definition, eg. * * (code) * ;shadow=1 * (end) * * Removing keys: * * For removing a key in a cell style of the form [stylename;|key=value;] the * special value none can be used, eg. highlight;fillColor=none * * See also the helper methods in mxUtils to modify strings of this format, * namely , , * , , * and . * * Constructor: mxStylesheet * * Constructs a new stylesheet and assigns default styles. */ class mxStylesheet { constructor(); /** * Creates and returns the default vertex style. */ createDefaultVertexStyle(): Object; /** * Creates and returns the default edge style. */ createDefaultEdgeStyle(): Object; /** * Sets the default style for vertices using defaultVertex as the * stylename. * * Parameters: * style - Key, value pairs that define the style. */ putDefaultVertexStyle(style: any): void; /** * Sets the default style for edges using defaultEdge as the stylename. */ putDefaultEdgeStyle(style: any): void; /** * Returns the default style for vertices. */ getDefaultVertexStyle(): any; /** * Sets the default style for edges. */ getDefaultEdgeStyle(): any; /** * Stores the given map of key, value pairs under the given name in * . * * Example: * * The following example adds a new style called 'rounded' into an * existing stylesheet: * * (code) * var style = new Object(); * style[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_RECTANGLE; * style[mxConstants.STYLE_PERIMETER] = mxPerimeter.RectanglePerimeter; * style[mxConstants.STYLE_ROUNDED] = true; * graph.getStylesheet().putCellStyle('rounded', style); * (end) * * In the above example, the new style is an object. The possible keys of * the object are all the constants in that start with STYLE * and the values are either JavaScript objects, such as * (which is in fact a function) * or expressions, such as true. Note that not all keys will be * interpreted by all shapes (eg. the line shape ignores the fill color). * The final call to this method associates the style with a name in the * stylesheet. The style is used in a cell with the following code: * * (code) * model.setStyle(cell, 'rounded'); * (end) * * Parameters: * * name - Name for the style to be stored. * style - Key, value pairs that define the style. */ putCellStyle(name: any, style: any): void; /** * Returns the cell style for the specified stylename or the given * defaultStyle if no style can be found for the given stylename. * * Parameters: * * name - String of the form [(stylename|key=value);] that represents the * style. * defaultStyle - Default style to be returned if no style can be found. */ getCellStyle(name: any, defaultStyle: any): any; } /** * Represents the current state of a cell in a given . * * For edges, the edge label position is stored in . * * The size for oversize labels can be retrieved using the boundingBox property * of the field as shown below. * * @example * var bbox = (state.text != null) ? state.text.boundingBox : null; */ class mxCellState extends mxRectangle { /** * Reference to the enclosing . */ view: mxGraphView; /** * Reference to the that is represented by this state. */ cell: mxCell; /** * Contains an array of key, value pairs that represent the style of the * cell. */ style: any; /** * Specifies if the state is invalid. Default is true. */ invalid: boolean; /** * that holds the origin for all child cells. Default is a new * empty . */ origin: mxPoint; /** * Holds an array of that represent the absolute points of an * edge. */ absolutePoints: mxPoint[]; /** * that holds the absolute offset. For edges, this is the * absolute coordinates of the label position. For vertices, this is the * offset of the label relative to the top, left corner of the vertex. */ absoluteOffset: mxPoint; /** * Caches the visible source terminal state. */ visibleSourceState: any; /** * Caches the visible target terminal state. */ visibleTargetState: any; /** * Caches the distance between the end points for an edge. */ terminalDistance: number; /** * Caches the length of an edge. */ length: number; /** * Array of numbers that represent the cached length of each segment of the * edge. */ segments: number[]; /** * Holds the that represents the cell graphically. */ shape: mxShape; /** * Holds the that represents the label of the cell. Thi smay be * null if the cell has no label. */ text: mxText; /** * Holds the unscaled width of the state. */ unscaledWidth: any; /** * Implicit variable declarations */ cellBounds: mxRectangle; paintBounds: mxRectangle; /** * Constructs a new object that represents the current state of the given * cell in the specified view. * * @param view - that contains the state. * @param cell - that this state represents. * @param style - Array of key, value pairs that constitute the style. */ constructor(view: mxGraphView, cell: mxCell, style: any[]); /** * Returns the that should be used as the perimeter of the * cell. * * @param border - Optional border to be added around the perimeter bounds. * @param bounds - Optional to be used as the initial bounds. */ getPerimeterBounds(border?: number, bounds?: mxRectangle): mxRectangle; /** * Sets the first or last point in depending on isSource. * * @param point - that represents the terminal point. * @param isSource - Boolean that specifies if the first or last point should * be assigned. */ setAbsoluteTerminalPoint(point: mxPoint, isSource: boolean): void; /** * Sets the given cursor on the shape and text shape. */ setCursor(cursor: any): void; /** * Returns the visible source or target terminal cell. * * @param source - Boolean that specifies if the source or target cell should be * returned. */ getVisibleTerminal(source: boolean): any; /** * Returns the visible source or target terminal state. * * @param source - Boolean that specifies if the source or target state should be * returned. */ getVisibleTerminalState(source: boolean): any; /** * Sets the visible source or target terminal state. * * @param terminalState - that represents the terminal. * @param source - Boolean that specifies if the source or target state should be set. */ setVisibleTerminalState(terminalState: mxCellState, source: boolean): void; /** * Returns the unscaled, untranslated bounds. */ getCellBounds(): mxRectangle; /** * Returns the unscaled, untranslated paint bounds. This is the same as * but with a 90 degree rotation if the shape's * isPaintBoundsInverted returns true. */ getPaintBounds(): mxRectangle; /** * Updates the cellBounds and paintBounds. */ updateCachedBounds(): void; /** * Destructor: setState * * Copies all fields from the given state to this state. */ setState(state: mxCellState): void; /** * Returns a clone of this . */ clone(): mxCellState; /** * Destructor: destroy * * Destroys the state and all associated resources. */ destroy(): void; } /** * Implements the selection model for a graph. Here is a listener that handles * all removed selection cells. * * (code) * graph.getSelectionModel().addListener(mxEvent.CHANGE, function(sender, evt) * { * var cells = evt.getProperty('added'); * * for (var i = 0; i < cells.length; i++) * { * // Handle cells[i]... * } * }); * (end) * * Event: mxEvent.UNDO * * Fires after the selection was changed in . The * edit property contains the which contains the * . * * Event: mxEvent.CHANGE * * Fires after the selection changes by executing an . The * added and removed properties contain arrays of * cells that have been added to or removed from the selection, respectively. * The names are inverted due to historic reasons. This cannot be changed. */ class mxGraphSelectionModel extends mxEventSource { /** * Specifies the resource key for the status message after a long operation. * If the resource for this key does not exist then the value is used as * the status message. Default is 'done'. */ doneResource: string; /** * Specifies the resource key for the status message while the selection is * being updated. If the resource for this key does not exist then the * value is used as the status message. Default is 'updatingSelection'. */ updatingSelectionResource: string; /** * Reference to the enclosing . */ graph: mxGraph; /** * Specifies if only one selected item at a time is allowed. * Default is false. */ singleSelection: boolean; /** * Implicit variable declarations */ cells: mxCell[]; /** * Constructs a new graph selection model for the given . * * @param graph - Reference to the enclosing . */ constructor(graph: mxGraph); /** * Returns as a boolean. */ isSingleSelection(): boolean; /** * Sets the flag. * * @param singleSelection - Boolean that specifies the new value for * . */ setSingleSelection(singleSelection: boolean): void; /** * Returns true if the given is selected. */ isSelected(cell: mxCell): boolean; /** * Returns true if no cells are currently selected. */ isEmpty(): boolean; /** * Clears the selection and fires a event if the selection was not * empty. */ clear(): void; /** * Selects the specified using . * * @param cell - to be selected. */ setCell(cell: mxCell): void; /** * Selects the given array of and fires a event. * * @param cells - Array of to be selected. */ setCells(cells: mxCell[]): void; /** * Returns the first selectable cell in the given array of cells. */ getFirstSelectableCell(cells: mxCell[]): mxCell; /** * Adds the given to the selection and fires a * event. * * @param cells - Array of to add to the selection. */ addCells(cells: mxCell[]): void; /** * Removes the specified from the selection and fires a