@capillarytech/blaze-ui 5.4.1 → 5.6.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grammar.d.ts","sourceRoot":"","sources":["../../../components/CapExpressionEditor/js/grammar.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wBAizFG"}
@@ -0,0 +1,18 @@
1
+ import type { CapInputTextAreaProps } from '../CapInput';
2
+ /** Expression grammar configuration object */
3
+ export type ExpressionGrammar = Record<string, unknown>;
4
+ export interface CapExpressionEditorProps extends Omit<CapInputTextAreaProps, 'value' | 'onChange'> {
5
+ /** Expression grammar configuration */
6
+ grammar?: ExpressionGrammar;
7
+ /** Expected types for expression validation (e.g. ['boolean']) */
8
+ expected?: string[];
9
+ /** Type source identifier for type resolution */
10
+ typeSource?: string;
11
+ /** Delimiters for expression parsing (e.g. ['{{', '}}']) */
12
+ delims?: string[];
13
+ /** Initial expression value */
14
+ expression?: string;
15
+ /** Callback when expression changes. Receives parsed JSON, expression string, and error state */
16
+ onChange?: (expressionJSON: Record<string, unknown>, expression: string, isError: boolean) => void;
17
+ }
18
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../components/CapExpressionEditor/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzD,8CAA8C;AAC9C,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAExD,MAAM,WAAW,wBACf,SAAQ,IAAI,CAAC,qBAAqB,EAAE,OAAO,GAAG,UAAU,CAAC;IACzD,uCAAuC;IACvC,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iGAAiG;IACjG,QAAQ,CAAC,EAAE,CACT,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO,KACb,IAAI,CAAC;CACX"}
@@ -4974,20 +4974,11 @@ var _client = __webpack_require__(5338);
4974
4974
  var _CapTooltip = _interopRequireDefault(__webpack_require__(85684));
4975
4975
  var _jsxRuntime = __webpack_require__(74848);
