Skip to content

Commit

Permalink
#5237 Recusive structuture refactoring for subgraphs
Browse files Browse the repository at this point in the history
  • Loading branch information
knsv committed May 3, 2024
1 parent 024bffd commit b2c286f
Show file tree
Hide file tree
Showing 5 changed files with 243 additions and 168 deletions.
19 changes: 12 additions & 7 deletions cypress/platform/knsv2.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,24 @@
<body>
<pre id="diagram" class="mermaid">
stateDiagram-v2
[*] --> First
Chimp --> A

</pre
>
<pre id="diagram" class="mermaid2">
stateDiagram-v2
state First {
[*] --> second
second --> [*]
second --> third
}



</pre
>
<pre id="diagram" class="mermaid2">
stateDiagram-v2
Second
[*] --> First
state First {
[*] --> second
second --> [*]
}
</pre
>
<pre id="diagram" class="mermaid2">
Expand Down
15 changes: 5 additions & 10 deletions packages/mermaid/src/diagrams/state/stateDb.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,16 +574,6 @@ const setDirection = (dir) => {
const trimColon = (str) => (str && str[0] === ':' ? str.substr(1).trim() : str.trim());

const dataFetcher = (parent, parsedItem, diagramStates, nodes, edges, altFlag, useRough) => {
console.log(
'abc88 parent, parsedItemm, diagramStates, nodes, edges, altFlag, useRough:',
parent,
parsedItem,
diagramStates,
nodes,
edges,
altFlag,
useRough
);
const itemId = parsedItem.id;
const classStr = getClassesFromDbInfo(diagramStates[itemId]);

Expand Down Expand Up @@ -758,6 +748,11 @@ const dataFetcher = (parent, parsedItem, diagramStates, nodes, edges, altFlag, u
}
};

/**
*
* @param nodes
* @param nodeData
*/
function insertOrUpdateNode(nodes, nodeData) {
const existingNodeData = nodes.find((node) => node.id === nodeData.id);
if (existingNodeData) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ export const draw = async function (text: string, id: string, _version: string,
// performRender(data4Rendering);

data4Layout.type = diag.type;

Check failure on line 89 in packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts

View workflow job for this annotation

GitHub Actions / build-mermaid (18.x)

Property 'type' does not exist on type 'LayoutData'.
data4Layout.layoutAlgorithm = 'dagre-wrapper';
//data4Layout.layoutAlgorithm = 'elk';
// data4Layout.layoutAlgorithm = 'dagre-wrapper';
data4Layout.layoutAlgorithm = 'elk';

Check failure on line 91 in packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts

View workflow job for this annotation

GitHub Actions / build-mermaid (18.x)

Property 'layoutAlgorithm' does not exist on type 'LayoutData'.
data4Layout.direction = DIR;

Check failure on line 92 in packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts

View workflow job for this annotation

GitHub Actions / build-mermaid (18.x)

Property 'direction' does not exist on type 'LayoutData'.
data4Layout.nodeSpacing = conf.nodeSpacing || 50;

Check failure on line 93 in packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts

View workflow job for this annotation

GitHub Actions / build-mermaid (18.x)

Property 'nodeSpacing' does not exist on type 'LayoutData'.

Check failure on line 93 in packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts

View workflow job for this annotation

GitHub Actions / build-mermaid (18.x)

'conf' is possibly 'undefined'.

Check failure on line 93 in packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts

View workflow job for this annotation

GitHub Actions / build-mermaid (18.x)

Property 'nodeSpacing' does not exist on type 'StateDiagramConfig'.
data4Layout.rankSpacing = conf.rankSpacing || 50;

Check failure on line 94 in packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts

View workflow job for this annotation

GitHub Actions / build-mermaid (18.x)

Property 'rankSpacing' does not exist on type 'LayoutData'.

Check failure on line 94 in packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts

View workflow job for this annotation

GitHub Actions / build-mermaid (18.x)

'conf' is possibly 'undefined'.

Check failure on line 94 in packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts

View workflow job for this annotation

GitHub Actions / build-mermaid (18.x)

Property 'rankSpacing' does not exist on type 'StateDiagramConfig'.
Expand Down
Loading

0 comments on commit b2c286f

Please sign in to comment.