@plait/draw 0.56.1 → 0.57.0

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.
@@ -1,5 +1,5 @@
1
- import { ACTIVE_STROKE_WIDTH, ThemeColorMode, createDebugGenerator, Point, RectangleClient, getElementById, rotatePointsByElement, createG, arrowPoints, createPath, distanceBetweenPointAndPoint, drawLinearPath, rotate, distanceBetweenPointAndSegments, HIT_DISTANCE_BUFFER, isPolylineHitRectangle, rotateAntiPointsByElement, rotatePoints, depthFirstRecursion, PlaitBoard, getIsRecursionFunc, idCreator, catmullRomFitting, setStrokeLinecap, findElements, createMask, createRect, getSelectedElements, isPointInPolygon, getNearestPointBetweenPointAndSegments, isPointInEllipse, getNearestPointBetweenPointAndEllipse, getEllipseTangentSlope, getVectorFromPointAndSlope, drawRectangle, drawRoundRectangle, isPointInRoundRectangle, setPathStrokeLinecap, getCrossingPointsBetweenEllipseAndSegment, Direction, SNAPPING_STROKE_WIDTH, SELECTION_BORDER_COLOR, SELECTION_FILL_COLOR, drawCircle, Transforms, clearSelectedElement, addSelectedElement, BoardTransforms, PlaitPointerType, hasValidAngle, Path, PlaitNode, toViewBoxPoint, toHostPoint, isSelectionMoving, RgbaToHEX, getHitElementByPoint, getRectangleByElements, getSelectionAngle, rotatedDataPoints, isAxisChangedByAngle, getRectangleByAngle, getSnapRectangles, getTripleAxis, getMinPointDelta, SNAP_TOLERANCE, drawPointSnapLines, drawSolidLines, preventTouchMove, WritableClipboardOperationType, createClipboardContext, WritableClipboardType, addClipboardContext, setAngleForG, CursorClass, PlaitElement, temporaryDisableSelection, PRESS_AND_MOVE_BUFFER, isMainPointer, throttleRAF, getAngleBetweenPoints, normalizeAngle, degreesToRadians, rotateElements, MERGING, ROTATE_HANDLE_CLASS_NAME, SELECTION_RECTANGLE_CLASS_NAME } from '@plait/core';
2
- import { removeDuplicatePoints, generateElbowLineRoute, simplifyOrthogonalPoints, isSourceAndTargetIntersect, getPoints, DEFAULT_ROUTE_MARGIN, getPointByVectorComponent, getExtendPoint, getUnitVectorByPointAndPoint, Generator, RESIZE_HANDLE_DIAMETER, getPointOnPolyline, TRANSPARENT, getRectangleResizeHandleRefs, getRotatedResizeCursorClassByAngle, ROTATE_HANDLE_DISTANCE_TO_ELEMENT, ROTATE_HANDLE_SIZE, getMemorizedLatest, memorizeLatest, getCrossingPointsBetweenPointAndSegment, isPointOnSegment, getDirectionByPointOfRectangle, getDirectionFactor, getFirstTextManage, getDirectionByVector, getOppositeDirection, rotateVector, rotateVectorAnti90, getSourceAndTargetOuterRectangle, getNextPoint, normalizeShapePoints, getFirstTextEditor, PRIMARY_COLOR, CommonPluginElement, ActiveGenerator, canResize, WithTextPluginKey, drawPrimaryHandle, drawFillPrimaryHandle, isVirtualKey, isDelete, isSpaceHotkey, isCornerHandle, getIndexByResizeHandle, resetPointsAfterResize, withResize, drawHandle, getSymmetricHandleIndex, getResizeHandlePointByIndex, getDirectionFactorByDirectionComponent, isDndMode, isDrawingMode, getElementsText, acceptImageTypes, getElementOfFocusedImage, buildImage, isResizingByCondition, getRatioByPoint, getTextManages, ImageGenerator, ResizeHandle, addRotating, removeRotating, drawRotateHandle } from '@plait/common';
1
+ import { ACTIVE_STROKE_WIDTH, ThemeColorMode, createDebugGenerator, Point, RectangleClient, getElementById, rotatePointsByElement, createG, arrowPoints, createPath, distanceBetweenPointAndPoint, drawLinearPath, rotate, distanceBetweenPointAndSegments, HIT_DISTANCE_BUFFER, isPolylineHitRectangle, rotateAntiPointsByElement, rotatePoints, depthFirstRecursion, PlaitBoard, getIsRecursionFunc, idCreator, catmullRomFitting, setStrokeLinecap, findElements, createMask, createRect, getSelectedElements, isPointInPolygon, getNearestPointBetweenPointAndSegments, isPointInEllipse, getNearestPointBetweenPointAndEllipse, getEllipseTangentSlope, getVectorFromPointAndSlope, drawRectangle, drawRoundRectangle, isPointInRoundRectangle, setPathStrokeLinecap, getCrossingPointsBetweenEllipseAndSegment, Direction, SNAPPING_STROKE_WIDTH, SELECTION_BORDER_COLOR, SELECTION_FILL_COLOR, drawCircle, Transforms, clearSelectedElement, addSelectedElement, BoardTransforms, PlaitPointerType, PlaitElement, hasValidAngle, Path, PlaitNode, toViewBoxPoint, toHostPoint, isSelectionMoving, RgbaToHEX, getHitElementByPoint, getRectangleByElements, getSelectionAngle, rotatedDataPoints, isAxisChangedByAngle, getRectangleByAngle, getSnapRectangles, getTripleAxis, getMinPointDelta, SNAP_TOLERANCE, drawPointSnapLines, drawSolidLines, preventTouchMove, WritableClipboardOperationType, createClipboardContext, WritableClipboardType, addClipboardContext, setAngleForG, CursorClass, temporaryDisableSelection, PRESS_AND_MOVE_BUFFER, isMainPointer, throttleRAF, getAngleBetweenPoints, normalizeAngle, degreesToRadians, rotateElements, MERGING, ROTATE_HANDLE_CLASS_NAME, SELECTION_RECTANGLE_CLASS_NAME } from '@plait/core';
2
+ import { removeDuplicatePoints, generateElbowLineRoute, simplifyOrthogonalPoints, isSourceAndTargetIntersect, getPoints, DEFAULT_ROUTE_MARGIN, getPointByVectorComponent, getExtendPoint, getUnitVectorByPointAndPoint, Generator, RESIZE_HANDLE_DIAMETER, getPointOnPolyline, TRANSPARENT, getRectangleResizeHandleRefs, getRotatedResizeCursorClassByAngle, ROTATE_HANDLE_DISTANCE_TO_ELEMENT, ROTATE_HANDLE_SIZE, getMemorizedLatest, memorizeLatest, getCrossingPointsBetweenPointAndSegment, isPointOnSegment, getDirectionByPointOfRectangle, getDirectionFactor, getFirstTextManage, ActiveGenerator, getDirectionByVector, getOppositeDirection, rotateVector, rotateVectorAnti90, getSourceAndTargetOuterRectangle, getNextPoint, normalizeShapePoints, getFirstTextEditor, PRIMARY_COLOR, CommonPluginElement, canResize, WithTextPluginKey, drawPrimaryHandle, drawFillPrimaryHandle, isVirtualKey, isDelete, isSpaceHotkey, isCornerHandle, getIndexByResizeHandle, resetPointsAfterResize, withResize, drawHandle, getSymmetricHandleIndex, getResizeHandlePointByIndex, getDirectionFactorByDirectionComponent, isDndMode, isDrawingMode, getElementsText, acceptImageTypes, getElementOfFocusedImage, buildImage, isResizingByCondition, getRatioByPoint, getTextManages, ImageGenerator, ResizeHandle, addRotating, removeRotating, drawRotateHandle } from '@plait/common';
3
3
  import { Alignment, buildText, DEFAULT_FONT_SIZE, getTextSize, AlignEditor, TextManage } from '@plait/text';