4976
4976
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
4977
- /**
4978
- * Custom tooltip tool for x6 graph edges
4979
- * Extends ToolsView.ToolItem to provide tooltip functionality on edge hover
4980
- *
4981
- * Note: Uses type assertions for @antv/x6 properties as the library's TypeScript
4982
- * definitions may not fully expose all ToolItem properties.
4983
- */
4984
4977
  class TooltipTool extends _x.ToolsView.ToolItem {
4985
4978
  constructor(props) {
4986
4979
  super(props);
4987
4980
  this.onMouseMove = e => {
4988
- if (this.timer) {
4989
- window.clearTimeout(this.timer);
4990
- }
4981
+ window.clearTimeout(this.timer);
4991
4982
  this.updatePosition(e);
4992
4983
  this.timer = window.setTimeout(() => {
4993
4984
  if (this.tooltipVisible) {
@@ -5002,8 +4993,7 @@ class TooltipTool extends _x.ToolsView.ToolItem {
5002
4993
  super.render();
5003
4994
  this.knob = _x.ToolsView.createElement('div', false);
5004
4995
  this.knob.style.position = 'absolute';
5005
- const container = this.container;
5006
- container.appendChild(this.knob);
4996
+ this.container.appendChild(this.knob);
5007
4997
  this.updatePosition();
5008
4998
  document.addEventListener('mousemove', this.onMouseMove);
5009
4999
  return this;
@@ -5011,9 +5001,8 @@ class TooltipTool extends _x.ToolsView.ToolItem {
5011
5001
  toggleTooltip(visible) {
5012
5002
  const root = (0, _client.createRoot)(this.knob);
5013
5003
  if (visible) {
5014
- const tooltipText = this.options.tooltip;
5015
5004
  root.render(/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTooltip.default, {
5016
- title: tooltipText,
5005
+ title: this.options.tooltip,
5017
5006
  visible: true,
5018
5007
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {})
5019
5008
  }));
@@ -5024,9 +5013,8 @@ class TooltipTool extends _x.ToolsView.ToolItem {
5024
5013
  const {
5025
5014
  style
5026
5015
  } = this.knob;
5027
- const graph = this.graph;
5028
- if (e && graph) {
5029
- const p = graph.clientToGraph(e.clientX, e.clientY);
5016
+ if (e) {
5017
+ const p = this.graph.clientToGraph(e.clientX, e.clientY);
5030
5018
  style.display = 'block';
5031
5019
  style.left = p.x + "px";
5032
5020
  style.top = p.y + "px";
@@ -5038,21 +5026,16 @@ class TooltipTool extends _x.ToolsView.ToolItem {
5038
5026
  }
5039
5027
  onMouseLeave() {
5040
5028
  this.updatePosition();
5041
- if (this.timer) {
5042
- window.clearTimeout(this.timer);
5043
- }
5029
+ window.clearTimeout(this.timer);
5044
5030
  window.setTimeout(() => this.toggleTooltip(false), this.delay);
5045
5031
  document.removeEventListener('mousemove', this.onMouseMove);
5046
5032
  }
5047
5033
  delegateEvents() {
5048
- const cellView = this.cellView;
5049
- cellView.on('cell:mouseleave', this.onMouseLeave, this);
5034
+ this.cellView.on('cell:mouseleave', this.onMouseLeave, this);
5050
5035
  return super.delegateEvents();
5051
5036
  }
5052
5037
  onRemove() {
5053
- const cellView = this.cellView;
5054
- // @ts-expect-error - x6's off method signature may vary
5055
- cellView.off('cell:mouseleave', this.onMouseLeave, this);
5038
+ this.cellView.off('cell:mouseleave', this.onMouseLeave, this);
5056
5039
  }
5057
5040
  }
5058
5041
  TooltipTool.config({
@@ -12656,14 +12639,15 @@ var ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ = __webpack_require__(31601);
12656
12639
  var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(76314);
12657
12640
  var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
12658
12641
  // Module
12659
- ___CSS_LOADER_EXPORT___.push([module.id, `.cap-level-graph-renderer-v2 .level-graph-pagination-container,.cap-level-graph-renderer-v2 .level-graph-pagination-row,.cap-level-graph-renderer-v2 .level-graph-pagination-left,.cap-level-graph-renderer-v2 .level-graph-pagination-right{display:flex}.cap-level-graph-renderer-v2 .level-graph-pagination-row{justify-content:flex-end;height:1.714rem;margin-bottom:2.571rem}.cap-level-graph-renderer-v2 .level-graph-pagination-row .level-graph-pagination-left{margin-right:1.714rem}.cap-level-graph-renderer-v2 .level-graph-pagination-row .level-graph-pagination-left > span + .anticon{margin:0}.cap-level-graph-renderer-v2 .level-graph-pagination-row .level-graph-pagination-left,.cap-level-graph-renderer-v2 .level-graph-pagination-row .level-graph-pagination-right{justify-content:center;align-items:center;min-width:fit-content;height:100%;padding:0}`, ""]);
12642
+ ___CSS_LOADER_EXPORT___.push([module.id, `.cap-level-graph-renderer-v2 .level-graph-pagination-container,.cap-level-graph-renderer-v2 .level-graph-pagination-row,.cap-level-graph-renderer-v2 .level-graph-pagination-left,.cap-level-graph-renderer-v2 .level-graph-pagination-right{display:flex}.cap-level-graph-renderer-v2 .level-graph-pagination-row{justify-content:flex-end;height:1.714rem;margin-bottom:2.571rem}.cap-level-graph-renderer-v2 .level-graph-pagination-row .level-graph-pagination-left{margin-right:1.714rem}.cap-level-graph-renderer-v2 .level-graph-pagination-row .level-graph-pagination-left>span+.anticon{margin:0}.cap-level-graph-renderer-v2 .level-graph-pagination-row .level-graph-pagination-left,.cap-level-graph-renderer-v2 .level-graph-pagination-row .level-graph-pagination-right{justify-content:center;align-items:center;min-width:fit-content;height:100%;padding:0}`, ""]);
12660
12643
  // Exports
12661
12644
  ___CSS_LOADER_EXPORT___.locals = {
12662
12645
  "cap-level-graph-renderer-v2": `cap-level-graph-renderer-v2`,
12663
12646
  "level-graph-pagination-container": `level-graph-pagination-container`,
12664
12647
  "level-graph-pagination-row": `level-graph-pagination-row`,
12665
12648
  "level-graph-pagination-left": `level-graph-pagination-left`,
12666
- "level-graph-pagination-right": `level-graph-pagination-right`
12649
+ "level-graph-pagination-right": `level-graph-pagination-right`,
12650
+ "anticon": `anticon`
12667
12651
  };
12668
12652
  module.exports = ___CSS_LOADER_EXPORT___;
12669
12653
 
@@ -17922,10 +17906,11 @@ var _x = __webpack_require__(28890);
17922
17906
  __webpack_require__(90460);
17923
17907
  var _classnames = _interopRequireDefault(__webpack_require__(46942));
17924
17908
  var _get = _interopRequireDefault(__webpack_require__(58156));
17909
+ var _propTypes = _interopRequireDefault(__webpack_require__(43363));
17925
17910
  var _react = _interopRequireWildcard(__webpack_require__(9206));
17926
17911
  var _CapButton = _interopRequireDefault(__webpack_require__(80739));
17927
17912
  var _CapIcon = _interopRequireDefault(__webpack_require__(65124));
17928
- var _styles = _interopRequireDefault(__webpack_require__(50742));
17913
+ __webpack_require__(50742);
17929
17914
  var _Tooltip = _interopRequireDefault(__webpack_require__(30405));
17930
17915
  var _jsxRuntime = __webpack_require__(74848);
17931
17916
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
@@ -17945,67 +17930,56 @@ const edgeObj = {};
17945
17930
  const idSeparator = ' ';
17946
17931
  const CapLevelGraphRenderer = _ref => {
17947
17932
  let {
17948
- nodes = [],
17933
+ nodes,
17949
17934
  graphId,
17950
- className = '',
17951
- graphWidth = '31.25rem',
17952
- graphHeight = '31.25rem',
17953
- showToolTip = false,
17954
- connections = [],
17955
- graphStyles = {},
17956
- offsetHeight = 20,
17957
- defaultStartX = 0,
17958
- defaultStartY = 0,
17959
- scrollerProps = {},
17960
- scrollClassName = '',
17961
- containerStyles = {},
17962
- lineStrokeColor = 'gray',
17963
- defaultEleWidth = 100,
17964
- defaultEleDistance = 20,
17965
- offsetLineDistance = 18,
17966
- forwardConnProps = {},
17967
- reverseConnProps = {},
17968
- allowForwardArrowTooltip = false,
17969
- allowReverseArrowTooltip = false
17935
+ className,
17936
+ graphWidth,
17937
+ showToolTip,
17938
+ connections,
17939
+ graphStyles,
17940
+ graphHeight,
17941
+ offsetHeight,
17942
+ defaultStartX,
17943
+ defaultStartY,
17944
+ scrollerProps,
17945
+ containerStyles,
17946
+ lineStrokeColor,
17947
+ defaultEleWidth,
17948
+ scrollClassName,
17949
+ forwardConnProps,
17950
+ reverseConnProps,
17951
+ defaultEleDistance,
17952
+ offsetLineDistance,
17953
+ allowForwardArrowTooltip,
17954
+ allowReverseArrowTooltip
17970
17955
  } = _ref;
17971
17956
  const graphRef = (0, _react.useRef)(null);
17972
17957
  const [scrollbarPosition, setScrollbarPosition] = (0, _react.useState)(0);
17973
- const totalAvailWidth = nodes.length * defaultEleWidth + defaultEleDistance * (nodes.length - 1) - parseInt(String(graphWidth), 10);
17958
+ const totalAvailWidth = nodes.length * defaultEleWidth + defaultEleDistance * (nodes.length - 1) - parseInt(graphWidth, 10);
17974
17959
  (0, _react.useEffect)(() => {
17975
- // Initialize graph and events
17960
+ // Initlize graph and events
17976
17961
  initializeGraph();
17977
17962
  initializeEvents();
17978
17963
  }, []);
17979
17964
  (0, _react.useEffect)(() => {
17980
- // Draw nodes after graph initialization
17965
+ // Draw nodes after graph inilization
17981
17966
  drawNodes();
17982
17967
  }, [nodes, connections]);
17983
17968
  (0, _react.useEffect)(() => {
17984
- // Initialize and set scroll position on pagination change
17985
- if (graphRef.current) {
17986
- graphRef.current.setScrollbarPosition(scrollbarPosition);
17987
- }
17969
+ // Initilize and set scroll position on pagination change
17970
+ graphRef.current.setScrollbarPosition(scrollbarPosition);
17988
17971
  }, [nodes, connections, scrollbarPosition]);
17989
17972
 
17990
- // Initialize Graph area
17973
+ // Initlize Graph area
17991
17974
  const initializeGraph = (0, _react.useCallback)(() => {
17992
17975
  if (showToolTip) {
17993
17976
  _x.Graph.registerEdgeTool('tooltip', _Tooltip.default, true);
17994
17977
  }
17995
- const container = document.getElementById(graphId);
17996
- if (!container) {
17997
- console.error("[CapLevelGraphRenderer] Container with id \"" + graphId + "\" not found");
17998
- return;
17999
- }
18000
- // Convert string width/height to numbers if needed
18001
- const width = typeof graphWidth === 'string' ? parseInt(graphWidth, 10) : graphWidth;
18002
- const height = typeof graphHeight === 'string' ? parseInt(graphHeight, 10) : graphHeight;
18003
17978
  graphRef.current = new _x.Graph({
18004
- container,
17979
+ container: document.getElementById(graphId),
18005
17980
  resizing: false,
18006
- width,
18007
- height,
18008
- // @ts-expect-error - @antv/x6 Graph options may not have complete TypeScript definitions
17981
+ width: graphWidth,
17982
+ height: graphHeight,
18009
17983
  fitView: true,
18010
17984
  scroller: _extends({
18011
17985
  padding: 0,
@@ -18016,7 +17990,7 @@ const CapLevelGraphRenderer = _ref => {
18016
17990
  }, scrollerProps),
18017
17991
  interacting: false
18018
17992
  });
18019
- }, [graphId, graphWidth, graphHeight, scrollClassName, scrollerProps, showToolTip]);
17993
+ }, []);
18020
17994
  const drawNodes = (0, _react.useCallback)(function (eleWidth, distance, offsetY) {
18021
17995
  if (eleWidth === void 0) {
18022
17996
  eleWidth = defaultEleWidth;
@@ -18027,15 +18001,13 @@ const CapLevelGraphRenderer = _ref => {
18027
18001
  if (offsetY === void 0) {
18028
18002
  offsetY = offsetHeight;
18029
18003
  }
18030
- if (!graphRef.current) return;
18031
18004
  let nextX = defaultStartX;
18032
18005
  nodes.forEach((_ref2, index) => {
18033
- var _graphRef$current;
18034
18006
  let {
18035
18007
  id,
18036
18008
  component,
18037
18009
  height,
18038
- props = {},
18010
+ props,
18039
18011
  toolTip = ''
18040
18012
  } = _ref2;
18041
18013
  const Component = component;
@@ -18043,7 +18015,7 @@ const CapLevelGraphRenderer = _ref => {
18043
18015
  const y = defaultStartY;
18044
18016
  const endX = nextX + eleWidth;
18045
18017
  // draw the node
18046
- (_graphRef$current = graphRef.current) == null || _graphRef$current.addNode({
18018
+ graphRef.current.addNode({
18047
18019
  id,
18048
18020
  x,
18049
18021
  y,
@@ -18054,7 +18026,7 @@ const CapLevelGraphRenderer = _ref => {
18054
18026
  zIndex: 2
18055
18027
  });
18056
18028
 
18057
- // Adding node positions to obj
18029
+ // Adding node poisitions to obj
18058
18030
  nodePostionObj[id] = {
18059
18031
  x,
18060
18032
  y,
@@ -18069,13 +18041,12 @@ const CapLevelGraphRenderer = _ref => {
18069
18041
  nextX = endX + distance;
18070
18042
  // Skip connection for last node
18071
18043
  if (nodes[index + 1]) {
18072
- var _graphRef$current2;
18073
18044
  // offsetY - Connection offset height from node point
18074
18045
  const forwardEdgeId = "" + id + idSeparator + nodes[index + 1].id;
18075
18046
  edgeObj[forwardEdgeId] = {
18076
18047
  forward: true
18077
18048
  };
18078
- (_graphRef$current2 = graphRef.current) == null || _graphRef$current2.addEdge({
18049
+ graphRef.current.addEdge({
18079
18050
  id: forwardEdgeId,
18080
18051
  sourcePoint: {
18081
18052
  x: endX,
@@ -18094,13 +18065,12 @@ const CapLevelGraphRenderer = _ref => {
18094
18065
  }
18095
18066
  // Forward connection ends
18096
18067
  });
18097
- calculateAndDrawRevConnections();
18098
- }, [nodes, defaultEleWidth, defaultEleDistance, offsetHeight, defaultStartX, defaultStartY, lineStrokeColor, forwardConnProps]);
18068
+ calculateAndDrawRevConnections(nodes);
18069
+ }, [nodes]);
18099
18070
 
18100
18071
  // Calculate levels / Split connections based on level and Draw reverse connection
18101
18072
  const calculateAndDrawRevConnections = (0, _react.useCallback)(() => {
18102
- if (!graphRef.current) return;
18103
- let connectionListTemp = [...connections];
18073
+ let connectionListTemp = connections;
18104
18074
  // maintains in and out list for each node
18105
18075
  const connectionObj = {};
18106
18076
  // maintains connections by level
@@ -18123,15 +18093,15 @@ const CapLevelGraphRenderer = _ref => {
18123
18093
  return source.id !== sourceId || target.id !== targetId;
18124
18094
  });
18125
18095
  // check if two nodes have connection or not
18126
- const isConnection = filterConnection.length !== connectionListTemp.length;
18127
- if (isConnection) {
18096
+ const isConncection = filterConnection.length !== connectionListTemp.length;
18097
+ if (isConncection) {
18128
18098
  // If connection, connections is assigned with filterList to avoid unwanted iteration
18129
18099
  connectionListTemp = filterConnection;
18130
18100
  if (!lastTargetIndex && levelIndex !== 1) {
18131
18101
  lastTargetIndex = targetIndex;
18132
18102
  }
18133
- // Put in next level when two connection get interacts
18134
- if (lastTargetIndex !== undefined && targetIndex <= lastTargetIndex && levelIndex !== 1) {
18103
+ // Put in next level when two connection get intracts
18104
+ if (targetIndex <= lastTargetIndex && levelIndex !== 1) {
18135
18105
  levels.push({
18136
18106
  sourceId: source.id,
18137
18107
  targetId: target.id
@@ -18174,8 +18144,8 @@ const CapLevelGraphRenderer = _ref => {
18174
18144
  drawReverseConnections(nodes, connectionObj, levelList);
18175
18145
  }, [connections, nodes]);
18176
18146
 
18177
- // Get height between two nodes having connection
18178
- // This Avoid connection overlaps over node
18147
+ // Get height bewteen a two nodes having connection
18148
+ // This Avoid connection overloops over node
18179
18149
  const getMaxHeight = (nodeList, sourceId, targetId) => {
18180
18150
  let maxY1 = 0;
18181
18151
  let isStart = false;
@@ -18183,11 +18153,9 @@ const CapLevelGraphRenderer = _ref => {
18183
18153
  let {
18184
18154
  id
18185
18155
  } = _ref4;
18186
- const position = nodePostionObj[id];
18187
- if (!position) return;
18188
18156
  const {
18189
18157
  y1
18190
- } = position;
18158
+ } = nodePostionObj[id];
18191
18159
  if (id === targetId) {
18192
18160
  isStart = true;
18193
18161
  }
@@ -18203,45 +18171,38 @@ const CapLevelGraphRenderer = _ref => {
18203
18171
 
18204
18172
  // Draw reverse connection
18205
18173
  const drawReverseConnections = (nodeList, connectionObj, levelList) => {
18206
- if (!graphRef.current) return;
18207
-
18208
18174
  // Iterate level list by level by level
18209
18175
  levelList.forEach((levels, index) => {
18210
18176
  // Iterate connection on a each level
18211
18177
  levels.forEach((_ref5, levelItemIndex) => {
18212
- var _graphRef$current3;
18213
18178
  let {
18214
18179
  sourceId,
18215
18180
  targetId
18216
18181
  } = _ref5;
18217
- const sourcePosition = nodePostionObj[sourceId];
18218
- const targetPosition = nodePostionObj[targetId];
18219
- if (!sourcePosition || !targetPosition) return;
18220
-
18221
18182
  // Get source and target total connection count
18222
18183
  const srcConCount = connectionObj[sourceId].in.length + connectionObj[sourceId].out.length + 1;
18223
18184
  const targetConCount = connectionObj[targetId].in.length + connectionObj[targetId].out.length + 1;
18224
18185
 
18225
18186
  // split connection based on connection count for a node
18226
- let x = sourcePosition.x + sourcePosition.width / srcConCount;
18227
- let x1 = targetPosition.x1 - targetPosition.width / targetConCount;
18187
+ let x = nodePostionObj[sourceId].x + nodePostionObj[sourceId].width / srcConCount;
18188
+ let x1 = nodePostionObj[targetId].x1 - nodePostionObj[targetId].width / targetConCount;
18228
18189
  if (connectionObj[sourceId].out.includes(targetId)) {
18229
18190
  // set start position of connection, based on connection count and arrangements
18230
- x = sourcePosition.x + sourcePosition.width / srcConCount * ([...connectionObj[sourceId].out, ...connectionObj[sourceId].in].indexOf(targetId) + 1);
18191
+ x = nodePostionObj[sourceId].x + nodePostionObj[sourceId].width / srcConCount * ([...connectionObj[sourceId].out, ...connectionObj[sourceId].in].indexOf(targetId) + 1);
18231
18192
  }
18232
18193
  if (connectionObj[targetId].in.includes(sourceId)) {
18233
18194
  // set end position of connection, based on connection count and arrangements
18234
- x1 = targetPosition.x1 - targetPosition.width / targetConCount * ([...connectionObj[targetId].in, ...connectionObj[targetId].out].indexOf(sourceId) + 1);
18195
+ x1 = nodePostionObj[targetId].x1 - nodePostionObj[targetId].width / targetConCount * ([...connectionObj[targetId].in, ...connectionObj[targetId].out].indexOf(sourceId) + 1);
18235
18196
  }
18236
18197
 
18237
- // Handle connection overlaps over node
18198
+ // Handle connection overloops over node
18238
18199
  const maxHeight = getMaxHeight(nodeList, sourceId, targetId);
18239
18200
  const {
18240
18201
  y1: y
18241
- } = sourcePosition;
18202
+ } = nodePostionObj[sourceId];
18242
18203
  const {
18243
18204
  y1
18244
- } = targetPosition;
18205
+ } = nodePostionObj[targetId];
18245
18206
  const v1 = {
18246
18207
  x,
18247
18208
  y: maxHeight + offsetLineDistance * (index + 1)
@@ -18254,7 +18215,7 @@ const CapLevelGraphRenderer = _ref => {
18254
18215
  edgeObj[reverseEdgeId] = {
18255
18216
  reverse: true
18256
18217
  };
18257
- (_graphRef$current3 = graphRef.current) == null || _graphRef$current3.addEdge({
18218
+ graphRef.current.addEdge({
18258
18219
  id: reverseEdgeId,
18259
18220
  sourcePoint: [x, y],
18260
18221
  target: [x1, y1],
@@ -18271,9 +18232,8 @@ const CapLevelGraphRenderer = _ref => {
18271
18232
  }, reverseConnProps)
18272
18233
  }
18273
18234
  }).setConnector('jumpover');
18274
- // adding empty edge at last level
18235
+ // adding emtpy edge at last level
18275
18236
  if (levelList.length - 1 === index && levels.length - 1 === levelItemIndex) {
18276
- var _graphRef$current4;
18277
18237
  const v3 = {
18278
18238
  x: v1.x - 8,
18279
18239
  y: v1.y + 8
@@ -18282,7 +18242,7 @@ const CapLevelGraphRenderer = _ref => {
18282
18242
  x: v2.x - 8,
18283
18243
  y: v2.y + 8
18284
18244
  };
18285
- (_graphRef$current4 = graphRef.current) == null || _graphRef$current4.addEdge({
18245
+ graphRef.current.addEdge({
18286
18246
  id: "" + sourceId + idSeparator + targetId + "-end",
18287
18247
  sourcePoint: [x, y],
18288
18248
  target: [x1, y1],
@@ -18304,7 +18264,6 @@ const CapLevelGraphRenderer = _ref => {
18304
18264
  });
18305
18265
  };
18306
18266
  const initializeEvents = (0, _react.useCallback)(() => {
18307
- if (!graphRef.current) return;
18308
18267
  graphRef.current.on('node:mousedown', data => {
18309
18268
  const targetElement = (0, _get.default)(data, 'e.target', {});
18310
18269
  if (targetElement.tagName === 'INPUT') {
@@ -18317,14 +18276,12 @@ const CapLevelGraphRenderer = _ref => {
18317
18276
  edge = {}
18318
18277
  } = _ref6;
18319
18278
  const edgeId = edge.id;
18320
- if (edgeId && edgeObj[edgeId] && (allowForwardArrowTooltip && edgeObj[edgeId].forward || allowReverseArrowTooltip && edgeObj[edgeId].reverse)) {
18279
+ if (edgeObj[edgeId] && (allowForwardArrowTooltip && edgeObj[edgeId].forward || allowReverseArrowTooltip && edgeObj[edgeId].reverse)) {
18321
18280
  const [sourceId, targetId] = edgeId.split(idSeparator);
18322
18281
  const sourceToolTip = (0, _get.default)(nodePostionObj, [sourceId, 'toolTip']);
18323
18282
  const targetToolTip = (0, _get.default)(nodePostionObj, [targetId, 'toolTip']);
18324
18283
  if (sourceToolTip && targetToolTip) {
18325
- // Type assertion needed because @antv/x6 Edge type may not expose addTools in TypeScript definitions
18326
- const edgeWithTools = edge;
18327
- edgeWithTools.addTools == null || edgeWithTools.addTools([{
18284
+ edge.addTools([{
18328
18285
  name: 'tooltip',
18329
18286
  args: {
18330
18287
  tooltip: sourceToolTip + " - " + targetToolTip
@@ -18337,34 +18294,33 @@ const CapLevelGraphRenderer = _ref => {
18337
18294
  let {
18338
18295
  edge
18339
18296
  } = _ref7;
18340
- // Type assertion needed because @antv/x6 Edge type may not expose removeTools in TypeScript definitions
18341
- edge.removeTools == null || edge.removeTools();
18297
+ edge.removeTools();
18342
18298
  });
18343
18299
  }
18344
- }, [showToolTip, allowForwardArrowTooltip, allowReverseArrowTooltip]);
18300
+ });
18345
18301
  const onPreviousPageClick = (0, _react.useCallback)(() => {
18346
- let newScrollValue = parseFloat((scrollbarPosition - (defaultEleWidth + defaultEleDistance)).toFixed(5));
18302
+ let newScrollValue = parseFloat((scrollbarPosition - (defaultEleWidth + defaultEleDistance)).toFixed(5), 10);
18347
18303
  if (newScrollValue < 0) {
18348
18304
  newScrollValue = 0;
18349
18305
  }
18350
18306
  if (newScrollValue >= 0) setScrollbarPosition(newScrollValue);
18351
- }, [scrollbarPosition, defaultEleWidth, defaultEleDistance]);
18307
+ }, [scrollbarPosition]);
18352
18308
  const onNextPageClick = (0, _react.useCallback)(() => {
18353
- let newScrollValue = parseFloat((scrollbarPosition + defaultEleWidth + defaultEleDistance).toFixed(5));
18309
+ let newScrollValue = parseFloat((scrollbarPosition + defaultEleWidth + defaultEleDistance).toFixed(5), 10);
18354
18310
  if (newScrollValue > totalAvailWidth) {
18355
18311
  newScrollValue = totalAvailWidth;
18356
18312
  }
18357
18313
  if (newScrollValue <= totalAvailWidth) setScrollbarPosition(newScrollValue);
18358
- }, [nodes, scrollbarPosition, defaultEleWidth, defaultEleDistance, totalAvailWidth]);
18314
+ }, [nodes, scrollbarPosition]);
18359
18315
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
18360
- className: (0, _classnames.default)(_styles.default['cap-level-graph-renderer-v2'], className),
18316
+ className: (0, _classnames.default)('cap-level-graph-renderer-v2', className),
18361
18317
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
18362
- className: _styles.default['level-graph-pagination-row'],
18318
+ className: "level-graph-pagination-row",
18363
18319
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
18364
- className: _styles.default['level-graph-pagination-container'],
18320
+ className: "level-graph-pagination-container",
18365
18321
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapButton.default, {
18366
18322
  type: "flat",
18367
- className: "" + _styles.default['level-graph-pagination-left'],
18323
+ className: "pointer-cursor level-graph-pagination-left",
18368
18324
  disabled: scrollbarPosition <= 0,
18369
18325
  onClick: onPreviousPageClick,
18370
18326
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapIcon.default, {
@@ -18372,8 +18328,8 @@ const CapLevelGraphRenderer = _ref => {
18372
18328
  })
18373
18329
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapButton.default, {
18374
18330
  type: "flat",
18375
- className: "" + _styles.default['level-graph-pagination-right'],
18376
- disabled: parseFloat((scrollbarPosition + defaultEleWidth + defaultEleDistance).toFixed(5)) > totalAvailWidth,
18331
+ className: "pointer-cursor level-graph-pagination-right",
18332
+ disabled: parseFloat((scrollbarPosition + defaultEleWidth + defaultEleDistance).toFixed(5), 10) > totalAvailWidth,
18377
18333
  onClick: onNextPageClick,
18378
18334
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapIcon.default, {
18379
18335
  type: "chevron-right"
@@ -18381,7 +18337,7 @@ const CapLevelGraphRenderer = _ref => {
18381
18337
  })]
18382
18338
  })
18383
18339
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
18384
- className: _styles.default['graph-renderer-container'],
18340
+ className: "graph-renderer-container",
18385
18341
  style: _extends({}, containerStyles),
18386
18342
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
18387
18343
  id: graphId,
@@ -18390,6 +18346,53 @@ const CapLevelGraphRenderer = _ref => {
18390
18346
  })]
18391
18347
  });
18392
18348
  };
18349
+ CapLevelGraphRenderer.propTypes = {
18350
+ nodes: _propTypes.default.array,
18351
+ showToolTip: _propTypes.default.bool,
18352
+ className: _propTypes.default.string,
18353
+ connections: _propTypes.default.array,
18354
+ graphStyles: _propTypes.default.object,
18355
+ offsetHeight: _propTypes.default.number,
18356
+ defaultStartX: _propTypes.default.number,
18357
+ defaultStartY: _propTypes.default.number,
18358
+ scrollerProps: _propTypes.default.object,
18359
+ scrollClassName: _propTypes.default.string,
18360
+ containerStyles: _propTypes.default.object,
18361
+ lineStrokeColor: _propTypes.default.string,
18362
+ defaultEleWidth: _propTypes.default.number,
18363
+ reverseConnProps: _propTypes.default.object,
18364
+ forwardConnProps: _propTypes.default.object,
18365
+ defaultEleDistance: _propTypes.default.number,
18366
+ offsetLineDistance: _propTypes.default.number,
18367
+ graphId: _propTypes.default.string.isRequired,
18368
+ graphWidth: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
18369
+ graphHeight: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
18370
+ allowForwardArrowTooltip: _propTypes.default.bool,
18371
+ allowReverseArrowTooltip: _propTypes.default.bool
18372
+ };
18373
+ CapLevelGraphRenderer.defaultProps = {
18374
+ nodes: [],
18375
+ className: '',
18376
+ graphStyles: {},
18377
+ connections: [],
18378
+ defaultStartX: 0,
18379
+ defaultStartY: 0,
18380
+ offsetHeight: 20,
18381
+ scrollerProps: {},
18382
+ showToolTip: false,
18383
+ containerStyles: {},
18384
+ graphWidth: '500px',
18385
+ scrollClassName: '',
18386
+ graphHeight: '500px',
18387
+ reverseConnProps: {},
18388
+ forwardConnProps: {},
18389
+ defaultEleWidth: 100,
18390
+ defaultEleDistance: 20,
18391
+ offsetLineDistance: 18,
18392
+ lineStrokeColor: 'gray',
18393
+ allowForwardArrowTooltip: false,
18394
+ allowReverseArrowTooltip: false
18395
+ };
18393
18396
  var _default = exports["default"] = CapLevelGraphRenderer;
18394
18397
  })();
18395
18398