@metadev/daga 3.1.2 → 3.1.4
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/Changelog.md
CHANGED
|
@@ -6,6 +6,16 @@ List of releases and changes.
|
|
|
6
6
|
|
|
7
7
|
## Next release Joyeuse
|
|
8
8
|
|
|
9
|
+
## v. 3.1.4
|
|
10
|
+
|
|
11
|
+
- Make dragging the palette node templates create a clone of the node appended to the diagram root instead of a child of the palette to prevent the palette from being affected by CSS transforms on the diagram [#224](https://github.com/metadevpro/daga/pull/224)
|
|
12
|
+
|
|
13
|
+
## v. 3.1.3
|
|
14
|
+
|
|
15
|
+
Date: _2025-01-26_
|
|
16
|
+
|
|
17
|
+
- Fix null-check on `DiagramField` setter [#223](https://github.com/metadevpro/daga/pull/223)
|
|
18
|
+
|
|
9
19
|
## v. 3.1.2
|
|
10
20
|
|
|
11
21
|
Date: _2025-01-24_
|
package/index.cjs.js
CHANGED
|
@@ -1992,7 +1992,7 @@ class DiagramField extends DiagramElement {
|
|
|
1992
1992
|
}
|
|
1993
1993
|
set text(value) {
|
|
1994
1994
|
var _a;
|
|
1995
|
-
if (value.trim() === '') {
|
|
1995
|
+
if (value === null || value === undefined || (value === null || value === undefined ? undefined : value.trim()) === '') {
|
|
1996
1996
|
value = this.defaultText;
|
|
1997
1997
|
}
|
|
1998
1998
|
this._text = value;
|
|
@@ -5331,7 +5331,7 @@ class DiagramContextMenu {
|
|
|
5331
5331
|
const coordsRelativeToRoot = this.canvas.getPointerLocationRelativeToRoot(event);
|
|
5332
5332
|
const coordsRelativeToCanvas = this.canvas.getPointerLocationRelativeToCanvas(event);
|
|
5333
5333
|
// append to the root (svg) element so the context menu is not affected by zoom transforms on the canvas view
|
|
5334
|
-
const contextMenuContainer = this.canvas.
|
|
5334
|
+
const contextMenuContainer = this.canvas.selectSVGElement().append('foreignObject').attr('class', 'daga-context-menu').attr('x', `${coordsRelativeToRoot[0] - CONTEXT_MENU_TOTAL_RADIUS}px`).attr('y', `${coordsRelativeToRoot[1] - CONTEXT_MENU_TOTAL_RADIUS}px`).attr('width', `${2 * CONTEXT_MENU_TOTAL_RADIUS}px`).attr('height', `${2 * CONTEXT_MENU_TOTAL_RADIUS}px`).style('pointer-events', 'none').on(exports.Events.ContextMenu, newEvent => {
|
|
5335
5335
|
if (this.canvas.canUserPerformAction(exports.DiagramActions.ContextMenu)) {
|
|
5336
5336
|
event.preventDefault();
|
|
5337
5337
|
this.open(newEvent);
|
|
@@ -6153,7 +6153,7 @@ class DiagramCanvas {
|
|
|
6153
6153
|
this.translateBy(0, this.panRate / this.zoomTransform.k);
|
|
6154
6154
|
}
|
|
6155
6155
|
});
|
|
6156
|
-
const canvasView = this.
|
|
6156
|
+
const canvasView = this.selectSVGElement().append('g').attr('class', 'daga-canvas-view').attr('width', `100%`).attr('height', `100%`);
|
|
6157
6157
|
const canvasBackground = canvasView.append('rect').attr('x', 0).attr('y', 0).attr('width', `100%`).attr('height', `100%`).attr('fill', this.backgroundColor).attr('stroke-width', '0').on(exports.Events.MouseMove, event => {
|
|
6158
6158
|
if (this.unfinishedConnection !== undefined) {
|
|
6159
6159
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
@@ -6274,7 +6274,7 @@ class DiagramCanvas {
|
|
|
6274
6274
|
}
|
|
6275
6275
|
getCoordinatesOnScreen() {
|
|
6276
6276
|
var _a;
|
|
6277
|
-
const rootBoundingClientRect = (_a = this.
|
|
6277
|
+
const rootBoundingClientRect = (_a = this.selectSVGElement().node()) === null || _a === undefined ? undefined : _a.getBoundingClientRect();
|
|
6278
6278
|
const rootDimensions = [(rootBoundingClientRect === null || rootBoundingClientRect === undefined ? undefined : rootBoundingClientRect.width) || 0, (rootBoundingClientRect === null || rootBoundingClientRect === undefined ? undefined : rootBoundingClientRect.height) || 0];
|
|
6279
6279
|
return [[-this.zoomTransform.x / this.zoomTransform.k, -this.zoomTransform.y / this.zoomTransform.k], [(rootDimensions[0] - this.zoomTransform.x) / this.zoomTransform.k, (rootDimensions[1] - this.zoomTransform.y) / this.zoomTransform.k]];
|
|
6280
6280
|
}
|
|
@@ -6298,7 +6298,7 @@ class DiagramCanvas {
|
|
|
6298
6298
|
return d3__namespace.pointer(this.getEventHoldingCoordinates(event), this.selectCanvasElements().node());
|
|
6299
6299
|
}
|
|
6300
6300
|
getPointerLocationRelativeToRoot(event) {
|
|
6301
|
-
return d3__namespace.pointer(this.getEventHoldingCoordinates(event), this.
|
|
6301
|
+
return d3__namespace.pointer(this.getEventHoldingCoordinates(event), this.selectSVGElement().node());
|
|
6302
6302
|
}
|
|
6303
6303
|
getPointerLocationRelativeToBody(event) {
|
|
6304
6304
|
return d3__namespace.pointer(this.getEventHoldingCoordinates(event), d3__namespace.select('body').node());
|
|
@@ -7515,13 +7515,16 @@ class DiagramCanvas {
|
|
|
7515
7515
|
}
|
|
7516
7516
|
}
|
|
7517
7517
|
selectRoot() {
|
|
7518
|
+
return d3__namespace.select(this.diagramRoot);
|
|
7519
|
+
}
|
|
7520
|
+
selectSVGElement() {
|
|
7518
7521
|
return d3__namespace.select(this.diagramRoot).select('svg');
|
|
7519
7522
|
}
|
|
7520
7523
|
selectCanvasView() {
|
|
7521
|
-
return this.
|
|
7524
|
+
return this.selectSVGElement().select(`.daga-canvas-view`);
|
|
7522
7525
|
}
|
|
7523
7526
|
selectCanvasElements() {
|
|
7524
|
-
return this.
|
|
7527
|
+
return this.selectSVGElement().select(`.daga-canvas-elements`);
|
|
7525
7528
|
}
|
|
7526
7529
|
// User actions
|
|
7527
7530
|
startConnection(port) {
|
|
@@ -8753,6 +8756,7 @@ exports.DiagramEntitySet = DiagramEntitySet;
|
|
|
8753
8756
|
exports.DiagramEvent = DiagramEvent;
|
|
8754
8757
|
exports.DiagramField = DiagramField;
|
|
8755
8758
|
exports.DiagramFieldSet = DiagramFieldSet;
|
|
8759
|
+
exports.DiagramHighlightedEvent = DiagramHighlightedEvent;
|
|
8756
8760
|
exports.DiagramModel = DiagramModel;
|
|
8757
8761
|
exports.DiagramNode = DiagramNode;
|
|
8758
8762
|
exports.DiagramNodeSet = DiagramNodeSet;
|
|
@@ -8764,6 +8768,7 @@ exports.DiagramPortSet = DiagramPortSet;
|
|
|
8764
8768
|
exports.DiagramSecondaryClickEvent = DiagramSecondaryClickEvent;
|
|
8765
8769
|
exports.DiagramSection = DiagramSection;
|
|
8766
8770
|
exports.DiagramSectionSet = DiagramSectionSet;
|
|
8771
|
+
exports.DiagramSelectionEvent = DiagramSelectionEvent;
|
|
8767
8772
|
exports.DiagramUserHighlight = DiagramUserHighlight;
|
|
8768
8773
|
exports.DiagramUserSelection = DiagramUserSelection;
|
|
8769
8774
|
exports.EditFieldAction = EditFieldAction;
|
package/index.esm.js
CHANGED
|
@@ -1971,7 +1971,7 @@ class DiagramField extends DiagramElement {
|
|
|
1971
1971
|
}
|
|
1972
1972
|
set text(value) {
|
|
1973
1973
|
var _a;
|
|
1974
|
-
if (value.trim() === '') {
|
|
1974
|
+
if (value === null || value === undefined || (value === null || value === undefined ? undefined : value.trim()) === '') {
|
|
1975
1975
|
value = this.defaultText;
|
|
1976
1976
|
}
|
|
1977
1977
|
this._text = value;
|
|
@@ -5310,7 +5310,7 @@ class DiagramContextMenu {
|
|
|
5310
5310
|
const coordsRelativeToRoot = this.canvas.getPointerLocationRelativeToRoot(event);
|
|
5311
5311
|
const coordsRelativeToCanvas = this.canvas.getPointerLocationRelativeToCanvas(event);
|
|
5312
5312
|
// append to the root (svg) element so the context menu is not affected by zoom transforms on the canvas view
|
|
5313
|
-
const contextMenuContainer = this.canvas.
|
|
5313
|
+
const contextMenuContainer = this.canvas.selectSVGElement().append('foreignObject').attr('class', 'daga-context-menu').attr('x', `${coordsRelativeToRoot[0] - CONTEXT_MENU_TOTAL_RADIUS}px`).attr('y', `${coordsRelativeToRoot[1] - CONTEXT_MENU_TOTAL_RADIUS}px`).attr('width', `${2 * CONTEXT_MENU_TOTAL_RADIUS}px`).attr('height', `${2 * CONTEXT_MENU_TOTAL_RADIUS}px`).style('pointer-events', 'none').on(Events.ContextMenu, newEvent => {
|
|
5314
5314
|
if (this.canvas.canUserPerformAction(DiagramActions.ContextMenu)) {
|
|
5315
5315
|
event.preventDefault();
|
|
5316
5316
|
this.open(newEvent);
|
|
@@ -6132,7 +6132,7 @@ class DiagramCanvas {
|
|
|
6132
6132
|
this.translateBy(0, this.panRate / this.zoomTransform.k);
|
|
6133
6133
|
}
|
|
6134
6134
|
});
|
|
6135
|
-
const canvasView = this.
|
|
6135
|
+
const canvasView = this.selectSVGElement().append('g').attr('class', 'daga-canvas-view').attr('width', `100%`).attr('height', `100%`);
|
|
6136
6136
|
const canvasBackground = canvasView.append('rect').attr('x', 0).attr('y', 0).attr('width', `100%`).attr('height', `100%`).attr('fill', this.backgroundColor).attr('stroke-width', '0').on(Events.MouseMove, event => {
|
|
6137
6137
|
if (this.unfinishedConnection !== undefined) {
|
|
6138
6138
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
@@ -6253,7 +6253,7 @@ class DiagramCanvas {
|
|
|
6253
6253
|
}
|
|
6254
6254
|
getCoordinatesOnScreen() {
|
|
6255
6255
|
var _a;
|
|
6256
|
-
const rootBoundingClientRect = (_a = this.
|
|
6256
|
+
const rootBoundingClientRect = (_a = this.selectSVGElement().node()) === null || _a === undefined ? undefined : _a.getBoundingClientRect();
|
|
6257
6257
|
const rootDimensions = [(rootBoundingClientRect === null || rootBoundingClientRect === undefined ? undefined : rootBoundingClientRect.width) || 0, (rootBoundingClientRect === null || rootBoundingClientRect === undefined ? undefined : rootBoundingClientRect.height) || 0];
|
|
6258
6258
|
return [[-this.zoomTransform.x / this.zoomTransform.k, -this.zoomTransform.y / this.zoomTransform.k], [(rootDimensions[0] - this.zoomTransform.x) / this.zoomTransform.k, (rootDimensions[1] - this.zoomTransform.y) / this.zoomTransform.k]];
|
|
6259
6259
|
}
|
|
@@ -6277,7 +6277,7 @@ class DiagramCanvas {
|
|
|
6277
6277
|
return d3.pointer(this.getEventHoldingCoordinates(event), this.selectCanvasElements().node());
|
|
6278
6278
|
}
|
|
6279
6279
|
getPointerLocationRelativeToRoot(event) {
|
|
6280
|
-
return d3.pointer(this.getEventHoldingCoordinates(event), this.
|
|
6280
|
+
return d3.pointer(this.getEventHoldingCoordinates(event), this.selectSVGElement().node());
|
|
6281
6281
|
}
|
|
6282
6282
|
getPointerLocationRelativeToBody(event) {
|
|
6283
6283
|
return d3.pointer(this.getEventHoldingCoordinates(event), d3.select('body').node());
|
|
@@ -7494,13 +7494,16 @@ class DiagramCanvas {
|
|
|
7494
7494
|
}
|
|
7495
7495
|
}
|
|
7496
7496
|
selectRoot() {
|
|
7497
|
+
return d3.select(this.diagramRoot);
|
|
7498
|
+
}
|
|
7499
|
+
selectSVGElement() {
|
|
7497
7500
|
return d3.select(this.diagramRoot).select('svg');
|
|
7498
7501
|
}
|
|
7499
7502
|
selectCanvasView() {
|
|
7500
|
-
return this.
|
|
7503
|
+
return this.selectSVGElement().select(`.daga-canvas-view`);
|
|
7501
7504
|
}
|
|
7502
7505
|
selectCanvasElements() {
|
|
7503
|
-
return this.
|
|
7506
|
+
return this.selectSVGElement().select(`.daga-canvas-elements`);
|
|
7504
7507
|
}
|
|
7505
7508
|
// User actions
|
|
7506
7509
|
startConnection(port) {
|
|
@@ -8706,4 +8709,4 @@ const getLocationsOfNodes = model => {
|
|
|
8706
8709
|
return locations;
|
|
8707
8710
|
};
|
|
8708
8711
|
|
|
8709
|
-
export { ACTION_STACK_SIZE, ActionStack, AddConnectionAction, AddNodeAction, AdjacencyLayout, ApplyLayoutAction, BreadthAdjacencyLayout, BreadthLayout, ClosedShape, CollabClient, Corner, CursorStyle, DIAGRAM_FIELD_DEFAULTS, DagaExporter, DagaImporter, DiagramActionMethod, DiagramActions, DiagramCanvas, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramContextMenu, DiagramDecorator, DiagramDecoratorSet, DiagramDoubleClickEvent, DiagramElement, DiagramElementSet, DiagramEntitySet, DiagramEvent, DiagramEvents, DiagramField, DiagramFieldSet, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramObject, DiagramObjectSet, DiagramPort, DiagramPortSet, DiagramSecondaryClickEvent, DiagramSection, DiagramSectionSet, DiagramUserHighlight, DiagramUserSelection, DragEvents, EditFieldAction, Events, ForceLayout, HorizontalAlign, HorizontalLayout, Keys, LineShape, LineStyle, MoveAction, PasteAction, PriorityLayout, Property, PropertySet, RemoveAction, SetGeometryAction, SetParentAction, Side, TreeLayout, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, ZoomEvents, addIfNotExists, diff, equals, filterByOnlyAncestors, filterByOnlyDescendants, generalClosedPath, getBottomMargin, getBottomPadding$1 as getBottomPadding, getLeftMargin, getLeftPadding$1 as getLeftPadding, getLocationsOfNodes, getRightMargin, getRightPadding$1 as getRightPadding, getTopMargin, getTopPadding$1 as getTopPadding, isObject, layouts, linePath, lineStyleDasharray, removeIfExists, setCursorStyle };
|
|
8712
|
+
export { ACTION_STACK_SIZE, ActionStack, AddConnectionAction, AddNodeAction, AdjacencyLayout, ApplyLayoutAction, BreadthAdjacencyLayout, BreadthLayout, ClosedShape, CollabClient, Corner, CursorStyle, DIAGRAM_FIELD_DEFAULTS, DagaExporter, DagaImporter, DiagramActionMethod, DiagramActions, DiagramCanvas, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramContextMenu, DiagramDecorator, DiagramDecoratorSet, DiagramDoubleClickEvent, DiagramElement, DiagramElementSet, DiagramEntitySet, DiagramEvent, DiagramEvents, DiagramField, DiagramFieldSet, DiagramHighlightedEvent, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramObject, DiagramObjectSet, DiagramPort, DiagramPortSet, DiagramSecondaryClickEvent, DiagramSection, DiagramSectionSet, DiagramSelectionEvent, DiagramUserHighlight, DiagramUserSelection, DragEvents, EditFieldAction, Events, ForceLayout, HorizontalAlign, HorizontalLayout, Keys, LineShape, LineStyle, MoveAction, PasteAction, PriorityLayout, Property, PropertySet, RemoveAction, SetGeometryAction, SetParentAction, Side, TreeLayout, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, ZoomEvents, addIfNotExists, diff, equals, filterByOnlyAncestors, filterByOnlyDescendants, generalClosedPath, getBottomMargin, getBottomPadding$1 as getBottomPadding, getLeftMargin, getLeftPadding$1 as getLeftPadding, getLocationsOfNodes, getRightMargin, getRightPadding$1 as getRightPadding, getTopMargin, getTopPadding$1 as getTopPadding, isObject, layouts, linePath, lineStyleDasharray, removeIfExists, setCursorStyle };
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -11,14 +11,14 @@ export { DagaImporter } from './lib/diagram/converters/daga-importer';
|
|
|
11
11
|
export type { DagaConnection, DagaModel, DagaNode, DagaPort, DagaSection } from './lib/diagram/converters/daga-model';
|
|
12
12
|
export type { DiagramModelExporter } from './lib/diagram/converters/diagram-model-exporter';
|
|
13
13
|
export type { DiagramModelImporter } from './lib/diagram/converters/diagram-model-importer';
|
|
14
|
-
export { ActionStack,
|
|
14
|
+
export { ActionStack, AddConnectionAction, AddNodeAction, ApplyLayoutAction, DiagramActionMethod, DiagramActions, EditFieldAction, MoveAction, PasteAction, RemoveAction, SetGeometryAction, SetParentAction, UpdateValuesAction } from './lib/diagram/diagram-action';
|
|
15
15
|
export type { DiagramAction } from './lib/diagram/diagram-action';
|
|
16
16
|
export type { ButtonsComponentConfig, CanvasConfig, ComponentsConfig, ConnectionMarkerLook, ConnectionTemplateConfig, ConnectionTypeConfig, DiagramConfig, ErrorsComponentConfig, FieldConfig, GridConfig, NodeImageLook, NodeShapedLook, NodeStretchableImageLook, NodeTemplateConfig, NodeTypeConfig, PaletteComponentConfig, PaletteSectionConfig, PortConfig, PropertyEditorComponentConfig, SectionConfig, SectionGridConfig, UserActionConfig } from './lib/diagram/diagram-config';
|
|
17
|
-
export { DiagramDoubleClickEvent, DiagramEvent, DiagramEvents, DiagramSecondaryClickEvent } from './lib/diagram/diagram-event';
|
|
17
|
+
export { DiagramDoubleClickEvent, DiagramEvent, DiagramEvents, DiagramHighlightedEvent, DiagramSecondaryClickEvent, DiagramSelectionEvent } from './lib/diagram/diagram-event';
|
|
18
18
|
export { AdjacencyLayout } from './lib/diagram/layout/adjacency-layout';
|
|
19
19
|
export { BreadthAdjacencyLayout } from './lib/diagram/layout/breadth-adjacency-layout';
|
|
20
20
|
export { BreadthLayout } from './lib/diagram/layout/breadth-layout';
|
|
21
|
-
export {
|
|
21
|
+
export { getLocationsOfNodes, layouts } from './lib/diagram/layout/diagram-layout';
|
|
22
22
|
export type { DiagramLayout } from './lib/diagram/layout/diagram-layout';
|
|
23
23
|
export { ForceLayout } from './lib/diagram/layout/force-layout';
|
|
24
24
|
export { HorizontalLayout } from './lib/diagram/layout/horizontal-layout';
|
|
@@ -117,7 +117,8 @@ export declare class DiagramCanvas implements Canvas {
|
|
|
117
117
|
private updateConnectionMarkersInView;
|
|
118
118
|
fitFieldRootInView(id: string): void;
|
|
119
119
|
fitNodeInView(id: string): void;
|
|
120
|
-
selectRoot(): d3.Selection<
|
|
120
|
+
selectRoot(): d3.Selection<HTMLDivElement, unknown, null, unknown>;
|
|
121
|
+
selectSVGElement(): d3.Selection<SVGElement, unknown, null, unknown>;
|
|
121
122
|
selectCanvasView(): d3.Selection<SVGGElement, unknown, null, unknown>;
|
|
122
123
|
selectCanvasElements(): d3.Selection<SVGGElement, unknown, null, unknown>;
|
|
123
124
|
private startConnection;
|
|
@@ -289,10 +289,15 @@ export interface Canvas {
|
|
|
289
289
|
*/
|
|
290
290
|
fitNodeInView(id: string): void;
|
|
291
291
|
/**
|
|
292
|
-
* Get the d3 Selection containing the
|
|
292
|
+
* Get the d3 Selection containing the root html div element of the canvas.
|
|
293
293
|
* @private
|
|
294
294
|
*/
|
|
295
|
-
selectRoot(): d3.Selection<
|
|
295
|
+
selectRoot(): d3.Selection<HTMLDivElement, unknown, null, unknown>;
|
|
296
|
+
/**
|
|
297
|
+
* Get the d3 Selection containing the svg element of the canvas.
|
|
298
|
+
* @private
|
|
299
|
+
*/
|
|
300
|
+
selectSVGElement(): d3.Selection<SVGElement, unknown, null, unknown>;
|
|
296
301
|
/**
|
|
297
302
|
* Get the d3 Selection containing the view of all the elements in the canvas.
|
|
298
303
|
* @private
|