4
4
  import { pointsOnBezierCurves } from 'points-on-curve';
5
5
  import * as i0 from '@angular/core';
@@ -57,7 +57,17 @@ var FlowchartSymbols;
57
57
  FlowchartSymbols["noteCurlyRight"] = "noteCurlyRight";
58
58
  FlowchartSymbols["noteCurlyLeft"] = "noteCurlyLeft";
59
59
  FlowchartSymbols["noteSquare"] = "noteSquare";
60
+ FlowchartSymbols["display"] = "display";
60
61
  })(FlowchartSymbols || (FlowchartSymbols = {}));
62
+ var TableSymbols;
63
+ (function (TableSymbols) {
64
+ TableSymbols["table"] = "table";
65
+ })(TableSymbols || (TableSymbols = {}));
66
+ var SwimlaneSymbols;
67
+ (function (SwimlaneSymbols) {
68
+ SwimlaneSymbols["swimlaneVertical"] = "swimlaneVertical";
69
+ SwimlaneSymbols["swimlaneHorizontal"] = "swimlaneHorizontal";
70
+ })(SwimlaneSymbols || (SwimlaneSymbols = {}));
61
71
  const PlaitGeometry = {};
62
72
 
63
73
  const ShapeDefaultSpace = {
@@ -178,7 +188,8 @@ const DefaultFlowchartPropertyMap = {
178
188
  [FlowchartSymbols.internalStorage]: DefaultInternalStorageProperty,
179
189
  [FlowchartSymbols.noteCurlyLeft]: DefaultNoteProperty,
180
190
  [FlowchartSymbols.noteCurlyRight]: DefaultNoteProperty,
181
- [FlowchartSymbols.noteSquare]: DefaultNoteProperty
191
+ [FlowchartSymbols.noteSquare]: DefaultNoteProperty,
192
+ [FlowchartSymbols.display]: DefaultFlowchartProperty
182
193
  };
183
194
  const LINE_HIT_GEOMETRY_BUFFER = 10;
184
195
  const LINE_SNAPPING_BUFFER = 6;
@@ -2059,7 +2070,7 @@ const StarEngine = createPolygonEngine({
2059
2070
  height,
2060
2071
  width: width > 0 ? width : 0,
2061
2072
  x: elementRectangle.x + ShapeDefaultSpace.rectangleAndText + strokeWidth + originWidth / 4,
2062
- y: elementRectangle.y + (elementRectangle.height * 1) / 5 + ((elementRectangle.height * 4) / 5 - height) / 2
2073
+ y: elementRectangle.y + (elementRectangle.height * 1) / 6 + ((elementRectangle.height * 4) / 5 - height) / 2
2063
2074
  };
2064
2075
  }
2065
2076
  });
