From 7ae4fda97931e909d7d64d42688811b8b091329e Mon Sep 17 00:00:00 2001 From: mcyph <20507948+mcyph@users.noreply.github.com> Date: Sun, 11 Apr 2021 13:53:20 +1000 Subject: [PATCH] moved mxCellState to view/cell --- src/mxgraph/handler/mxCellHighlight.ts | 2 +- src/mxgraph/handler/mxGraphHandler.js | 6 ++++-- src/mxgraph/shape/mxShape.ts | 2 +- src/mxgraph/shape/mxText.ts | 2 +- src/mxgraph/shape/node/mxImageShape.ts | 2 +- src/mxgraph/util/datatypes/style/mxEdgeStyle.js | 2 +- src/mxgraph/util/datatypes/style/mxPerimeter.ts | 2 +- src/mxgraph/util/mxGuide.ts | 2 +- src/mxgraph/view/cell/mxCellEditor.ts | 2 +- src/mxgraph/view/cell/mxCellOverlay.ts | 2 +- src/mxgraph/view/cell/mxCellRenderer.ts | 2 +- .../{util/datatypes => view/cell}/mxCellState.ts | 14 +++++++------- src/mxgraph/view/cell/mxCellStatePreview.ts | 2 +- src/mxgraph/view/cell/mxTemporaryCellStates.ts | 2 +- src/mxgraph/view/graph/mxGraph.ts | 2 +- src/mxgraph/view/graph/mxGraphView.ts | 2 +- src/pages/connections/Anchors.js | 2 +- src/pages/connections/FixedPoints.js | 2 +- src/pages/connections/Orthogonal.js | 2 +- 19 files changed, 28 insertions(+), 26 deletions(-) rename src/mxgraph/{util/datatypes => view/cell}/mxCellState.ts (97%) diff --git a/src/mxgraph/handler/mxCellHighlight.ts b/src/mxgraph/handler/mxCellHighlight.ts index a870e2167..8a26dcbe3 100644 --- a/src/mxgraph/handler/mxCellHighlight.ts +++ b/src/mxgraph/handler/mxCellHighlight.ts @@ -7,7 +7,7 @@ import mxConstants from '../util/mxConstants'; import mxEvent from '../util/event/mxEvent'; import mxRectangle from '../util/datatypes/mxRectangle'; -import mxCellState from '../util/datatypes/mxCellState'; +import mxCellState from '../view/cell/mxCellState'; import mxGraph from '../view/graph/mxGraph'; import mxShape from '../shape/mxShape'; diff --git a/src/mxgraph/handler/mxGraphHandler.js b/src/mxgraph/handler/mxGraphHandler.js index a37427dc0..23875e661 100644 --- a/src/mxgraph/handler/mxGraphHandler.js +++ b/src/mxgraph/handler/mxGraphHandler.js @@ -128,8 +128,10 @@ class mxGraphHandler { } }; - mxEvent.addListener(document, 'keydown', this.keyHandler); - mxEvent.addListener(document, 'keyup', this.keyHandler); + if (typeof document !== 'undefined') { + mxEvent.addListener(document, 'keydown', this.keyHandler); + mxEvent.addListener(document, 'keyup', this.keyHandler); + } } /** diff --git a/src/mxgraph/shape/mxShape.ts b/src/mxgraph/shape/mxShape.ts index 6f42e4ca8..98cd03389 100644 --- a/src/mxgraph/shape/mxShape.ts +++ b/src/mxgraph/shape/mxShape.ts @@ -11,7 +11,7 @@ import mxPoint from '../util/datatypes/mxPoint'; import mxSvgCanvas2D from '../util/canvas/mxSvgCanvas2D'; import mxEvent from '../util/event/mxEvent'; import mxClient from '../mxClient'; -import mxCellState from '../util/datatypes/mxCellState'; +import mxCellState from '../view/cell/mxCellState'; import mxAbstractCanvas2D from '../util/canvas/mxAbstractCanvas2D'; import mxStencil from './node/mxStencil'; import mxCellOverlay from "../view/cell/mxCellOverlay"; diff --git a/src/mxgraph/shape/mxText.ts b/src/mxgraph/shape/mxText.ts index d8ce1c9a8..a2236a4b7 100644 --- a/src/mxgraph/shape/mxText.ts +++ b/src/mxgraph/shape/mxText.ts @@ -12,7 +12,7 @@ import mxPoint from '../util/datatypes/mxPoint'; import mxSvgCanvas2D from '../util/canvas/mxSvgCanvas2D'; import mxShape from './mxShape'; import mxRectangle from '../util/datatypes/mxRectangle'; -import mxCellState from '../util/datatypes/mxCellState'; +import mxCellState from '../view/cell/mxCellState'; /** * Extends mxShape to implement a text shape. diff --git a/src/mxgraph/shape/node/mxImageShape.ts b/src/mxgraph/shape/node/mxImageShape.ts index b9d6e2317..a0f47ac5e 100644 --- a/src/mxgraph/shape/node/mxImageShape.ts +++ b/src/mxgraph/shape/node/mxImageShape.ts @@ -9,7 +9,7 @@ import mxUtils from '../../util/mxUtils'; import mxConstants from '../../util/mxConstants'; import mxRectangleShape from './mxRectangleShape'; import mxRectangle from '../../util/datatypes/mxRectangle'; -import mxCellState from '../../util/datatypes/mxCellState'; +import mxCellState from '../../view/cell/mxCellState'; import mxSvgCanvas2D from '../../util/canvas/mxSvgCanvas2D'; import mxCellOverlay from '../../view/cell/mxCellOverlay'; diff --git a/src/mxgraph/util/datatypes/style/mxEdgeStyle.js b/src/mxgraph/util/datatypes/style/mxEdgeStyle.js index 5e4787e54..79f29ec12 100644 --- a/src/mxgraph/util/datatypes/style/mxEdgeStyle.js +++ b/src/mxgraph/util/datatypes/style/mxEdgeStyle.js @@ -7,7 +7,7 @@ import mxUtils from '../../mxUtils'; import mxPoint from '../mxPoint'; -import mxCellState from '../mxCellState'; +import mxCellState from '../../../view/cell/mxCellState'; import mxConstants from '../../mxConstants'; import mxRectangle from '../mxRectangle'; diff --git a/src/mxgraph/util/datatypes/style/mxPerimeter.ts b/src/mxgraph/util/datatypes/style/mxPerimeter.ts index ed23b5e52..ceb2de5c9 100644 --- a/src/mxgraph/util/datatypes/style/mxPerimeter.ts +++ b/src/mxgraph/util/datatypes/style/mxPerimeter.ts @@ -9,7 +9,7 @@ import mxUtils from '../../mxUtils'; import mxPoint from '../mxPoint'; import mxConstants from '../../mxConstants'; import mxRectangle from '../mxRectangle'; -import mxCellState from '../mxCellState'; +import mxCellState from '../../../view/cell/mxCellState'; /** * @class mxPerimeter diff --git a/src/mxgraph/util/mxGuide.ts b/src/mxgraph/util/mxGuide.ts index fb6b29f70..dfd4f0e66 100644 --- a/src/mxgraph/util/mxGuide.ts +++ b/src/mxgraph/util/mxGuide.ts @@ -8,7 +8,7 @@ import mxConstants from './mxConstants'; import mxPoint from './datatypes/mxPoint'; import mxPolyline from '../shape/edge/mxPolyline'; -import mxCellState from './datatypes/mxCellState'; +import mxCellState from '../view/cell/mxCellState'; import mxShape from '../shape/mxShape'; import mxRectangle from './datatypes/mxRectangle'; import mxGraph from '../view/graph/mxGraph'; diff --git a/src/mxgraph/view/cell/mxCellEditor.ts b/src/mxgraph/view/cell/mxCellEditor.ts index 5c88c4874..11663d913 100644 --- a/src/mxgraph/view/cell/mxCellEditor.ts +++ b/src/mxgraph/view/cell/mxCellEditor.ts @@ -14,7 +14,7 @@ import mxText from '../../shape/mxText'; import mxGraph from '../graph/mxGraph'; import mxCell from './mxCell'; import mxMouseEvent from '../../util/event/mxMouseEvent'; -import mxCellState from '../../util/datatypes/mxCellState'; +import mxCellState from './mxCellState'; import mxShape from "../../shape/mxShape"; import mxEventObject from "../../util/event/mxEventObject"; diff --git a/src/mxgraph/view/cell/mxCellOverlay.ts b/src/mxgraph/view/cell/mxCellOverlay.ts index 2d516b3dd..acdb72d29 100644 --- a/src/mxgraph/view/cell/mxCellOverlay.ts +++ b/src/mxgraph/view/cell/mxCellOverlay.ts @@ -9,7 +9,7 @@ import mxPoint from '../../util/datatypes/mxPoint'; import mxRectangle from '../../util/datatypes/mxRectangle'; import mxEventSource from '../../util/event/mxEventSource'; import mxImage from '../../util/image/mxImage'; -import mxCellState from "../../util/datatypes/mxCellState"; +import mxCellState from "./mxCellState"; /** * Class: mxCellOverlay diff --git a/src/mxgraph/view/cell/mxCellRenderer.ts b/src/mxgraph/view/cell/mxCellRenderer.ts index dd261d392..2230eeae7 100644 --- a/src/mxgraph/view/cell/mxCellRenderer.ts +++ b/src/mxgraph/view/cell/mxCellRenderer.ts @@ -31,7 +31,7 @@ import mxDictionary from '../../util/datatypes/mxDictionary'; import mxEventObject from '../../util/event/mxEventObject'; import mxPoint from '../../util/datatypes/mxPoint'; import mxShape from '../../shape/mxShape'; -import mxCellState from '../../util/datatypes/mxCellState'; +import mxCellState from './mxCellState'; import mxCell from './mxCell'; import mxGraphModel from "../graph/mxGraphModel"; import mxCellOverlay from "./mxCellOverlay"; diff --git a/src/mxgraph/util/datatypes/mxCellState.ts b/src/mxgraph/view/cell/mxCellState.ts similarity index 97% rename from src/mxgraph/util/datatypes/mxCellState.ts rename to src/mxgraph/view/cell/mxCellState.ts index a439148c2..fe8b653f3 100644 --- a/src/mxgraph/util/datatypes/mxCellState.ts +++ b/src/mxgraph/view/cell/mxCellState.ts @@ -5,15 +5,15 @@ * Type definitions from the typed-mxgraph project */ -import mxPoint from './mxPoint'; -import mxRectangle from './mxRectangle'; -import mxConstants from '../mxConstants'; -import mxCell from '../../view/cell/mxCell'; -import mxGraphView from '../../view/graph/mxGraphView'; +import mxPoint from '../../util/datatypes/mxPoint'; +import mxRectangle from '../../util/datatypes/mxRectangle'; +import mxConstants from '../../util/mxConstants'; +import mxCell from './mxCell'; +import mxGraphView from '../graph/mxGraphView'; import mxShape from '../../shape/mxShape'; import mxText from '../../shape/mxText'; -import mxGraph from "../../view/graph/mxGraph"; -import mxDictionary from "./mxDictionary"; +import mxGraph from "../graph/mxGraph"; +import mxDictionary from "../../util/datatypes/mxDictionary"; /** * Class: mxCellState diff --git a/src/mxgraph/view/cell/mxCellStatePreview.ts b/src/mxgraph/view/cell/mxCellStatePreview.ts index c1458d726..40fe704ea 100644 --- a/src/mxgraph/view/cell/mxCellStatePreview.ts +++ b/src/mxgraph/view/cell/mxCellStatePreview.ts @@ -8,7 +8,7 @@ import mxUtils from '../../util/mxUtils'; import mxPoint from '../../util/datatypes/mxPoint'; import mxDictionary from '../../util/datatypes/mxDictionary'; -import mxCellState from '../../util/datatypes/mxCellState'; +import mxCellState from './mxCellState'; import mxCell from './mxCell'; import mxGraph from '../graph/mxGraph'; import mxGraphView from "../graph/mxGraphView"; diff --git a/src/mxgraph/view/cell/mxTemporaryCellStates.ts b/src/mxgraph/view/cell/mxTemporaryCellStates.ts index 36b207a38..4a2b59a7d 100644 --- a/src/mxgraph/view/cell/mxTemporaryCellStates.ts +++ b/src/mxgraph/view/cell/mxTemporaryCellStates.ts @@ -12,7 +12,7 @@ import mxRectangle from '../../util/datatypes/mxRectangle'; import mxDictionary from '../../util/datatypes/mxDictionary'; import mxGraphView from '../graph/mxGraphView'; import mxCell from './mxCell'; -import mxCellState from '../../util/datatypes/mxCellState'; +import mxCellState from './mxCellState'; import mxShape from "../../shape/mxShape"; import mxGraph from "../graph/mxGraph"; diff --git a/src/mxgraph/view/graph/mxGraph.ts b/src/mxgraph/view/graph/mxGraph.ts index 14ecd920f..559498ab3 100644 --- a/src/mxgraph/view/graph/mxGraph.ts +++ b/src/mxgraph/view/graph/mxGraph.ts @@ -48,7 +48,7 @@ import mxStyleChange from '../../atomic_changes/mxStyleChange'; import mxTerminalChange from '../../atomic_changes/mxTerminalChange'; import mxValueChange from '../../atomic_changes/mxValueChange'; import mxPolyline from '../../shape/edge/mxPolyline'; -import mxCellState from '../../util/datatypes/mxCellState'; +import mxCellState from '../cell/mxCellState'; import mxImageBundle from "../../util/image/mxImageBundle"; import mxCodecRegistry from "../../serialization/mxCodecRegistry"; import mxShape from "../../shape/mxShape"; diff --git a/src/mxgraph/view/graph/mxGraphView.ts b/src/mxgraph/view/graph/mxGraphView.ts index 2b4432fe9..e755da856 100644 --- a/src/mxgraph/view/graph/mxGraphView.ts +++ b/src/mxgraph/view/graph/mxGraphView.ts @@ -17,7 +17,7 @@ import mxEvent from '../../util/event/mxEvent'; import mxUtils from '../../util/mxUtils'; import mxLog from '../../util/gui/mxLog'; import mxResources from '../../util/mxResources'; -import mxCellState from '../../util/datatypes/mxCellState'; +import mxCellState from '../cell/mxCellState'; import mxUndoableEdit from '../../util/undo/mxUndoableEdit'; import mxImageShape from '../../shape/node/mxImageShape'; import mxMouseEvent from '../../util/event/mxMouseEvent'; diff --git a/src/pages/connections/Anchors.js b/src/pages/connections/Anchors.js index 929c443f6..b7ff28ae9 100644 --- a/src/pages/connections/Anchors.js +++ b/src/pages/connections/Anchors.js @@ -11,7 +11,7 @@ import mxShape from '../../mxgraph/shape/mxShape'; import mxConnectionConstraint from '../../mxgraph/view/connection/mxConnectionConstraint'; import mxPoint from '../../mxgraph/util/datatypes/mxPoint'; import mxPolyline from '../../mxgraph/shape/edge/mxPolyline'; -import mxCellState from '../../mxgraph/util/datatypes/mxCellState'; +import mxCellState from '../../mxgraph/view/cell/mxCellState'; import mxGeometry from '../../mxgraph/util/datatypes/mxGeometry'; import mxConnectionHandler from '../../mxgraph/handler/mxConnectionHandler'; diff --git a/src/pages/connections/FixedPoints.js b/src/pages/connections/FixedPoints.js index 59b998af8..df7e5ab3c 100644 --- a/src/pages/connections/FixedPoints.js +++ b/src/pages/connections/FixedPoints.js @@ -12,7 +12,7 @@ import mxConnectionHandler from '../../mxgraph/handler/mxConnectionHandler'; import mxEdgeHandler from '../../mxgraph/handler/mxEdgeHandler'; import mxConnectionConstraint from '../../mxgraph/view/connection/mxConnectionConstraint'; import mxPoint from '../../mxgraph/util/datatypes/mxPoint'; -import mxCellState from '../../mxgraph/util/datatypes/mxCellState'; +import mxCellState from '../../mxgraph/view/cell/mxCellState'; class FixedPoints extends React.Component { constructor(props) { diff --git a/src/pages/connections/Orthogonal.js b/src/pages/connections/Orthogonal.js index b17f9bfc1..2dd2d7bb9 100644 --- a/src/pages/connections/Orthogonal.js +++ b/src/pages/connections/Orthogonal.js @@ -13,7 +13,7 @@ import mxEdgeHandler from '../../mxgraph/handler/mxEdgeHandler'; import mxConnectionHandler from '../../mxgraph/handler/mxConnectionHandler'; import mxGraphView from '../../mxgraph/view/graph/mxGraphView'; import mxPoint from '../../mxgraph/util/datatypes/mxPoint'; -import mxCellState from '../../mxgraph/util/datatypes/mxCellState'; +import mxCellState from '../../mxgraph/view/cell/mxCellState'; class Orthogonal extends React.Component { constructor(props) {