@flowgram.ai/renderer 0.3.6 → 0.4.1

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/index.d.mts CHANGED
@@ -181,10 +181,14 @@ declare enum FlowRendererKey {
181
181
  DRAG_HIGHLIGHT_ADDER = "drag-highlight-adder",// 拖拽高亮
182
182
  DRAG_BRANCH_HIGHLIGHT_ADDER = "drag-branch-highlight-adder",// 分支拖拽添加高亮
183
183
  SELECTOR_BOX_POPOVER = "selector-box-popover",// 选择框右上角菜单
184
+ /**
185
+ * @deprecated
186
+ */
184
187
  CONTEXT_MENU_POPOVER = "context-menu-popover",// 右键菜单
185
188
  SUB_CANVAS = "sub-canvas",// 子画布渲染
186
189
  SLOT_ADDER = "slot-adder",// 插槽添加按钮
187
- SLOT_COLLPASE = "slot-collapse",// 插槽收起按钮渲染
190
+ SLOT_LABEL = "slot-label",// 插槽标签
191
+ SLOT_COLLAPSE = "slot-collapse",// 插槽收起按钮渲染
188
192
  ARROW_RENDERER = "arrow-renderer",// 工作流线条箭头渲染器
189
193
  MARKER_ARROW = "marker-arrow",// loop 的默认箭头
190
194
  MARKER_ACTIVATE_ARROW = "marker-active-arrow"
package/dist/index.d.ts CHANGED
@@ -181,10 +181,14 @@ declare enum FlowRendererKey {
181
181
  DRAG_HIGHLIGHT_ADDER = "drag-highlight-adder",// 拖拽高亮
182
182
  DRAG_BRANCH_HIGHLIGHT_ADDER = "drag-branch-highlight-adder",// 分支拖拽添加高亮
183
183
  SELECTOR_BOX_POPOVER = "selector-box-popover",// 选择框右上角菜单
184
+ /**
185
+ * @deprecated
186
+ */
184
187
  CONTEXT_MENU_POPOVER = "context-menu-popover",// 右键菜单
185
188
  SUB_CANVAS = "sub-canvas",// 子画布渲染
186
189
  SLOT_ADDER = "slot-adder",// 插槽添加按钮
187
- SLOT_COLLPASE = "slot-collapse",// 插槽收起按钮渲染
190
+ SLOT_LABEL = "slot-label",// 插槽标签
191
+ SLOT_COLLAPSE = "slot-collapse",// 插槽收起按钮渲染
188
192
  ARROW_RENDERER = "arrow-renderer",// 工作流线条箭头渲染器
189
193
  MARKER_ARROW = "marker-arrow",// loop 的默认箭头
190
194
  MARKER_ACTIVATE_ARROW = "marker-active-arrow"
package/dist/index.js CHANGED
@@ -872,7 +872,8 @@ var FlowRendererKey = /* @__PURE__ */ ((FlowRendererKey2) => {
872
872
  FlowRendererKey2["CONTEXT_MENU_POPOVER"] = "context-menu-popover";
873
873
  FlowRendererKey2["SUB_CANVAS"] = "sub-canvas";
874
874
  FlowRendererKey2["SLOT_ADDER"] = "slot-adder";
875
- FlowRendererKey2["SLOT_COLLPASE"] = "slot-collapse";
875
+ FlowRendererKey2["SLOT_LABEL"] = "slot-label";
876
+ FlowRendererKey2["SLOT_COLLAPSE"] = "slot-collapse";
876
877
  FlowRendererKey2["ARROW_RENDERER"] = "arrow-renderer";
877
878
  FlowRendererKey2["MARKER_ARROW"] = "marker-arrow";
878
879
  FlowRendererKey2["MARKER_ACTIVATE_ARROW"] = "marker-active-arrow";
@@ -1213,6 +1214,10 @@ function RoundedTurningLine(props) {
1213
1214
  const moveY = (0, import_lodash3.isNil)(point.moveY) ? ry : point.moveY;
1214
1215
  outPoint.y += to.y < point.y ? -moveY : +moveY;
1215
1216
  }
1217
+ if (point.radiusOverflow === "truncate") {
1218
+ rx = radiusX;
1219
+ ry = radiusY;
1220
+ }
1216
1221
  const crossProduct = (point.x - inPoint.x) * (outPoint.y - inPoint.y) - (point.y - inPoint.y) * (outPoint.x - inPoint.x);
1217
1222
  const isClockWise = crossProduct > 0;
1218
1223
  return `L ${inPoint.x} ${inPoint.y} A ${rx} ${ry} 0 0 ${isClockWise ? 1 : 0} ${outPoint.x} ${outPoint.y}`;
@@ -1665,7 +1670,7 @@ function createLabels(labelProps) {
1665
1670
  const { labels, renderData } = data || {};
1666
1671
  const { activated } = renderData || {};
1667
1672
  const renderLabel = (label, index) => {
1668
- const { offset, renderKey, props, rotate, type } = label || {};
1673
+ const { offset, renderKey, props, rotate, origin, type } = label || {};
1669
1674
  const offsetX = offset.x;
1670
1675
  const offsetY = offset.y;
1671
1676
  let child = null;
@@ -1755,6 +1760,8 @@ function createLabels(labelProps) {
1755
1760
  default:
1756
1761
  break;
1757
1762
  }
1763
+ const originX = typeof origin?.[0] === "number" ? origin?.[0] : 0.5;
1764
+ const originY = typeof origin?.[1] === "number" ? origin?.[1] : 0.5;
1758
1765
  return /* @__PURE__ */ import_react13.default.createElement(
1759
1766
  "div",
1760
1767
  {
@@ -1764,7 +1771,7 @@ function createLabels(labelProps) {
1764
1771
  position: "absolute",
1765
1772
  left: offsetX,
1766
1773
  top: offsetY,
1767
- transform: "translate(-50%, -50%)"
1774
+ transform: `translate(-${originX * 100}%, -${originY * 100}%)`
1768
1775
  }
1769
1776
  },
1770
1777
  child