@@ -3068,6 +3079,101 @@ const NoteSquareEngine = {
3068
3079
  }
3069
3080
  };
3070
3081
 
3082
+ const getDisplayPoints = (rectangle) => {
3083
+ return [
3084
+ [rectangle.x, rectangle.y + rectangle.height / 2],
3085
+ [rectangle.x + rectangle.width * 0.15, rectangle.y],
3086
+ [rectangle.x + rectangle.width, rectangle.y],
3087
+ [rectangle.x + rectangle.width, rectangle.y + rectangle.height],
3088
+ [rectangle.x + rectangle.width * 0.15, rectangle.y + rectangle.height]
3089
+ ];
3090
+ };
3091
+ const DisplayEngine = {
3092
+ draw(board, rectangle, options) {
3093
+ const rs = PlaitBoard.getRoughSVG(board);
3094
+ const shape = rs.path(`M${rectangle.x + rectangle.width * 0.15} ${rectangle.y}
3095
+ H${rectangle.x + rectangle.width - rectangle.width * 0.1}
3096
+ A ${rectangle.width * 0.1} ${rectangle.height / 2}, 0, 0, 1,${rectangle.x +
3097
+ rectangle.width -
3098
+ rectangle.width * 0.1} ${rectangle.y + rectangle.height}
3099
+ H${rectangle.x + rectangle.width * 0.15}
3100
+ L${rectangle.x} ${rectangle.y + rectangle.height / 2}
3101
+ Z
3102
+ `, { ...options, fillStyle: 'solid' });
3103
+ setStrokeLinecap(shape, 'round');
3104
+ return shape;
3105
+ },
3106
+ isInsidePoint(rectangle, point) {
3107
+ const polygonPoints = [
3108
+ [rectangle.x, rectangle.y + rectangle.height / 2],
3109
+ [rectangle.x + rectangle.width * 0.15, rectangle.y],
3110
+ [rectangle.x + rectangle.width - rectangle.width * 0.1, rectangle.y],
3111
+ [rectangle.x + rectangle.width - rectangle.width * 0.1, rectangle.y + rectangle.height],
3112
+ [rectangle.x + rectangle.width * 0.15, rectangle.y + rectangle.height]
3113
+ ];
3114
+ const isInPolygon = isPointInPolygon(point, polygonPoints);
3115
+ const isInEllipse = isPointInEllipse(point, [rectangle.x + rectangle.width - rectangle.width * 0.1, rectangle.y + rectangle.height / 2], rectangle.width * 0.1, rectangle.height / 2);
3116
+ return isInPolygon || isInEllipse;
3117
+ },
3118
+ getCornerPoints(rectangle) {
3119
+ return RectangleClient.getCornerPoints(rectangle);
3120
+ },
3121
+ getNearestPoint(rectangle, point) {
3122
+ const nearestPoint = getNearestPointBetweenPointAndSegments(point, getDisplayPoints(rectangle));
3123
+ if (nearestPoint[0] > rectangle.x + rectangle.width - rectangle.width * 0.1) {
3124
+ return getNearestPointBetweenPointAndEllipse(point, [rectangle.x + rectangle.width - rectangle.width * 0.1, rectangle.y + rectangle.height / 2], rectangle.width * 0.1, rectangle.height / 2);
3125
+ }
3126
+ return nearestPoint;
3127
+ },
3128
+ getTangentVectorByConnectionPoint(rectangle, pointOfRectangle) {
3129
+ const connectionPoint = RectangleClient.getConnectionPoint(rectangle, pointOfRectangle);
3130
+ const centerPoint = [rectangle.x + rectangle.width - rectangle.width * 0.1, rectangle.y + rectangle.height / 2];
3131
+ const point = [connectionPoint[0] - centerPoint[0], -(connectionPoint[1] - centerPoint[1])];
3132
+ const a = rectangle.width * 0.1;
3133
+ const b = rectangle.height / 2;
3134
+ const slope = getEllipseTangentSlope(point[0], point[1], a, b);
3135
+ return getVectorFromPointAndSlope(point[0], point[1], slope);
3136
+ },
3137
+ getConnectorPoints(rectangle) {
3138
+ return RectangleClient.getEdgeCenterPoints(rectangle);
3139
+ },
3140
+ getTextRectangle: (element) => {
3141
+ const elementRectangle = RectangleClient.getRectangleByPoints(element.points);
3142
+ const strokeWidth = getStrokeWidthByElement(element);
3143
+ const height = element.textHeight;
3144
+ const width = elementRectangle.width - strokeWidth * 2 - elementRectangle.width * 0.25;
3145
+ return {
3146
+ width: width > 0 ? width : 0,
3147
+ height: height,
3148
+ x: elementRectangle.x + strokeWidth + elementRectangle.width * 0.15,
3149
+ y: elementRectangle.y + (elementRectangle.height - height) / 2
3150
+ };
3151
+ }
3152
+ };
3153
+
3154
+ const TableEngine = {
3155
+ draw(board, rectangle, options) {
3156
+ // TODO: draw table
3157
+ const g = createG();
3158
+ return g;
3159
+ },
3160
+ isInsidePoint(rectangle, point) {
3161
+ return false;
3162
+ },
3163
+ getCornerPoints(rectangle) {
3164
+ return RectangleClient.getCornerPoints(rectangle);
3165
+ },
3166
+ getNearestPoint(rectangle, point) {
3167
+ return [0, 0];
3168
+ },
3169
+ getConnectorPoints(rectangle) {
3170
+ return [
3171
+ [0, 0],
3172
+ [0, 0]
3173
+ ];
3174
+ }
3175
+ };
3176
+
3071
3177
  const ShapeEngineMap = {
3072
3178
  [BasicShapes.rectangle]: RectangleEngine,
3073
3179
  [BasicShapes.diamond]: DiamondEngine,
@@ -3112,7 +3218,11 @@ const ShapeEngineMap = {
3112
3218
  [FlowchartSymbols.multiDocument]: MultiDocumentEngine,
3113
3219
  [FlowchartSymbols.noteCurlyLeft]: NoteCurlyLeftEngine,
3114
3220
  [FlowchartSymbols.noteCurlyRight]: NoteCurlyRightEngine,
3115
- [FlowchartSymbols.noteSquare]: NoteSquareEngine
3221
+ [FlowchartSymbols.noteSquare]: NoteSquareEngine,
3222
+ [FlowchartSymbols.display]: DisplayEngine,
3223
+ [SwimlaneSymbols.swimlaneHorizontal]: TableEngine,
3224
+ [SwimlaneSymbols.swimlaneVertical]: TableEngine,
3225
+ [TableSymbols.table]: TableEngine
3116
3226
  };
3117
3227
  const getEngine = (shape) => {
3118
3228
  return ShapeEngineMap[shape];
@@ -3334,9 +3444,21 @@ const createDefaultGeometry = (board, points, shape) => {
3334
3444
  ...memorizedLatest.geometryProperties
3335
3445
  }, { ...memorizedLatest.textProperties, textHeight });
3336
3446
  };
