orcasvn-react-diagrams 0.1.17 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +13 -10
- package/dist/cjs/types/components/paper.d.ts +0 -1
- package/dist/cjs/types/mocks/diamondElement.d.ts +11 -0
- package/dist/cjs/types/mocks/rectangularFrameElement.d.ts +11 -0
- package/dist/cjs/types/models/IEditorContext.d.ts +34 -0
- package/dist/cjs/types/models/IElement.d.ts +2 -0
- package/dist/cjs/types/models/implementations/EditorContext.d.ts +4 -2
- package/dist/cjs/types/models/implementations/Element.d.ts +2 -0
- package/dist/esm/index.js +13 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/paper.d.ts +0 -1
- package/dist/esm/types/mocks/diamondElement.d.ts +11 -0
- package/dist/esm/types/mocks/rectangularFrameElement.d.ts +11 -0
- package/dist/esm/types/models/IEditorContext.d.ts +34 -0
- package/dist/esm/types/models/IElement.d.ts +2 -0
- package/dist/esm/types/models/implementations/EditorContext.d.ts +4 -2
- package/dist/esm/types/models/implementations/Element.d.ts +2 -0
- package/dist/index.d.ts +35 -2
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -466,6 +466,12 @@ var Element$1 = /** @class */ (function () {
|
|
|
466
466
|
this.textsPlaceHolderFlexStyle = textsPlaceHolderFlexStyle;
|
|
467
467
|
this.textsPlaceHolderFlexboxPosition = textsPlaceHolderFlexboxPosition;
|
|
468
468
|
}
|
|
469
|
+
Element.prototype.manuallyTriggerRender = function () {
|
|
470
|
+
//TODO: Implement this
|
|
471
|
+
};
|
|
472
|
+
Element.prototype.manuallyTriggerRenderPort = function (portId) {
|
|
473
|
+
//TODO: Implement this
|
|
474
|
+
};
|
|
469
475
|
Object.defineProperty(Element.prototype, "id", {
|
|
470
476
|
get: function () {
|
|
471
477
|
return this._id;
|
|
@@ -797,6 +803,12 @@ var EditorContext = /** @class */ (function () {
|
|
|
797
803
|
EditorContext.prototype.removeText = function (textId) {
|
|
798
804
|
this._texts = this._texts.filter(function (t) { return t.id !== textId; });
|
|
799
805
|
};
|
|
806
|
+
EditorContext.prototype.triggerRenderElement = function (elementId) {
|
|
807
|
+
//TODO: to be implemented
|
|
808
|
+
};
|
|
809
|
+
EditorContext.prototype.triggerRenderPort = function (portId, elementId) {
|
|
810
|
+
//TODO: to be implemented
|
|
811
|
+
};
|
|
800
812
|
return EditorContext;
|
|
801
813
|
}());
|
|
802
814
|
|
|
@@ -9912,15 +9924,6 @@ var Paper = function (props) {
|
|
|
9912
9924
|
if (!newElementLink.points || newElementLink.points.length === 0) {
|
|
9913
9925
|
newElementLink = automationAddPointsToLink(newElementLink, MAX_LINK_KNOT_COUNT);
|
|
9914
9926
|
}
|
|
9915
|
-
var isValid = true;
|
|
9916
|
-
//Validate element link
|
|
9917
|
-
if (props.onLinkValidation && newElementLink.targetPort && newElementLink.targetElement) {
|
|
9918
|
-
isValid = props.onLinkValidation(newElementLink.sourcePort, newElementLink.sourceElement, newElementLink.targetPort, newElementLink.targetElement);
|
|
9919
|
-
}
|
|
9920
|
-
if (!isValid) {
|
|
9921
|
-
console.info("Link cancelled by validation");
|
|
9922
|
-
return null;
|
|
9923
|
-
}
|
|
9924
9927
|
return newElementLink;
|
|
9925
9928
|
};
|
|
9926
9929
|
var handlePortMouseUp = function (ev, port, elementId) {
|
|
@@ -10226,7 +10229,7 @@ var Paper = function (props) {
|
|
|
10226
10229
|
function Editor(_a) {
|
|
10227
10230
|
var editorContext = _a.editorContext;
|
|
10228
10231
|
return (React$1.createElement(React$1.Fragment, null,
|
|
10229
|
-
React$1.createElement(Paper, { size: { width: 3000, height: 3000 }, elements: editorContext.elements, links: editorContext.links, texts: editorContext.texts, onPaperClicked: editorContext.onPaperClicked, onPortMoved: editorContext.onPortMoved, onPortSelected: editorContext.onPortSelected, onElementContextMenu: editorContext.onElementContextMenu, onElementMoved: editorContext.onElementMoved, onElementResized: editorContext.onElementResized, onElementSelected: editorContext.onElementSelected,
|
|
10232
|
+
React$1.createElement(Paper, { size: { width: 3000, height: 3000 }, elements: editorContext.elements, links: editorContext.links, texts: editorContext.texts, onPaperClicked: editorContext.onPaperClicked, onPortMoved: editorContext.onPortMoved, onPortSelected: editorContext.onPortSelected, onElementContextMenu: editorContext.onElementContextMenu, onElementMoved: editorContext.onElementMoved, onElementResized: editorContext.onElementResized, onElementSelected: editorContext.onElementSelected, onCreatingLink: editorContext.onCreatingLink, onCreatingPortByLinking: editorContext.onCreatingPortByLinking, onLinkSelected: editorContext.onLinkSelected, onTextSelected: editorContext.onTextSelected })));
|
|
10230
10233
|
}
|
|
10231
10234
|
|
|
10232
10235
|
exports.CircleRC = Circle;
|
|
@@ -20,7 +20,6 @@ interface PaperProps {
|
|
|
20
20
|
onElementMoved?: (position: IPosition, element: IElement, index: number) => void;
|
|
21
21
|
onElementResized?: (size: ISize, element: IElement, index: number) => void;
|
|
22
22
|
onElementSelected?: (element: IElement) => void;
|
|
23
|
-
onLinkValidation?: (sourcePort: IPort, sourceElement: IElement, targetPort: IPort, targetElement: IElement) => boolean;
|
|
24
23
|
onLinkSelected?: (link: IElementLink) => void;
|
|
25
24
|
onTextSelected?: (text: IText) => void;
|
|
26
25
|
onCreatingPortByLinking?: (sourceElement: IElement, sourcePort: IPort, targetElement: IElement, position: IPosition) => IPort | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Element from "../models/implementations/Element";
|
|
2
|
+
import ISize from "../models/size";
|
|
3
|
+
import IResizability from "../models/IResizability";
|
|
4
|
+
import IPort from "../models/IPort";
|
|
5
|
+
import IText from "../models/IText";
|
|
6
|
+
export default class DiamondElement extends Element {
|
|
7
|
+
resizability: IResizability;
|
|
8
|
+
get size(): ISize;
|
|
9
|
+
set size(value: ISize);
|
|
10
|
+
constructor(x: number, y: number, width: number, height: number, cssClass?: string, texts?: IText[], ports?: IPort[]);
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Element from "../models/implementations/Element";
|
|
2
|
+
import IResizability from "../models/IResizability";
|
|
3
|
+
import IPort from "../models/IPort";
|
|
4
|
+
import IText from "../models/IText";
|
|
5
|
+
import IFlexboxType from '../models/IFlexboxType';
|
|
6
|
+
import IPosition from '../models/position';
|
|
7
|
+
export default class RectangularFrameElement extends Element {
|
|
8
|
+
resizability: IResizability;
|
|
9
|
+
defaultPortSize?: number | undefined;
|
|
10
|
+
constructor(x: number, y: number, width: number, height: number, cssClass?: string, texts?: IText[], ports?: IPort[], textsPlaceHolderClassName?: string, textsPlaceHolderFlexStyle?: IFlexboxType, textsPlaceHolderFlexboxPosition?: IPosition);
|
|
11
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import IElement from "./IElement";
|
|
3
|
+
import IElementLink from "./IElementLink";
|
|
4
|
+
import IPort from "./IPort";
|
|
5
|
+
import IText, { IPaperText } from "./IText";
|
|
6
|
+
import IPosition from "./position";
|
|
7
|
+
import ISize from "./size";
|
|
8
|
+
export interface IEditorContext {
|
|
9
|
+
elements: IElement[];
|
|
10
|
+
links: IElementLink[];
|
|
11
|
+
texts: IPaperText[];
|
|
12
|
+
onPaperClicked?: () => void;
|
|
13
|
+
onPortMoved?: (position: IPosition, port: IPort, element: IElement) => void;
|
|
14
|
+
onPortSelected?: (port: IPort, element: IElement) => void;
|
|
15
|
+
onElementContextMenu?: (element: IElement, mouseEvent: React.MouseEvent<SVGElement>) => void;
|
|
16
|
+
onElementMoved?: (position: IPosition, element: IElement, index: number) => void;
|
|
17
|
+
onElementResized?: (size: ISize, element: IElement, index: number) => void;
|
|
18
|
+
onElementSelected?: (element: IElement) => void;
|
|
19
|
+
onCreatingPortByLinking?: (sourceElement: IElement, sourcePort: IPort, targetElement: IElement, position: IPosition) => IPort | null;
|
|
20
|
+
onCreatingLink?: (sourcePort: IPort, sourceElement: IElement, targetPort: IPort, targetElement: IElement) => IElementLink | null;
|
|
21
|
+
onLinkSelected?: (link: IElementLink) => void;
|
|
22
|
+
onTextSelected?: (text: IText) => void;
|
|
23
|
+
getElement(elementId: string): IElement | undefined;
|
|
24
|
+
addElement(element: IElement): void;
|
|
25
|
+
removeElement(elementId: string): void;
|
|
26
|
+
getLink(linkId: string): IElementLink | undefined;
|
|
27
|
+
addLink(link: IElementLink): void;
|
|
28
|
+
removeLink(linkId: string): void;
|
|
29
|
+
getText(textId: string): IPaperText | undefined;
|
|
30
|
+
addText(text: IPaperText): void;
|
|
31
|
+
removeText(textId: string): void;
|
|
32
|
+
triggerRenderElement(elementId: string): void;
|
|
33
|
+
triggerRenderPort(portId: string, elementId: string): void;
|
|
34
|
+
}
|
|
@@ -26,10 +26,12 @@ export default interface IElement {
|
|
|
26
26
|
defaultPortSize?: number;
|
|
27
27
|
parentElement?: IElement;
|
|
28
28
|
onParentChanged?: (callback: (oldParent?: IElement, newParent?: IElement) => void) => (() => void);
|
|
29
|
+
manuallyTriggerRender: () => void;
|
|
29
30
|
addPort: (newPort: IPort) => void;
|
|
30
31
|
onAddedPort: (callback: (newPort: IPort) => void) => (() => void);
|
|
31
32
|
deletePort: (id: string) => void;
|
|
32
33
|
onDeletedPort: (callback: (id: string) => void) => (() => void);
|
|
34
|
+
manuallyTriggerRenderPort: (portId: string) => void;
|
|
33
35
|
textsPlaceHolderClassName?: string;
|
|
34
36
|
textsPlaceHolderFlexStyle?: IFlexboxType;
|
|
35
37
|
textsPlaceHolderFlexboxPosition?: IPosition;
|
|
@@ -5,7 +5,8 @@ import IText, { IPaperText } from "../IText";
|
|
|
5
5
|
import IPosition from "../position";
|
|
6
6
|
import IPort from "../IPort";
|
|
7
7
|
import ISize from "../size";
|
|
8
|
-
|
|
8
|
+
import { IEditorContext } from "../IEditorContext";
|
|
9
|
+
export declare class EditorContext implements IEditorContext {
|
|
9
10
|
private _elements;
|
|
10
11
|
private _links;
|
|
11
12
|
private _texts;
|
|
@@ -16,7 +17,6 @@ export declare class EditorContext {
|
|
|
16
17
|
onElementMoved?: (position: IPosition, element: IElement, index: number) => void;
|
|
17
18
|
onElementResized?: (size: ISize, element: IElement, index: number) => void;
|
|
18
19
|
onElementSelected?: (element: IElement) => void;
|
|
19
|
-
validateLink?: (sourcePort: IPort, sourceElement: IElement, targetPort: IPort, targetElement: IElement) => boolean;
|
|
20
20
|
onCreatingPortByLinking?: (sourceElement: IElement, sourcePort: IPort, targetElement: IElement, position: IPosition) => IPort | null;
|
|
21
21
|
onCreatingLink?: (sourcePort: IPort, sourceElement: IElement, targetPort: IPort, targetElement: IElement) => IElementLink | null;
|
|
22
22
|
onLinkSelected?: (link: IElementLink) => void;
|
|
@@ -34,4 +34,6 @@ export declare class EditorContext {
|
|
|
34
34
|
getText(textId: string): IPaperText | undefined;
|
|
35
35
|
addText(text: IPaperText): void;
|
|
36
36
|
removeText(textId: string): void;
|
|
37
|
+
triggerRenderElement(elementId: string): void;
|
|
38
|
+
triggerRenderPort(portId: string, elementId: string): void;
|
|
37
39
|
}
|
|
@@ -34,6 +34,8 @@ export default class Element implements IElement {
|
|
|
34
34
|
textsPlaceHolderFlexboxPosition?: IPosition;
|
|
35
35
|
_eventEmitter: EventEmitter;
|
|
36
36
|
constructor(x: number, y: number, width: number, height: number, cssClass?: string, renderShape?: (props: IElementProps) => JSX.Element, texts?: IText[], ports?: IPort[], portMovealeAreas?: IPosition[][], portSlideRailSVGClassName?: string, portDirection?: SubObjectDirection, parentElement?: Element, textsPlaceHolderClassName?: string, textsPlaceHolderFlexStyle?: IFlexboxType, textsPlaceHolderFlexboxPosition?: IPosition);
|
|
37
|
+
manuallyTriggerRender(): void;
|
|
38
|
+
manuallyTriggerRenderPort(portId: string): void;
|
|
37
39
|
get id(): string;
|
|
38
40
|
get size(): ISize;
|
|
39
41
|
set size(value: ISize);
|
package/dist/esm/index.js
CHANGED
|
@@ -462,6 +462,12 @@ var Element$1 = /** @class */ (function () {
|
|
|
462
462
|
this.textsPlaceHolderFlexStyle = textsPlaceHolderFlexStyle;
|
|
463
463
|
this.textsPlaceHolderFlexboxPosition = textsPlaceHolderFlexboxPosition;
|
|
464
464
|
}
|
|
465
|
+
Element.prototype.manuallyTriggerRender = function () {
|
|
466
|
+
//TODO: Implement this
|
|
467
|
+
};
|
|
468
|
+
Element.prototype.manuallyTriggerRenderPort = function (portId) {
|
|
469
|
+
//TODO: Implement this
|
|
470
|
+
};
|
|
465
471
|
Object.defineProperty(Element.prototype, "id", {
|
|
466
472
|
get: function () {
|
|
467
473
|
return this._id;
|
|
@@ -793,6 +799,12 @@ var EditorContext = /** @class */ (function () {
|
|
|
793
799
|
EditorContext.prototype.removeText = function (textId) {
|
|
794
800
|
this._texts = this._texts.filter(function (t) { return t.id !== textId; });
|
|
795
801
|
};
|
|
802
|
+
EditorContext.prototype.triggerRenderElement = function (elementId) {
|
|
803
|
+
//TODO: to be implemented
|
|
804
|
+
};
|
|
805
|
+
EditorContext.prototype.triggerRenderPort = function (portId, elementId) {
|
|
806
|
+
//TODO: to be implemented
|
|
807
|
+
};
|
|
796
808
|
return EditorContext;
|
|
797
809
|
}());
|
|
798
810
|
|
|
@@ -9908,15 +9920,6 @@ var Paper = function (props) {
|
|
|
9908
9920
|
if (!newElementLink.points || newElementLink.points.length === 0) {
|
|
9909
9921
|
newElementLink = automationAddPointsToLink(newElementLink, MAX_LINK_KNOT_COUNT);
|
|
9910
9922
|
}
|
|
9911
|
-
var isValid = true;
|
|
9912
|
-
//Validate element link
|
|
9913
|
-
if (props.onLinkValidation && newElementLink.targetPort && newElementLink.targetElement) {
|
|
9914
|
-
isValid = props.onLinkValidation(newElementLink.sourcePort, newElementLink.sourceElement, newElementLink.targetPort, newElementLink.targetElement);
|
|
9915
|
-
}
|
|
9916
|
-
if (!isValid) {
|
|
9917
|
-
console.info("Link cancelled by validation");
|
|
9918
|
-
return null;
|
|
9919
|
-
}
|
|
9920
9923
|
return newElementLink;
|
|
9921
9924
|
};
|
|
9922
9925
|
var handlePortMouseUp = function (ev, port, elementId) {
|
|
@@ -10222,7 +10225,7 @@ var Paper = function (props) {
|
|
|
10222
10225
|
function Editor(_a) {
|
|
10223
10226
|
var editorContext = _a.editorContext;
|
|
10224
10227
|
return (React$1.createElement(React$1.Fragment, null,
|
|
10225
|
-
React$1.createElement(Paper, { size: { width: 3000, height: 3000 }, elements: editorContext.elements, links: editorContext.links, texts: editorContext.texts, onPaperClicked: editorContext.onPaperClicked, onPortMoved: editorContext.onPortMoved, onPortSelected: editorContext.onPortSelected, onElementContextMenu: editorContext.onElementContextMenu, onElementMoved: editorContext.onElementMoved, onElementResized: editorContext.onElementResized, onElementSelected: editorContext.onElementSelected,
|
|
10228
|
+
React$1.createElement(Paper, { size: { width: 3000, height: 3000 }, elements: editorContext.elements, links: editorContext.links, texts: editorContext.texts, onPaperClicked: editorContext.onPaperClicked, onPortMoved: editorContext.onPortMoved, onPortSelected: editorContext.onPortSelected, onElementContextMenu: editorContext.onElementContextMenu, onElementMoved: editorContext.onElementMoved, onElementResized: editorContext.onElementResized, onElementSelected: editorContext.onElementSelected, onCreatingLink: editorContext.onCreatingLink, onCreatingPortByLinking: editorContext.onCreatingPortByLinking, onLinkSelected: editorContext.onLinkSelected, onTextSelected: editorContext.onTextSelected })));
|
|
10226
10229
|
}
|
|
10227
10230
|
|
|
10228
10231
|
export { Circle as CircleRC, Crescent as CrescentRC, CustomShape as CustomShapeRC, EditorContext, Element$1 as Element, ElementLink$1 as ElementLink, ElementLink as ElementLinkRC, Port$1 as Port, Port as PortRC, PositioningAnchor, Rectangle as RectangleRC, RectangularFrame as RectangularFrameRC, ResizingDirection, ShapeWrapper as ShapeWrapperRC, SubObjectDirection, Text$2 as Text, TextAlign, Text$1 as TextRC, Editor as default };
|