Skip to content

Commit

Permalink
feat: update collapsedMarkerType
Browse files Browse the repository at this point in the history
  • Loading branch information
yvonneyx committed Mar 5, 2024
1 parent fe5d862 commit 0de7ec9
Show file tree
Hide file tree
Showing 5 changed files with 354 additions and 10 deletions.
29 changes: 24 additions & 5 deletions packages/g6/__tests__/demo/case/combo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const combo: STDTestCase = async (context) => {
'bottom-left',
'bottom-right',
];
const COLLAPSED_MARKER_TYPE = ['child-count', 'descendant-count', 'node-count'];
const COLLAPSED_MARKER_TYPE = ['child-count', 'descendant-count', 'node-count', 'custom'];

combo.form = (panel) => {
const config = {
Expand All @@ -74,7 +74,10 @@ export const combo: STDTestCase = async (context) => {
collapsed: true,
collapsedOrigin: config.collapsedOrigin,
collapsedMarker: config.collapsedMarker,
collapsedMarkerType: config.collapsedMarkerType,
collapsedMarkerType:
config.collapsedMarkerType === 'custom'
? (children: any) => children.length.toString() + 'nodes'
: config.collapsedMarkerType,
},
},
]);
Expand All @@ -89,7 +92,6 @@ export const combo: STDTestCase = async (context) => {
collapsed: false,
collapsedOrigin: config.collapsedOrigin,
collapsedMarker: config.collapsedMarker,
collapsedMarkerType: config.collapsedMarkerType,
},
},
]);
Expand All @@ -104,7 +106,10 @@ export const combo: STDTestCase = async (context) => {
collapsed: true,
collapsedOrigin: config.collapsedOrigin,
collapsedMarker: config.collapsedMarker,
collapsedMarkerType: config.collapsedMarkerType,
collapsedMarkerType:
config.collapsedMarkerType === 'custom'
? (children: any) => children.length.toString() + 'nodes'
: config.collapsedMarkerType,
},
},
]);
Expand All @@ -119,12 +124,25 @@ export const combo: STDTestCase = async (context) => {
collapsed: false,
collapsedOrigin: config.collapsedOrigin,
collapsedMarker: config.collapsedMarker,
collapsedMarkerType: config.collapsedMarkerType,
},
},
]);
graph.render();
},
addRemoveNode: () => {
const node4 = graph.getNodeData('node-4');
if (node4) {
graph.removeNodeData(['node-4']);
} else {
graph.addNodeData([
{
id: 'node-4',
style: { parentId: 'combo-2', x: 100, y: 200, fill: 'pink' },
},
]);
}
graph.render();
},
};

return [
Expand All @@ -150,6 +168,7 @@ export const combo: STDTestCase = async (context) => {
panel.add(config, 'expandCombo1'),
panel.add(config, 'collapseCombo2'),
panel.add(config, 'expandCombo2'),
panel.add(config, 'addRemoveNode'),
];
};

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0de7ec9

Please sign in to comment.