3337
- const editText = (element) => {
3447
+ const editText = (board, element) => {
3338
3448
  const textManage = getFirstTextManage(element);
3339
- textManage.edit();
3449
+ textManage.edit(() => {
3450
+ // delay to avoid blinking
3451
+ setTimeout(() => {
3452
+ rerenderGeometryActive(board, element);
3453
+ }, 200);
3454
+ });
3455
+ rerenderGeometryActive(board, element);
3456
+ };
3457
+ const rerenderGeometryActive = (board, element) => {
3458
+ const elementRef = PlaitElement.getElementRef(element);
3459
+ const activeGenerator = elementRef.getGenerator(ActiveGenerator.key);
3460
+ const selected = getSelectedElements(board).includes(element);
3461
+ activeGenerator.processDrawing(element, PlaitBoard.getElementActiveHost(board), { selected });
3340
3462
  };
3341
3463
 
3342
3464
  const getStrokeWidthByElement = (element) => {
@@ -3909,13 +4031,13 @@ class LineAutoCompleteGenerator extends Generator {
3909
4031
  }
3910
4032
 
3911
4033
  class GeometryComponent extends CommonPluginElement {
3912
- constructor() {
3913
- super(...arguments);
3914
- this.destroy$ = new Subject();
3915
- }
3916
4034
  get textManage() {
3917
4035
  return this.getTextManages()[0];
3918
4036
  }
4037
+ constructor() {
4038
+ super();
4039
+ this.destroy$ = new Subject();
4040
+ }
3919
4041
  initializeGenerator() {
3920
4042
  this.activeGenerator = new ActiveGenerator(this.board, {
3921
4043
  getStrokeWidth: () => {
@@ -3947,6 +4069,7 @@ class GeometryComponent extends CommonPluginElement {
3947
4069
  this.shapeGenerator = new GeometryShapeGenerator(this.board);
3948
4070
  this.initializeTextManage();
3949
4071
  this.getRef().addGenerator(LineAutoCompleteGenerator.key, this.lineAutoCompleteGenerator);
4072
+ this.getRef().addGenerator(ActiveGenerator.key, this.activeGenerator);
3950
4073
  }
3951
4074
  ngOnInit() {
3952
4075
  super.ngOnInit();
@@ -4033,7 +4156,7 @@ class GeometryComponent extends CommonPluginElement {
4033
4156
  this.lineAutoCompleteGenerator.destroy();
4034
4157
  this.destroyTextManages();
4035
4158
  }
4036
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: GeometryComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
4159
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: GeometryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4037
4160
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", type: GeometryComponent, isStandalone: true, selector: "plait-draw-geometry", usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
4038
4161
  }
4039
4162
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: GeometryComponent, decorators: [{
@@ -4044,7 +4167,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImpor
4044
4167
  changeDetection: ChangeDetectionStrategy.OnPush,
4045
4168
  standalone: true
4046
4169
  }]
4047
- }] });
4170
+ }], ctorParameters: () => [] });
4048
4171
 
