fixed import and init errors

development
mcyph 2021-03-21 17:06:10 +11:00
parent 48097e7892
commit 4e8e71de7d
29 changed files with 711 additions and 611 deletions

View File

@ -3,6 +3,10 @@
* Copyright (c) 2006-2015, Gaudenz Alder
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxEventSource from "../util/mxEventSource";
import mxConstants from "../util/mxConstants";
import mxCellHighlight from "./mxCellHighlight";
import mxEventObject from "../util/mxEventObject";
class mxCellMarker extends mxEventSource {
/**
@ -261,7 +265,7 @@ class mxCellMarker extends mxEventSource {
this.validState = null;
}
if (state != this.markedState || color != this.currentColor) {
if (state !== this.markedState || color !== this.currentColor) {
this.currentColor = color;
if (state != null && this.currentColor != null) {

View File

@ -6,7 +6,7 @@
import mxCellMarker from "./mxCellMarker";
import mxPoint from "../util/mxPoint";
import mxConstants from "../util/mxConstants";
import mxUtils from "../examples/map-background/leaflet";
import mxUtils from "../util/mxUtils";
import mxImageShape from "../shape/mxImageShape";
import mxRectangleShape from "../shape/mxRectangleShape";
import mxConnectionConstraint from "../view/mxConnectionConstraint";

View File

@ -3,6 +3,7 @@
* Copyright (c) 2006-2015, Gaudenz Alder
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxEdgeHandler from "./mxEdgeHandler";
class mxElbowEdgeHandler extends mxEdgeHandler {
/**

View File

@ -3,6 +3,9 @@
* Copyright (c) 2006-2015, Gaudenz Alder
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxEventSource from "../util/mxEventSource";
import mxDictionary from "../util/mxDictionary";
import mxEventObject from "../util/mxEventObject";
class mxSelectionCellsHandler extends mxEventSource {
/**

View File

@ -4,6 +4,11 @@
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxEventSource from "../util/mxEventSource";
import mxUndoableEdit from "../util/mxUndoableEdit";
import mxCellPath from "./mxCellPath";
import mxDictionary from "../util/mxDictionary";
import mxObjectIdentity from "../util/mxObjectIdentity";
import mxCell from "./mxCell";
class mxGraphModel extends mxEventSource {
/**

View File

@ -2,6 +2,8 @@
* Copyright (c) 2006-2017, JGraph Ltd
* Copyright (c) 2006-2017, Gaudenz Alder
*/
import mxResources from "./util/mxResources";
let mxClient = {
/**
* Class: mxClient
@ -23,19 +25,247 @@ let mxClient = {
*/
VERSION: '4.2.2',
/**
* Variable: mxResourceExtension
*
* Optional global config variable to specify the extension of resource files.
* Default is true. NOTE: This is a global variable, not a variable of mxClient.
*
* (code)
* <script type="text/javascript">
* let mxResourceExtension = '.txt';
* </script>
* <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script>
* (end)
*/
mxResourceExtension: '.txt',
setResourceExtension: (value) => {
mxClient.mxResourceExtension = value;
mxResources.extension = value;
},
/**
* Variable: mxLoadResources
*
* Optional global config variable to toggle loading of the two resource files
* in <mxGraph> and <mxEditor>. Default is true. NOTE: This is a global variable,
* not a variable of mxClient. If this is false, you can use <mxClient.loadResources>
* with its callback to load the default bundles asynchronously.
*
* (code)
* <script type="text/javascript">
* let mxLoadResources = false;
* </script>
* <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script>
* (end)
*/
mxLoadResources: true,
setLoadResources: (value) => {},
/**
* Variable: mxForceIncludes
*
* Optional global config variable to force loading the JavaScript files in
* development mode. Default is undefined. NOTE: This is a global variable,
* not a variable of mxClient.
*
* (code)
* <script type="text/javascript">
* let mxLoadResources = true;
* </script>
* <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script>
* (end)
*/
mxForceIncludes: false,
setForceIncludes: (value) => {
mxClient.mxForceIncludes = value;
},
/**
* Variable: mxLoadStylesheets
*
* Optional global config variable to toggle loading of the CSS files when
* the library is initialized. Default is true. NOTE: This is a global variable,
* not a variable of mxClient.
*
* (code)
* <script type="text/javascript">
* let mxLoadStylesheets = false;
* </script>
* <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script>
* (end)
*/
mxLoadStylesheets: true,
setLoadStylesheets: (value) => {
mxClient.mxLoadStylesheets = value;
},
/**
* 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)
* <script type="text/javascript">
* mxBasePath = '/path/to/core/directory';
* </script>
* <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script>
* (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: '.',
setBasePath: (value) => {
if (typeof(value) != 'undefined' && value.length > 0) {
// Adds a trailing slash if required
if (value.substring(value.length - 1) === '/') {
value = value.substring(0, value.length - 1);
}
mxClient.basePath = value;
} else {
mxClient.basePath = '.';
}
},
/**
* Variable: imageBasePath
*
* Basepath for all images URLs in the core without trailing slash. Default is
* <mxClient.basePath> + '/images'. Set mxImageBasePath prior to loading the
* mxClient library as follows to override this setting:
*
* (code)
* <script type="text/javascript">
* mxImageBasePath = '/path/to/image/directory';
* </script>
* <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script>
* (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: '.',
setImageBasePath: (value) => {
if (typeof(value) != 'undefined' && value.length > 0) {
// Adds a trailing slash if required
if (value.substring(value.length - 1) === '/') {
value = value.substring(0, value.length - 1);
}
mxClient.imageBasePath = value;
} else {
mxClient.imageBasePath = mxClient.basePath + '/images';
}
},
/**
* 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 <mxResources.getSpecialBundle> for handling identifiers
* with and without a dash.
*
* Set mxLanguage prior to loading the mxClient library as follows to override
* this setting:
*
* (code)
* <script type="text/javascript">
* mxLanguage = 'en';
* </script>
* <script type="text/javascript" src="js/mxClient.js"></script>
* (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.
* <mxEditor.askZoomResource>, <mxEditor.lastSavedResource>,
* <mxEditor.currentFileResource>, <mxEditor.propertiesResource>,
* <mxEditor.tasksResource>, <mxEditor.helpResource>, <mxEditor.outlineResource>,
* <mxElbowEdgeHandler.doubleClickOrientationResource>, <mxUtils.errorResource>,
* <mxUtils.closeResource>, <mxGraphSelectionModel.doneResource>,
* <mxGraphSelectionModel.updatingSelectionResource>, <mxGraphView.doneResource>,
* <mxGraphView.updatingDocumentResource>, <mxCellRenderer.collapseExpandResource>,
* <mxGraph.containsValidationErrorsResource> and
* <mxGraph.alreadyConnectedResource>.
*/
language: typeof window !== "undefined" ? navigator.language : 'en',
setLanguage: (value) => {
if (typeof(value) != 'undefined' && value != null) {
mxClient.language = value;
}
else {
mxClient.language = navigator.language;
}
},
/**
* 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)
* <script type="text/javascript">
* mxDefaultLanguage = 'de';
* </script>
* <script type="text/javascript" src="js/mxClient.js"></script>
* (end)
*/
defaultLanguage: 'en',
setDefaultLanguage: (value) => {
if (typeof(value) != 'undefined' && value != null) {
mxClient.defaultLanguage = value;
} else {
mxClient.defaultLanguage = 'en';
}
},
/**
* Variable: languages
*
* Defines the optional array of all supported language extensions. The default
* language does not have to be part of this list. See
* <mxResources.isLanguageSupported>.
*
* (code)
* <script type="text/javascript">
* mxLanguages = ['de', 'it', 'fr'];
* </script>
* <script type="text/javascript" src="js/mxClient.js"></script>
* (end)
*
* This is used to avoid unnecessary requests to language files, ie. if a 404
* will be returned.
*/
setLanguages: (value) => {
if (typeof(value) != 'undefined' && value != null) {
mxClient.languages = value;
}
},
/**
* Variable: IS_EDGE
*
* True if the current browser is Microsoft Edge.
*/
IS_EDGE: navigator.userAgent != null && !!navigator.userAgent.match(/Edge\//),
IS_EDGE: typeof window !== 'undefined' &&
navigator.userAgent != null && !!navigator.userAgent.match(/Edge\//),
/**
* Variable: IS_NS
*
* True if the current browser is Netscape (including Firefox).
*/
IS_NS: navigator.userAgent != null &&
IS_NS: typeof window !== 'undefined' &&
navigator.userAgent != null &&
navigator.userAgent.indexOf('Mozilla/') >= 0 &&
navigator.userAgent.indexOf('MSIE') < 0 &&
navigator.userAgent.indexOf('Edge/') < 0,
@ -45,42 +275,48 @@ let mxClient = {
*
* True if the current browser is Safari.
*/
IS_SF: /Apple Computer, Inc/.test(navigator.vendor),
IS_SF: typeof window !== 'undefined' &&
/Apple Computer, Inc/.test(navigator.vendor),
/**
* Variable: IS_ANDROID
*
* Returns true if the user agent contains Android.
*/
IS_ANDROID: navigator.appVersion.indexOf('Android') >= 0,
IS_ANDROID: typeof window !== 'undefined' &&
navigator.appVersion.indexOf('Android') >= 0,
/**
* Variable: IS_IOS
*
* Returns true if the user agent is an iPad, iPhone or iPod.
*/
IS_IOS: (/iP(hone|od|ad)/.test(navigator.platform)),
IS_IOS: typeof window !== 'undefined' &&
(/iP(hone|od|ad)/.test(navigator.platform)),
/**
* Variable: IS_GC
*
* True if the current browser is Google Chrome.
*/
IS_GC: /Google Inc/.test(navigator.vendor),
IS_GC: typeof window !== 'undefined' &&
/Google Inc/.test(navigator.vendor),
/**
* Variable: IS_CHROMEAPP
*
* True if the this is running inside a Chrome App.
*/
IS_CHROMEAPP: window.chrome != null && chrome.app != null && chrome.app.runtime != null,
IS_CHROMEAPP: typeof window !== 'undefined' &&
window.chrome != null && chrome.app != null && chrome.app.runtime != null,
/**
* Variable: IS_FF
*
* True if the current browser is Firefox.
*/
IS_FF: typeof InstallTrigger !== 'undefined',
IS_FF: typeof window !== 'undefined' &&
typeof InstallTrigger !== 'undefined',
/**
* Variable: IS_MT
@ -89,7 +325,8 @@ let mxClient = {
* for all Firefox-based browsers newer than or equal 3, such as Camino,
* Iceweasel, Seamonkey and Iceape.
*/
IS_MT: (navigator.userAgent.indexOf('Firefox/') >= 0 &&
IS_MT: typeof window !== 'undefined' &&
((navigator.userAgent.indexOf('Firefox/') >= 0 &&
navigator.userAgent.indexOf('Firefox/1.') < 0 &&
navigator.userAgent.indexOf('Firefox/2.') < 0) ||
(navigator.userAgent.indexOf('Iceweasel/') >= 0 &&
@ -98,14 +335,15 @@ let mxClient = {
(navigator.userAgent.indexOf('SeaMonkey/') >= 0 &&
navigator.userAgent.indexOf('SeaMonkey/1.') < 0) ||
(navigator.userAgent.indexOf('Iceape/') >= 0 &&
navigator.userAgent.indexOf('Iceape/1.') < 0),
navigator.userAgent.indexOf('Iceape/1.') < 0)),
/**
* Variable: IS_SVG
*
* True if the browser supports SVG.
*/
IS_SVG: navigator.appName.toUpperCase() != 'MICROSOFT INTERNET EXPLORER',
IS_SVG: typeof window !== 'undefined' &&
navigator.appName.toUpperCase() !== 'MICROSOFT INTERNET EXPLORER',
/**
* Variable: NO_FO
@ -113,29 +351,33 @@ let mxClient = {
* True if foreignObject support is not available. This is the case for
* Opera, older SVG-based browsers and all versions of IE.
*/
NO_FO: !document.createElementNS || document.createElementNS('http://www.w3.org/2000/svg',
'foreignObject') != '[object SVGForeignObjectElement]' || navigator.userAgent.indexOf('Opera/') >= 0,
NO_FO: typeof window !== 'undefined' &&
(!document.createElementNS || document.createElementNS('http://www.w3.org/2000/svg','foreignObject') !==
'[object SVGForeignObjectElement]' || navigator.userAgent.indexOf('Opera/') >= 0),
/**
* Variable: IS_WIN
*
* True if the client is a Windows.
*/
IS_WIN: navigator.appVersion.indexOf('Win') > 0,
IS_WIN: typeof window !== 'undefined' &&
navigator.appVersion.indexOf('Win') > 0,
/**
* Variable: IS_MAC
*
* True if the client is a Mac.
*/
IS_MAC: navigator.appVersion.indexOf('Mac') > 0,
IS_MAC: typeof window !== 'undefined' &&
navigator.appVersion.indexOf('Mac') > 0,
/**
* Variable: IS_CHROMEOS
*
* True if the client is a Chrome OS.
*/
IS_CHROMEOS: /\bCrOS\b/.test(navigator.appVersion),
IS_CHROMEOS: typeof window !== 'undefined' &&
/\bCrOS\b/.test(navigator.appVersion),
/**
* Variable: IS_TOUCH
@ -143,21 +385,25 @@ let mxClient = {
* True if this device supports touchstart/-move/-end events (Apple iOS,
* Android, Chromebook and Chrome Browser on touch-enabled devices).
*/
IS_TOUCH: 'ontouchstart' in document.documentElement,
IS_TOUCH: typeof window !== 'undefined' &&
'ontouchstart' in document.documentElement,
/**
* Variable: IS_POINTER
*
* True if this device supports Microsoft pointer events (always false on Macs).
*/
IS_POINTER: window.PointerEvent != null && !(navigator.appVersion.indexOf('Mac') > 0),
IS_POINTER: typeof window !== 'undefined' &&
window.PointerEvent != null &&
!(navigator.appVersion.indexOf('Mac') > 0),
/**
* Variable: IS_LOCAL
*
* True if the documents location does not start with http:// or https://.
*/
IS_LOCAL: document.location.href.indexOf('http://') < 0 &&
IS_LOCAL: typeof window !== 'undefined' &&
document.location.href.indexOf('http://') < 0 &&
document.location.href.indexOf('https://') < 0,
/**
@ -239,7 +485,7 @@ let mxClient = {
let pending = mxClient.defaultBundles.length;
function callback() {
if (--pending == 0) {
if (--pending === 0) {
fn();
}
}
@ -250,215 +496,4 @@ let mxClient = {
}
};
/**
* Variable: mxLoadResources
*
* Optional global config variable to toggle loading of the two resource files
* in <mxGraph> and <mxEditor>. Default is true. NOTE: This is a global variable,
* not a variable of mxClient. If this is false, you can use <mxClient.loadResources>
* with its callback to load the default bundles asynchronously.
*
* (code)
* <script type="text/javascript">
* let mxLoadResources = false;
* </script>
* <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script>
* (end)
*/
if (typeof(mxLoadResources) == 'undefined') {
mxLoadResources = true;
}
/**
* Variable: mxForceIncludes
*
* Optional global config variable to force loading the JavaScript files in
* development mode. Default is undefined. NOTE: This is a global variable,
* not a variable of mxClient.
*
* (code)
* <script type="text/javascript">
* let mxLoadResources = true;
* </script>
* <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script>
* (end)
*/
if (typeof(mxForceIncludes) == 'undefined') {
mxForceIncludes = false;
}
/**
* Variable: mxResourceExtension
*
* Optional global config variable to specify the extension of resource files.
* Default is true. NOTE: This is a global variable, not a variable of mxClient.
*
* (code)
* <script type="text/javascript">
* let mxResourceExtension = '.txt';
* </script>
* <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script>
* (end)
*/
if (typeof(mxResourceExtension) == 'undefined') {
mxResourceExtension = '.txt';
}
/**
* Variable: mxLoadStylesheets
*
* Optional global config variable to toggle loading of the CSS files when
* the library is initialized. Default is true. NOTE: This is a global variable,
* not a variable of mxClient.
*
* (code)
* <script type="text/javascript">
* let mxLoadStylesheets = false;
* </script>
* <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script>
* (end)
*/
if (typeof(mxLoadStylesheets) == 'undefined') {
mxLoadStylesheets = true;
}
/**
* 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)
* <script type="text/javascript">
* mxBasePath = '/path/to/core/directory';
* </script>
* <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script>
* (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.
*/
if (typeof(mxBasePath) != 'undefined' && mxBasePath.length > 0) {
// Adds a trailing slash if required
if (mxBasePath.substring(mxBasePath.length - 1) === '/') {
mxBasePath = mxBasePath.substring(0, mxBasePath.length - 1);
}
mxClient.basePath = mxBasePath;
} else {
mxClient.basePath = '.';
}
/**
* Variable: imageBasePath
*
* Basepath for all images URLs in the core without trailing slash. Default is
* <mxClient.basePath> + '/images'. Set mxImageBasePath prior to loading the
* mxClient library as follows to override this setting:
*
* (code)
* <script type="text/javascript">
* mxImageBasePath = '/path/to/image/directory';
* </script>
* <script type="text/javascript" src="/path/to/core/directory/js/mxClient.js"></script>
* (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.
*/
if (typeof(mxImageBasePath) != 'undefined' && mxImageBasePath.length > 0) {
// Adds a trailing slash if required
if (mxImageBasePath.substring(mxImageBasePath.length - 1) === '/') {
mxImageBasePath = mxImageBasePath.substring(0, mxImageBasePath.length - 1);
}
mxClient.imageBasePath = mxImageBasePath;
} else {
mxClient.imageBasePath = mxClient.basePath + '/images';
}
/**
* 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 <mxResources.getSpecialBundle> for handling identifiers
* with and without a dash.
*
* Set mxLanguage prior to loading the mxClient library as follows to override
* this setting:
*
* (code)
* <script type="text/javascript">
* mxLanguage = 'en';
* </script>
* <script type="text/javascript" src="js/mxClient.js"></script>
* (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.
* <mxEditor.askZoomResource>, <mxEditor.lastSavedResource>,
* <mxEditor.currentFileResource>, <mxEditor.propertiesResource>,
* <mxEditor.tasksResource>, <mxEditor.helpResource>, <mxEditor.outlineResource>,
* <mxElbowEdgeHandler.doubleClickOrientationResource>, <mxUtils.errorResource>,
* <mxUtils.closeResource>, <mxGraphSelectionModel.doneResource>,
* <mxGraphSelectionModel.updatingSelectionResource>, <mxGraphView.doneResource>,
* <mxGraphView.updatingDocumentResource>, <mxCellRenderer.collapseExpandResource>,
* <mxGraph.containsValidationErrorsResource> and
* <mxGraph.alreadyConnectedResource>.
*/
if (typeof(mxLanguage) != 'undefined' && mxLanguage != null) {
mxClient.language = mxLanguage;
}
else {
mxClient.language = navigator.language;
}
/**
* 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)
* <script type="text/javascript">
* mxDefaultLanguage = 'de';
* </script>
* <script type="text/javascript" src="js/mxClient.js"></script>
* (end)
*/
if (typeof(mxDefaultLanguage) != 'undefined' && mxDefaultLanguage != null) {
mxClient.defaultLanguage = mxDefaultLanguage;
} else {
mxClient.defaultLanguage = 'en';
}
// Adds all required stylesheets and namespaces
if (mxLoadStylesheets) {
mxClient.link('stylesheet', mxClient.basePath + '/css/common.css');
}
/**
* Variable: languages
*
* Defines the optional array of all supported language extensions. The default
* language does not have to be part of this list. See
* <mxResources.isLanguageSupported>.
*
* (code)
* <script type="text/javascript">
* mxLanguages = ['de', 'it', 'fr'];
* </script>
* <script type="text/javascript" src="js/mxClient.js"></script>
* (end)
*
* This is used to avoid unnecessary requests to language files, ie. if a 404
* will be returned.
*/
if (typeof(mxLanguages) != 'undefined' && mxLanguages != null) {
mxClient.languages = mxLanguages;
}
export default mxClient;

View File

@ -3,6 +3,7 @@
* Copyright (c) 2006-2015, Gaudenz Alder
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxShape from "./mxShape";
class mxActor extends mxShape {
/**

View File

@ -3,6 +3,7 @@
* Copyright (c) 2006-2015, Gaudenz Alder
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxShape from "./mxShape";
class mxArrow extends mxShape {
/**

View File

@ -3,6 +3,9 @@
* Copyright (c) 2006-2015, Gaudenz Alder
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxShape from "./mxShape";
import mxConstants from "../util/mxConstants";
import mxUtils from "../util/mxUtils";
class mxArrowConnector extends mxShape {
/**

View File

@ -3,6 +3,7 @@
* Copyright (c) 2006-2015, Gaudenz Alder
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxActor from "./mxActor";
class mxCloud extends mxActor {
/**

View File

@ -4,8 +4,10 @@
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxConstants from "../util/mxConstants";
import mxPolyline from "./mxPolyline";
import mxUtils from "../util/mxUtils";
class mxConnector extends mxPolyLine {
class mxConnector extends mxPolyline {
/**
* Class: mxConnector
*

View File

@ -3,6 +3,9 @@
* Copyright (c) 2006-2015, Gaudenz Alder
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxShape from "./mxShape";
import mxConstants from "../util/mxConstants";
import mxUtils from "../util/mxUtils";
class mxCylinder extends mxShape {
/**

View File

@ -5,6 +5,9 @@
*/
import mxRectangle from "../util/mxRectangle";
import mxShape from "./mxShape";
import mxConstants from "../util/mxConstants";
import mxUtils from "../util/mxUtils";
class mxDoubleEllipse extends mxShape {
/**

View File

@ -3,6 +3,7 @@
* Copyright (c) 2006-2015, Gaudenz Alder
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxShape from "./mxShape";
class mxEllipse extends mxShape {
/**

View File

@ -3,6 +3,10 @@
* Copyright (c) 2006-2015, Gaudenz Alder
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxActor from "./mxActor";
import mxPoint from "../util/mxPoint";
import mxUtils from "../util/mxUtils";
import mxConstants from "../util/mxConstants";
class mxHexagon extends mxActor {
/**

View File

@ -6,6 +6,7 @@
import mxUtils from "../util/mxUtils";
import mxConstants from "../util/mxConstants";
import mxRectangleShape from "./mxRectangleShape";
class mxImageShape extends mxRectangleShape {
/**

View File

@ -3,6 +3,7 @@
* Copyright (c) 2006-2015, Gaudenz Alder
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxShape from "./mxShape";
class mxLine extends mxShape {
/**

View File

@ -3,6 +3,8 @@
* Copyright (c) 2006-2015, Gaudenz Alder
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxShape from "./mxShape";
import mxConstants from "../util/mxConstants";
class mxPolyline extends mxShape {
/**

View File

@ -6,6 +6,7 @@
import mxConstants from "../util/mxConstants";
import mxUtils from "../util/mxUtils";
import mxShape from "./mxShape";
class mxRectangleShape extends mxShape {
/**

View File

@ -3,6 +3,8 @@
* Copyright (c) 2006-2015, Gaudenz Alder
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxShape from "./mxShape";
import mxPoint from "../util/mxPoint";
class mxRhombus extends mxShape {
/**

View File

@ -3,6 +3,11 @@
* Copyright (c) 2006-2015, Gaudenz Alder
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxRectangle from "../util/mxRectangle";
import mxUtils from "../util/mxUtils";
import mxConstants from "../util/mxConstants";
import mxPoint from "../util/mxPoint";
import mxSvgCanvas2D from "../util/mxSvgCanvas2D";
class mxShape {
/**
@ -212,7 +217,11 @@ class mxShape {
*
* Constructs a new shape.
*/
constructor(stencil) {
constructor(...args) {
this._constructor(...args);
};
_constructor = (stencil) => {
this.stencil = stencil;
this.initStyles();
};

View File

@ -6,6 +6,7 @@
import mxRectangle from "../util/mxRectangle";
import mxConnectionConstraint from "FIXME";
import mxShape from "./mxShape";
class mxStencil extends mxShape {
/**
@ -281,7 +282,7 @@ class mxStencil extends mxShape {
* desc - XML node that contains the stencil description.
*/
constructor(desc) {
// constructor not called
super();
this.desc = desc;
this.parseDescription();
this.parseConstraints();

View File

@ -3,6 +3,9 @@
* Copyright (c) 2006-2015, Gaudenz Alder
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxShape from "./mxShape";
import mxRectangle from "../util/mxRectangle";
import mxConstants from "../util/mxConstants";
class mxSwimlane extends mxShape {
/**
@ -46,6 +49,11 @@ class mxSwimlane extends mxShape {
this.strokewidth = (strokewidth != null) ? strokewidth : 1;
};
_constructor = () => {
// explicitly do nothing in
// overridden constructor in mxShape
};
/**
* Function: isRoundable
*

View File

@ -9,6 +9,7 @@ import mxConstants from "../util/mxConstants";
import mxUtils from "../util/mxUtils";
import mxPoint from "../util/mxPoint";
import mxSvgCanvas2D from "../util/mxSvgCanvas2D";
import mxShape from "./mxShape";
class mxText extends mxShape {
/**

View File

@ -4,6 +4,8 @@
* Updated to ES9 syntax by David Morrissey 2021
*/
import mxRectangle from "./mxRectangle";
let mxConstants = {
/**
* Class: mxConstants

View File

@ -2,388 +2,389 @@
* Copyright (c) 2006-2016, JGraph Ltd
* Copyright (c) 2006-2016, Gaudenz Alder
*/
let mxResources =
{
/**
* Class: mxResources
*
* Implements internationalization. You can provide any number of
* resource files on the server using the following format for the
* filename: name[-en].properties. The en stands for any lowercase
* 2-character language shortcut (eg. de for german, fr for french).
*
* If the optional language extension is omitted, then the file is used as a
* default resource which is loaded in all cases. If a properties file for a
* specific language exists, then it is used to override the settings in the
* default resource. All entries in the file are of the form key=value. The
* values may then be accessed in code via <get>. Lines without
* equal signs in the properties files are ignored.
*
* Resource files may either be added programmatically using
* <add> or via a resource tag in the UI section of the
* editor configuration file, eg:
*
* (code)
* <mxEditor>
* <ui>
* <resource basename="examples/resources/mxWorkflow"/>
* (end)
*
* The above element will load examples/resources/mxWorkflow.properties as well
* as the language specific file for the current language, if it exists.
*
* Values may contain placeholders of the form {1}...{n} where each placeholder
* is replaced with the value of the corresponding array element in the params
* argument passed to <mxResources.get>. The placeholder {1} maps to the first
* element in the array (at index 0).
*
* See <mxClient.language> for more information on specifying the default
* language or disabling all loading of resources.
*
* Lines that start with a # sign will be ignored.
*
* Special characters
*
* To use unicode characters, use the standard notation (eg. \u8fd1) or %u as a
* prefix (eg. %u20AC will display a Euro sign). For normal hex encoded strings,
* use % as a prefix, eg. %F6 will display a "o umlaut" (&ouml;).
*
* See <resourcesEncoded> to disable this. If you disable this, make sure that
* your files are UTF-8 encoded.
*
* Asynchronous loading
*
* By default, the core adds two resource files synchronously at load time.
* To load these files asynchronously, set <mxLoadResources> to false
* before loading mxClient.js and use <mxResources.loadResources> instead.
*
* Variable: resources
*
* Object that maps from keys to values.
*/
resources: {},
import mxClient from "../mxClient";
import mxConstants from "./mxConstants";
/**
* Variable: extension
*
* Specifies the extension used for language files. Default is <mxResourceExtension>.
*/
extension: mxResourceExtension,
let mxResources = {
/**
* Class: mxResources
*
* Implements internationalization. You can provide any number of
* resource files on the server using the following format for the
* filename: name[-en].properties. The en stands for any lowercase
* 2-character language shortcut (eg. de for german, fr for french).
*
* If the optional language extension is omitted, then the file is used as a
* default resource which is loaded in all cases. If a properties file for a
* specific language exists, then it is used to override the settings in the
* default resource. All entries in the file are of the form key=value. The
* values may then be accessed in code via <get>. Lines without
* equal signs in the properties files are ignored.
*
* Resource files may either be added programmatically using
* <add> or via a resource tag in the UI section of the
* editor configuration file, eg:
*
* (code)
* <mxEditor>
* <ui>
* <resource basename="examples/resources/mxWorkflow"/>
* (end)
*
* The above element will load examples/resources/mxWorkflow.properties as well
* as the language specific file for the current language, if it exists.
*
* Values may contain placeholders of the form {1}...{n} where each placeholder
* is replaced with the value of the corresponding array element in the params
* argument passed to <mxResources.get>. The placeholder {1} maps to the first
* element in the array (at index 0).
*
* See <mxClient.language> for more information on specifying the default
* language or disabling all loading of resources.
*
* Lines that start with a # sign will be ignored.
*
* Special characters
*
* To use unicode characters, use the standard notation (eg. \u8fd1) or %u as a
* prefix (eg. %u20AC will display a Euro sign). For normal hex encoded strings,
* use % as a prefix, eg. %F6 will display a "o umlaut" (&ouml;).
*
* See <resourcesEncoded> to disable this. If you disable this, make sure that
* your files are UTF-8 encoded.
*
* Asynchronous loading
*
* By default, the core adds two resource files synchronously at load time.
* To load these files asynchronously, set <mxLoadResources> to false
* before loading mxClient.js and use <mxResources.loadResources> instead.
*
* Variable: resources
*
* Object that maps from keys to values.
*/
resources: {},
/**
* Variable: resourcesEncoded
*
* Specifies whether or not values in resource files are encoded with \u or
* percentage. Default is false.
*/
resourcesEncoded: false,
/**
* Variable: extension
*
* Specifies the extension used for language files. Default is <mxResourceExtension>.
*/
extension: '.txt',
/**
* Variable: loadDefaultBundle
*
* Specifies if the default file for a given basename should be loaded.
* Default is true.
*/
loadDefaultBundle: true,
/**
* Variable: resourcesEncoded
*
* Specifies whether or not values in resource files are encoded with \u or
* percentage. Default is false.
*/
resourcesEncoded: false,
/**
* Variable: loadDefaultBundle
*
* Specifies if the specific language file file for a given basename should
* be loaded. Default is true.
*/
loadSpecialBundle: true,
/**
* Variable: loadDefaultBundle
*
* Specifies if the default file for a given basename should be loaded.
* Default is true.
*/
loadDefaultBundle: true,
/**
* Function: isLanguageSupported
*
* Hook for subclassers to disable support for a given language. This
* implementation returns true if lan is in <mxClient.languages>.
*
* Parameters:
*
* lan - The current language.
*/
isLanguageSupported: (lan) => {
if (mxClient.languages != null) {
return mxUtils.indexOf(mxClient.languages, lan) >= 0;
}
/**
* Variable: loadDefaultBundle
*
* Specifies if the specific language file file for a given basename should
* be loaded. Default is true.
*/
loadSpecialBundle: true,
return true;
},
/**
* Function: isLanguageSupported
*
* Hook for subclassers to disable support for a given language. This
* implementation returns true if lan is in <mxClient.languages>.
*
* Parameters:
*
* lan - The current language.
*/
isLanguageSupported: (lan) => {
if (mxClient.languages != null) {
return mxUtils.indexOf(mxClient.languages, lan) >= 0;
}
/**
* Function: getDefaultBundle
*
* Hook for subclassers to return the URL for the special bundle. This
* implementation returns basename + <extension> or null if
* <loadDefaultBundle> is false.
*
* Parameters:
*
* basename - The basename for which the file should be loaded.
* lan - The current language.
*/
getDefaultBundle: (basename, lan) => {
if (mxResources.loadDefaultBundle || !mxResources.isLanguageSupported(lan)) {
return basename + mxResources.extension;
} else {
return null;
}
},
return true;
},
/**
* Function: getSpecialBundle
*
* Hook for subclassers to return the URL for the special bundle. This
* implementation returns basename + '_' + lan + <extension> or null if
* <loadSpecialBundle> is false or lan equals <mxClient.defaultLanguage>.
*
* If <mxResources.languages> is not null and <mxClient.language> contains
* a dash, then this method checks if <isLanguageSupported> returns true
* for the full language (including the dash). If that returns false the
* first part of the language (up to the dash) will be tried as an extension.
*
* If <mxResources.language> is null then the first part of the language is
* used to maintain backwards compatibility.
*
* Parameters:
*
* basename - The basename for which the file should be loaded.
* lan - The language for which the file should be loaded.
*/
getSpecialBundle: (basename, lan) => {
if (mxClient.languages == null || !this.isLanguageSupported(lan)) {
let dash = lan.indexOf('-');
/**
* Function: getDefaultBundle
*
* Hook for subclassers to return the URL for the special bundle. This
* implementation returns basename + <extension> or null if
* <loadDefaultBundle> is false.
*
* Parameters:
*
* basename - The basename for which the file should be loaded.
* lan - The current language.
*/
getDefaultBundle: (basename, lan) => {
if (mxResources.loadDefaultBundle || !mxResources.isLanguageSupported(lan)) {
return basename + mxResources.extension;
} else {
return null;
}
},
if (dash > 0) {
lan = lan.substring(0, dash);
}
}
/**
* Function: getSpecialBundle
*
* Hook for subclassers to return the URL for the special bundle. This
* implementation returns basename + '_' + lan + <extension> or null if
* <loadSpecialBundle> is false or lan equals <mxClient.defaultLanguage>.
*
* If <mxResources.languages> is not null and <mxClient.language> contains
* a dash, then this method checks if <isLanguageSupported> returns true
* for the full language (including the dash). If that returns false the
* first part of the language (up to the dash) will be tried as an extension.
*
* If <mxResources.language> is null then the first part of the language is
* used to maintain backwards compatibility.
*
* Parameters:
*
* basename - The basename for which the file should be loaded.
* lan - The language for which the file should be loaded.
*/
getSpecialBundle: (basename, lan) => {
if (mxClient.languages == null || !this.isLanguageSupported(lan)) {
let dash = lan.indexOf('-');
if (mxResources.loadSpecialBundle && mxResources.isLanguageSupported(lan) && lan != mxClient.defaultLanguage) {
return basename + '_' + lan + mxResources.extension;
} else {
return null;
}
},
if (dash > 0) {
lan = lan.substring(0, dash);
}
}
/**
* Function: add
*
* Adds the default and current language properties file for the specified
* basename. Existing keys are overridden as new files are added. If no
* callback is used then the request is synchronous.
*
* Example:
*
* At application startup, additional resources may be
* added using the following code:
*
* (code)
* mxResources.add('resources/editor');
* (end)
*
* Parameters:
*
* basename - The basename for which the file should be loaded.
* lan - The language for which the file should be loaded.
* callback - Optional callback for asynchronous loading.
*/
add: (basename, lan, callback) => {
lan = (lan != null) ? lan : ((mxClient.language != null) ?
mxClient.language.toLowerCase() : mxConstants.NONE);
if (mxResources.loadSpecialBundle && mxResources.isLanguageSupported(lan) && lan != mxClient.defaultLanguage) {
return basename + '_' + lan + mxResources.extension;
} else {
return null;
}
},
if (lan != mxConstants.NONE) {
let defaultBundle = mxResources.getDefaultBundle(basename, lan);
let specialBundle = mxResources.getSpecialBundle(basename, lan);
/**
* Function: add
*
* Adds the default and current language properties file for the specified
* basename. Existing keys are overridden as new files are added. If no
* callback is used then the request is synchronous.
*
* Example:
*
* At application startup, additional resources may be
* added using the following code:
*
* (code)
* mxResources.add('resources/editor');
* (end)
*
* Parameters:
*
* basename - The basename for which the file should be loaded.
* lan - The language for which the file should be loaded.
* callback - Optional callback for asynchronous loading.
*/
add: (basename, lan, callback) => {
lan = (lan != null) ? lan : ((mxClient.language != null) ?
mxClient.language.toLowerCase() : mxConstants.NONE);
let loadSpecialBundle = () => {
if (specialBundle != null) {
if (callback) {
mxUtils.get(specialBundle, (req) => {
mxResources.parse(req.getText());
callback();
}, () => {
callback();
});
} else {
try {
let req = mxUtils.load(specialBundle);
if (lan !== mxConstants.NONE) {
let defaultBundle = mxResources.getDefaultBundle(basename, lan);
let specialBundle = mxResources.getSpecialBundle(basename, lan);
if (req.isReady()) {
mxResources.parse(req.getText());
}
} catch (e) {
// ignore
}
}
} else if (callback != null) {
let loadSpecialBundle = () => {
if (specialBundle != null) {
if (callback) {
mxUtils.get(specialBundle, (req) => {
mxResources.parse(req.getText());
callback();
}
}
}, () => {
callback();
});
} else {
try {
let req = mxUtils.load(specialBundle);
if (defaultBundle != null) {
if (callback) {
mxUtils.get(defaultBundle, (req) => {
if (req.isReady()) {
mxResources.parse(req.getText());
loadSpecialBundle();
}, () => {
loadSpecialBundle();
});
} else {
try {
let req = mxUtils.load(defaultBundle);
if (req.isReady()) {
mxResources.parse(req.getText());
}
loadSpecialBundle();
} catch (e) {
// ignore
}
}
} else {
// Overlays the language specific file (_lan-extension)
loadSpecialBundle();
}
}
},
/**
* Function: parse
*
* Parses the key, value pairs in the specified
* text and stores them as local resources.
*/
parse: (text) => {
if (text != null) {
let lines = text.split('\n');
for (let i = 0; i < lines.length; i++) {
if (lines[i].charAt(0) != '#') {
let index = lines[i].indexOf('=');
if (index > 0) {
let key = lines[i].substring(0, index);
let idx = lines[i].length;
if (lines[i].charCodeAt(idx - 1) == 13) {
idx--;
}
let value = lines[i].substring(index + 1, idx);
if (this.resourcesEncoded) {
value = value.replace(/\\(?=u[a-fA-F\d]{4})/g, "%");
mxResources.resources[key] = unescape(value);
} else {
mxResources.resources[key] = value;
}
}
} catch (e) {
// ignore
}
}
} else if (callback != null) {
callback();
}
},
/**
* Function: get
*
* Returns the value for the specified resource key.
*
* Example:
* To read the value for 'welomeMessage', use the following:
* (code)
* let result = mxResources.get('welcomeMessage') || '';
* (end)
*
* This would require an entry of the following form in
* one of the English language resource files:
* (code)
* welcomeMessage=Welcome to mxGraph!
* (end)
*
* The part behind the || is the string value to be used if the given
* resource is not available.
*
* Parameters:
*
* key - String that represents the key of the resource to be returned.
* params - Array of the values for the placeholders of the form {1}...{n}
* to be replaced with in the resulting string.
* defaultValue - Optional string that specifies the default return value.
*/
get: (key, params, defaultValue) => {
let value = mxResources.resources[key];
// Applies the default value if no resource was found
if (value == null) {
value = defaultValue;
}
// Replaces the placeholders with the values in the array
if (value != null && params != null) {
value = mxResources.replacePlaceholders(value, params);
}
return value;
},
/**
* Function: replacePlaceholders
*
* Replaces the given placeholders with the given parameters.
*
* Parameters:
*
* value - String that contains the placeholders.
* params - Array of the values for the placeholders of the form {1}...{n}
* to be replaced with in the resulting string.
*/
replacePlaceholders: (value, params) => {
let result = [];
let index = null;
for (let i = 0; i < value.length; i++) {
let c = value.charAt(i);
if (c == '{') {
index = '';
} else if (index != null && c == '}') {
index = parseInt(index) - 1;
if (index >= 0 && index < params.length) {
result.push(params[index]);
}
index = null;
} else if (index != null) {
index += c;
} else {
result.push(c);
}
}
return result.join('');
},
/**
* Function: loadResources
*
* Loads all required resources asynchronously. Use this to load the graph and
* editor resources if <mxLoadResources> is false.
*
* Parameters:
*
* callback - Callback function for asynchronous loading.
*/
loadResources: (callback) => {
mxResources.add(mxClient.basePath + '/resources/editor', null, () => {
mxResources.add(mxClient.basePath + '/resources/graph', null, callback);
});
}
};
if (defaultBundle != null) {
if (callback) {
mxUtils.get(defaultBundle, (req) => {
mxResources.parse(req.getText());
loadSpecialBundle();
}, () => {
loadSpecialBundle();
});
} else {
try {
let req = mxUtils.load(defaultBundle);
if (req.isReady()) {
mxResources.parse(req.getText());
}
loadSpecialBundle();
} catch (e) {
// ignore
}
}
} else {
// Overlays the language specific file (_lan-extension)
loadSpecialBundle();
}
}
},
/**
* Function: parse
*
* Parses the key, value pairs in the specified
* text and stores them as local resources.
*/
parse: (text) => {
if (text != null) {
let lines = text.split('\n');
for (let i = 0; i < lines.length; i++) {
if (lines[i].charAt(0) !== '#') {
let index = lines[i].indexOf('=');
if (index > 0) {
let key = lines[i].substring(0, index);
let idx = lines[i].length;
if (lines[i].charCodeAt(idx - 1) === 13) {
idx--;
}
let value = lines[i].substring(index + 1, idx);
if (this.resourcesEncoded) {
value = value.replace(/\\(?=u[a-fA-F\d]{4})/g, "%");
mxResources.resources[key] = unescape(value);
} else {
mxResources.resources[key] = value;
}
}
}
}
}
},
/**
* Function: get
*
* Returns the value for the specified resource key.
*
* Example:
* To read the value for 'welomeMessage', use the following:
* (code)
* let result = mxResources.get('welcomeMessage') || '';
* (end)
*
* This would require an entry of the following form in
* one of the English language resource files:
* (code)
* welcomeMessage=Welcome to mxGraph!
* (end)
*
* The part behind the || is the string value to be used if the given
* resource is not available.
*
* Parameters:
*
* key - String that represents the key of the resource to be returned.
* params - Array of the values for the placeholders of the form {1}...{n}
* to be replaced with in the resulting string.
* defaultValue - Optional string that specifies the default return value.
*/
get: (key, params, defaultValue) => {
let value = mxResources.resources[key];
// Applies the default value if no resource was found
if (value == null) {
value = defaultValue;
}
// Replaces the placeholders with the values in the array
if (value != null && params != null) {
value = mxResources.replacePlaceholders(value, params);
}
return value;
},
/**
* Function: replacePlaceholders
*
* Replaces the given placeholders with the given parameters.
*
* Parameters:
*
* value - String that contains the placeholders.
* params - Array of the values for the placeholders of the form {1}...{n}
* to be replaced with in the resulting string.
*/
replacePlaceholders: (value, params) => {
let result = [];
let index = null;
for (let i = 0; i < value.length; i++) {
let c = value.charAt(i);
if (c === '{') {
index = '';
} else if (index != null && c === '}') {
index = parseInt(index) - 1;
if (index >= 0 && index < params.length) {
result.push(params[index]);
}
index = null;
} else if (index != null) {
index += c;
} else {
result.push(c);
}
}
return result.join('');
},
/**
* Function: loadResources
*
* Loads all required resources asynchronously. Use this to load the graph and
* editor resources if <mxLoadResources> is false.
*
* Parameters:
*
* callback - Callback function for asynchronous loading.
*/
loadResources: (callback) => {
mxResources.add(mxClient.basePath + '/resources/editor', null, () => {
mxResources.add(mxClient.basePath + '/resources/graph', null, callback);
});
}
};
export default mxResources;

View File

@ -6,6 +6,7 @@
import mxEffects from "./mxEffects";
import mxXmlRequest from "./mxXmlRequest";
import mxClient from "../mxClient";
import mxConstants from "./mxConstants";
let mxUtils = {
/**
@ -30,7 +31,7 @@ let mxUtils = {
* resource for this key does not exist then the value is used as
* the title. Default is 'error'.
*/
errorResource: (mxClient.language != 'none') ? 'error' : '',
errorResource: (mxClient.language !== 'none') ? 'error' : '',
/**
* Variable: closeResource
@ -39,7 +40,7 @@ let mxUtils = {
* resource for this key does not exist then the value is used as
* the label. Default is 'close'.
*/
closeResource: (mxClient.language != 'none') ? 'close' : '',
closeResource: (mxClient.language !== 'none') ? 'close' : '',
/**
* Variable: errorImage
@ -163,11 +164,11 @@ let mxUtils = {
* function to the specified scope. Inside funct, the "this" keyword
* becomes a reference to that scope.
*/
/*bind: (scope, funct) => {
bind: (scope, funct) => {
return () => {
return funct.apply(scope, arguments);
};
},*/
},
/**
* Function: eval
@ -393,7 +394,7 @@ let mxUtils = {
let parent = child;
while (parent != null) {
if (parent == ancestor) {
if (parent === ancestor) {
return true;
}
@ -582,11 +583,11 @@ let mxUtils = {
removeWhitespace: (node, before) => {
let tmp = (before) ? node.previousSibling : node.nextSibling;
while (tmp != null && tmp.nodeType == mxConstants.NODETYPE_TEXT) {
while (tmp != null && tmp.nodeType === mxConstants.NODETYPE_TEXT) {
let next = (before) ? tmp.previousSibling : tmp.nextSibling;
let text = mxUtils.getTextContent(tmp);
if (mxUtils.trim(text).length == 0) {
if (mxUtils.trim(text).length === 0) {
tmp.parentNode.removeChild(tmp);
}
@ -689,7 +690,7 @@ let mxUtils = {
indent = (indent != null) ? indent : '';
newline = (newline != null) ? newline : '\n';
if (node.namespaceURI != null && node.namespaceURI != ns) {
if (node.namespaceURI != null && node.namespaceURI !== ns) {
ns = node.namespaceURI;
if (node.getAttribute('xmlns') == null) {
@ -697,9 +698,9 @@ let mxUtils = {
}
}
if (node.nodeType == mxConstants.NODETYPE_DOCUMENT) {
if (node.nodeType === mxConstants.NODETYPE_DOCUMENT) {
result.push(mxUtils.getPrettyXml(node.documentElement, tab, indent, newline, ns));
} else if (node.nodeType == mxConstants.NODETYPE_DOCUMENT_FRAGMENT) {
} else if (node.nodeType === mxConstants.NODETYPE_DOCUMENT_FRAGMENT) {
let tmp = node.firstChild;
if (tmp != null) {
@ -708,19 +709,19 @@ let mxUtils = {
tmp = tmp.nextSibling;
}
}
} else if (node.nodeType == mxConstants.NODETYPE_COMMENT) {
} else if (node.nodeType === mxConstants.NODETYPE_COMMENT) {
let value = mxUtils.getTextContent(node);
if (value.length > 0) {
result.push(indent + '<!--' + value + '-->' + newline);
}
} else if (node.nodeType == mxConstants.NODETYPE_TEXT) {
} else if (node.nodeType === mxConstants.NODETYPE_TEXT) {
let value = mxUtils.trim(mxUtils.getTextContent(node));
if (value.length > 0) {
result.push(indent + mxUtils.htmlEntities(value, false) + newline);
}
} else if (node.nodeType == mxConstants.NODETYPE_CDATA) {
} else if (node.nodeType === mxConstants.NODETYPE_CDATA) {
let value = mxUtils.getTextContent(node);
if (value.length > 0) {

View File

@ -6,6 +6,8 @@
import mxPoint from "../util/mxPoint";
import mxRectangle from "../util/mxRectangle";
import mxEventSource from "../util/mxEventSource";
import mxConstants from "../util/mxConstants";
class mxCellOverlay extends mxEventSource {
/**

View File

@ -36,6 +36,7 @@ import mxMouseEvent from "../util/mxMouseEvent";
import mxResources from "../util/mxResources";
import mxGeometry from "../model/mxGeometry";
import mxCell from "../model/mxCell";
import mxGraphModel from "../model/mxGraphModel";
class mxGraph extends mxEventSource {
/**
@ -11703,7 +11704,7 @@ class mxGraph extends mxEventSource {
* Installs the required language resources at class
* loading time.
*/
if (mxLoadResources) {
if (mxClient.mxLoadResources) {
mxResources.add(mxClient.basePath + '/resources/graph');
} else {
mxClient.defaultBundles.push(mxClient.basePath + '/resources/graph');