4049
4172
  class LineActiveGenerator extends Generator {
4050
4173
  constructor() {
@@ -4123,7 +4246,7 @@ const debugKey$2 = 'debug:plait:line-turning';
4123
4246
  const debugGenerator$2 = createDebugGenerator(debugKey$2);
4124
4247
  class LineComponent extends CommonPluginElement {
4125
4248
  constructor() {
4126
- super(...arguments);
4249
+ super();
4127
4250
  this.destroy$ = new Subject();
4128
4251
  this.boundedElements = {};
4129
4252
  }
@@ -4267,7 +4390,7 @@ class LineComponent extends CommonPluginElement {
4267
4390
  this.destroy$.complete();
4268
4391
  this.destroyTextManages();
4269
4392
  }
4270
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: LineComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
4393
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: LineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4271
4394
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", type: LineComponent, isStandalone: true, selector: "plait-draw-line", usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
4272
4395
  }
4273
4396
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: LineComponent, decorators: [{
@@ -4278,7 +4401,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImpor
4278
4401
  changeDetection: ChangeDetectionStrategy.OnPush,
4279
4402
  standalone: true
4280
4403
  }]
4281
- }] });
4404
+ }], ctorParameters: () => [] });
4282
4405
 
4283
4406
  const withDrawHotkey = (board) => {
4284
4407
  const { keyDown, dblClick } = board;
@@ -4293,7 +4416,7 @@ const withDrawHotkey = (board) => {
4293
4416
  isSingleSelection &&
4294
4417
  PlaitDrawElement.isGeometry(targetElement)) {
4295
4418
  event.preventDefault();
4296
- editText(targetElement);
4419
+ editText(board, targetElement);
4297
4420
  return;
4298
4421
  }
4299
4422
  keyDown(event);
@@ -4304,7 +4427,7 @@ const withDrawHotkey = (board) => {
4304
4427
  const point = toViewBoxPoint(board, toHostPoint(board, event.x, event.y));
4305
4428
  const hitElement = getHitElementByPoint(board, point);
4306
4429
  if (hitElement && PlaitDrawElement.isGeometry(hitElement)) {
4307
- editText(hitElement);
4430
+ editText(board, hitElement);
4308
4431
  }
4309
4432
  }
4310
4433
  dblClick(event);
@@ -5413,13 +5536,13 @@ function editHandle(board, element, manageIndex, isFirstEdit = false) {
5413
5536
  }
5414
5537
 
5415
5538
  class ImageComponent extends CommonPluginElement {
5416
- constructor() {
5417
- super(...arguments);
5418
- this.destroy$ = new Subject();
5419
- }
5420
5539
  get activeGenerator() {
5421
5540
  return this.imageGenerator.componentRef.instance.activeGenerator;
5422
5541
  }
5542
+ constructor() {
5543
+ super();
5544
+ this.destroy$ = new Subject();
5545
+ }
5423
5546
  initializeGenerator() {
5424
5547
  this.imageGenerator = new ImageGenerator(this.board, {
5425
5548
  getRectangle: (element) => {
@@ -5475,7 +5598,7 @@ class ImageComponent extends CommonPluginElement {
5475
5598
  this.imageGenerator.destroy();
5476
5599
  this.lineAutoCompleteGenerator.destroy();
5477
5600
  }
5478
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: ImageComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
5601
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: ImageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
5479
5602
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", type: ImageComponent, isStandalone: true, selector: "plait-draw-geometry", usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
5480
5603
  }
5481
5604
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: ImageComponent, decorators: [{
@@ -5486,7 +5609,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImpor
5486
5609
  changeDetection: ChangeDetectionStrategy.OnPush,
5487
5610
  standalone: true
5488
5611
  }]
5489
- }] });
5612
+ }], ctorParameters: () => [] });
5490
5613
 
5491
5614
  const withLineAutoCompleteReaction = (board) => {
5492
5615
  const { pointerMove } = board;
@@ -5760,6 +5883,59 @@ const withDrawRotate = (board) => {
5760
5883
  return board;
5761
5884
  };
5762
5885
 
5886
+ class TableComponent extends CommonPluginElement {
5887
+ constructor() {
5888
+ super();
5889
+ }
5890
+ initializeGenerator() {
5891
+ this.activeGenerator = new ActiveGenerator(this.board, {
5892
+ getStrokeWidth: () => {
5893
+ return ACTIVE_STROKE_WIDTH;
5894
+ },
5895
+ getStrokeOpacity: () => {
5896
+ return 1;
5897
+ },
5898
+ getRectangle: (element) => {
5899
+ return RectangleClient.getRectangleByPoints(element.points);
5900
+ },
5901
+ hasResizeHandle: () => {
5902
+ return canResize(this.board, this.element);
5903
+ }
5904
+ });
5905
+ }
5906
+ ngOnInit() {
5907
+ super.ngOnInit();
5908
+ this.initializeGenerator();
5909
+ }
5910
+ onContextChanged(value, previous) { }
5911
+ ngOnDestroy() {
5912
+ super.ngOnDestroy();
5913
+ }
5914
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
5915
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.2.4", type: TableComponent, isStandalone: true, selector: "plait-draw-table", usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
5916
+ }
5917
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: TableComponent, decorators: [{
5918
+ type: Component,
5919
+ args: [{
5920
+ selector: 'plait-draw-table',
5921
+ template: ``,
5922
+ changeDetection: ChangeDetectionStrategy.OnPush,
5923
+ standalone: true
5924
+ }]
5925
+ }], ctorParameters: () => [] });
5926
+
5927
+ const withTable = (board) => {
5928
+ const { drawElement } = board;
5929
+ board.drawElement = (context) => {
5930
+ if (PlaitDrawElement.isGeometry(context.element) &&
5931
+ [SwimlaneSymbols.swimlaneHorizontal, SwimlaneSymbols.swimlaneVertical].includes(context.element.shape)) {
5932
+ return TableComponent;
5933
+ }
5934
+ return drawElement(context);
5935
+ };
5936
+ return board;
5937
+ };
5938
+
5763
5939
  const withDraw = (board) => {
5764
5940
  const { drawElement, getRectangle, isRectangleHit, isHit, isInsidePoint, isMovable, isAlign, getRelatedFragment } = board;
5765
5941
  board.drawElement = (context) => {
@@ -5855,12 +6031,12 @@ const withDraw = (board) => {
5855
6031
  });
5856
6032
  return getRelatedFragment([...elements, ...activeLines], originData);
5857
6033
  };
5858
- return withDrawResize(withLineResize(withLineTextMove(withLineAutoCompleteReaction(withLineText(withLineBoundReaction(withGeometryResize(withDrawRotate(withLineCreateByDraw(withLineAutoComplete(withGeometryCreateByDrag(withGeometryCreateByDrawing(withDrawFragment(withDrawHotkey(board))))))))))))));
6034
+ return withTable(withDrawResize(withLineAutoCompleteReaction(withLineBoundReaction(withLineResize(withLineTextMove(withLineText(withGeometryResize(withDrawRotate(withLineCreateByDraw(withLineAutoComplete(withGeometryCreateByDrag(withGeometryCreateByDrawing(withDrawFragment(withDrawHotkey(board)))))))))))))));
5859
6035
  };
5860
6036
 
5861
6037
  /**
5862
6038
  * Generated bundle index. Do not edit.
5863
6039
  */
5864
6040
 
5865
- export { BasicShapes, DEFAULT_IMAGE_WIDTH, DefaultArrowProperty, DefaultBasicShapeProperty, DefaultBasicShapePropertyMap, DefaultCloudProperty, DefaultConnectorProperty, DefaultDataBaseProperty, DefaultDataProperty, DefaultDecisionProperty, DefaultDocumentProperty, DefaultFlowchartProperty, DefaultFlowchartPropertyMap, DefaultGeometryActiveStyle, DefaultGeometryStyle, DefaultInternalStorageProperty, DefaultManualInputProperty, DefaultMergeProperty, DefaultMultiDocumentProperty, DefaultNoteProperty, DefaultPentagonArrowProperty, DefaultTextProperty, DefaultTwoWayArrowProperty, DrawThemeColors, DrawTransforms, FlowchartSymbols, GeometryComponent, GeometryThreshold, LINE_HIT_GEOMETRY_BUFFER, LINE_SNAPPING_BUFFER, LINE_SNAPPING_CONNECTOR_BUFFER, LineComponent, LineHandleKey, LineMarkerType, LineShape, MemorizeKey, PlaitDrawElement, PlaitGeometry, PlaitLine, Q2C, ShapeDefaultSpace, StrokeStyle, WithLineAutoCompletePluginKey, alignElbowSegment, alignPoints, createDefaultFlowchart, createDefaultGeometry, createGeometryElement, createLineElement, createTextElement, drawBoundReaction, drawGeometry, drawLine, drawLineArrow, editText, getAutoCompletePoints, getBasicPointers, getCenterPointsOnPolygon, getConnectionPoint, getCurvePoints, getDefaultBasicShapeProperty, getDefaultFlowchartProperty, getDefaultGeometryPoints, getDefaultGeometryProperty, getDefaultTextPoints, getDrawDefaultStrokeColor, getElbowLineRouteOptions, getElbowPoints, getFillByElement, getFlowchartDefaultFill, getFlowchartPointers, getGeometryPointers, getHitConnection, getHitConnectorPoint, getHitIndexOfAutoCompletePoint, getIndexAndDeleteCountByKeyPoint, getLineDashByElement, getLineHandleRefPair, getLineMemorizedLatest, getLinePointers, getLinePoints, getLineTextRectangle, getLines, getMemorizeKey, getMemorizedLatestByPointer, getMemorizedLatestShape, getMidKeyPoints, getMiddlePoints, getMirrorDataPoints, getNearestPoint, getNextRenderPoints, getNextSourceAndTargetPoints, getResizedPreviousAndNextPoint, getSelectedDrawElements, getSelectedGeometryElements, getSelectedImageElements, getSelectedLineElements, getSourceAndTargetRectangle, getStrokeColorByElement, getStrokeStyleByElement, getStrokeWidthByElement, getTextRectangle, getTextShapeProperty, getVectorByConnection, handleLineCreating, hasIllegalElbowPoint, insertElement, isHitDrawElement, isHitEdgeOfShape, isHitElementInside, isHitLine, isHitLineText, isHitPolyLine, isInsideOfShape, isRectangleHitDrawElement, isSelfLoop, isTextExceedingBounds, isUpdatedHandleIndex, isUseDefaultOrthogonalRoute, memorizeLatestShape, memorizeLatestText, withDraw, withLineAutoComplete };
6041
+ export { BasicShapes, DEFAULT_IMAGE_WIDTH, DefaultArrowProperty, DefaultBasicShapeProperty, DefaultBasicShapePropertyMap, DefaultCloudProperty, DefaultConnectorProperty, DefaultDataBaseProperty, DefaultDataProperty, DefaultDecisionProperty, DefaultDocumentProperty, DefaultFlowchartProperty, DefaultFlowchartPropertyMap, DefaultGeometryActiveStyle, DefaultGeometryStyle, DefaultInternalStorageProperty, DefaultManualInputProperty, DefaultMergeProperty, DefaultMultiDocumentProperty, DefaultNoteProperty, DefaultPentagonArrowProperty, DefaultTextProperty, DefaultTwoWayArrowProperty, DrawThemeColors, DrawTransforms, FlowchartSymbols, GeometryComponent, GeometryThreshold, LINE_HIT_GEOMETRY_BUFFER, LINE_SNAPPING_BUFFER, LINE_SNAPPING_CONNECTOR_BUFFER, LineComponent, LineHandleKey, LineMarkerType, LineShape, MemorizeKey, PlaitDrawElement, PlaitGeometry, PlaitLine, Q2C, ShapeDefaultSpace, StrokeStyle, SwimlaneSymbols, TableSymbols, WithLineAutoCompletePluginKey, alignElbowSegment, alignPoints, createDefaultFlowchart, createDefaultGeometry, createGeometryElement, createLineElement, createTextElement, drawBoundReaction, drawGeometry, drawLine, drawLineArrow, editText, getAutoCompletePoints, getBasicPointers, getCenterPointsOnPolygon, getConnectionPoint, getCurvePoints, getDefaultBasicShapeProperty, getDefaultFlowchartProperty, getDefaultGeometryPoints, getDefaultGeometryProperty, getDefaultTextPoints, getDrawDefaultStrokeColor, getElbowLineRouteOptions, getElbowPoints, getFillByElement, getFlowchartDefaultFill, getFlowchartPointers, getGeometryPointers, getHitConnection, getHitConnectorPoint, getHitIndexOfAutoCompletePoint, getIndexAndDeleteCountByKeyPoint, getLineDashByElement, getLineHandleRefPair, getLineMemorizedLatest, getLinePointers, getLinePoints, getLineTextRectangle, getLines, getMemorizeKey, getMemorizedLatestByPointer, getMemorizedLatestShape, getMidKeyPoints, getMiddlePoints, getMirrorDataPoints, getNearestPoint, getNextRenderPoints, getNextSourceAndTargetPoints, getResizedPreviousAndNextPoint, getSelectedDrawElements, getSelectedGeometryElements, getSelectedImageElements, getSelectedLineElements, getSourceAndTargetRectangle, getStrokeColorByElement, getStrokeStyleByElement, getStrokeWidthByElement, getTextRectangle, getTextShapeProperty, getVectorByConnection, handleLineCreating, hasIllegalElbowPoint, insertElement, isHitDrawElement, isHitEdgeOfShape, isHitElementInside, isHitLine, isHitLineText, isHitPolyLine, isInsideOfShape, isRectangleHitDrawElement, isSelfLoop, isTextExceedingBounds, isUpdatedHandleIndex, isUseDefaultOrthogonalRoute, memorizeLatestShape, memorizeLatestText, rerenderGeometryActive, withDraw, withLineAutoComplete };
5866
6042
  //# sourceMappingURL=plait-draw.mjs.map