Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 42 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,19 @@ jobs:
cache-dependency-path: './common/config/rush/pnpm-lock.yaml'

- name: Update npm
run: npm install -g npm@latest
run: npm install -g npm@11.6.2

- name: Verify npm authentication
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
node <<'NODE'
const { execFileSync } = require('child_process');
const username = execFileSync('npm', ['whoami', '--registry=https://registry.npmjs.org/'], {
encoding: 'utf8'
}).trim();
console.log(`npm publishing account: ${username}`);
NODE

- name: Install pnpm
run: npm install -g pnpm@10.7.0
Expand Down Expand Up @@ -137,16 +149,21 @@ jobs:
const path = require('path');
const { execSync } = require('child_process');

const baseDir = path.join(process.cwd(), 'common', 'changes', '@visactor', 'vgraph');
const baseDir = path.join(process.cwd(), 'common', 'changes');
let changefiles = [];

try {
const files = fs.readdirSync(baseDir).filter(name => name.endsWith('.json'));
for (const file of files) {
const fullPath = path.join(baseDir, file);
const json = JSON.parse(fs.readFileSync(fullPath, 'utf8'));
changefiles.push(json);
function collectChangefiles(directory) {
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
const fullPath = path.join(directory, entry.name);
if (entry.isDirectory()) {
collectChangefiles(fullPath);
} else if (entry.name.endsWith('.json')) {
changefiles.push(JSON.parse(fs.readFileSync(fullPath, 'utf8')));
}
}
}
collectChangefiles(baseDir);
console.log('Collected changefiles:', changefiles.length);
} catch (e) {
console.log('No changefiles found or unable to read, fallback to empty list.', e.message || e);
Expand Down Expand Up @@ -408,6 +425,9 @@ jobs:
echo "Build packages: ${package_names[*]}"
node common/scripts/install-run-rush.js build "${build_args[@]}"

- name: Test packages
run: node common/scripts/install-run-rush.js test --only tag:package

- name: Check npm versions (release)
if: startsWith(github.ref_name, 'release/')
id: npm_version_release
Expand Down Expand Up @@ -624,8 +644,11 @@ jobs:
rm -rf .changelog
find docs/assets/changelog -name '*.bak' -delete 2>/dev/null || true
git add .
git commit -m "build: release version ${{ steps.package_version_release.outputs.current_version }} [skip ci]" -n
git push --no-verify origin ${{ github.ref_name }}
git commit -m "$(cat <<'EOF'
build: release version ${{ steps.package_version_release.outputs.current_version }} [skip ci]
EOF
)"
git push origin ${{ github.ref_name }}
fi

- name: Commit & Push changes (hotfix)
Expand All @@ -636,8 +659,11 @@ jobs:
echo 'No changes to commit for hotfix branch.'
else
git add .
git commit -m "build: hotfix version ${{ steps.package_version_hotfix.outputs.current_version }} [skip ci]" -n
git push --no-verify origin ${{ github.ref_name }}
git commit -m "$(cat <<'EOF'
build: hotfix version ${{ steps.package_version_hotfix.outputs.current_version }} [skip ci]
EOF
)"
git push origin ${{ github.ref_name }}
fi

- name: Commit & Push changes (pre-release)
Expand All @@ -648,8 +674,11 @@ jobs:
echo 'No changes to commit for pre-release branch.'
else
git add .
git commit -m "build: prerelease version ${{ steps.package_version_prerelease.outputs.current_version }} [skip ci]" -n
git push --no-verify origin ${{ github.ref_name }}
git commit -m "$(cat <<'EOF'
build: prerelease version ${{ steps.package_version_prerelease.outputs.current_version }} [skip ci]
EOF
)"
git push origin ${{ github.ref_name }}
fi

- name: Create Pull Request to main (release)
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,6 @@ config/secrets.yml
logs/
__pycache__/
*.pyc

# Local Run button configuration
.trae/environments/
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@visactor/react-vgraph",
"comment": "Restore the optional Viewer setRenderOrder callback for mixed node and group title rendering, with regression tests and a comparison example.",
"type": "patch"
}
],
"packageName": "@visactor/react-vgraph"
}

This file was deleted.

11 changes: 6 additions & 5 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/config/rush/version-policies.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"definitionName":"lockStepVersion","policyName":"vgraphMain","version":"0.2.0","mainProject":"@visactor/vgraph","nextBump":"minor"}]
[{"definitionName":"lockStepVersion","policyName":"vgraphMain","version":"0.1.1","mainProject":"@visactor/vgraph","nextBump":"patch"}]
7 changes: 7 additions & 0 deletions docs/assets/changelog/en/release.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# v0.1.1

## Updates

- Restore the optional Viewer setRenderOrder callback for mixed node and group title rendering, with regression tests and a comparison example.
- Add edge-case tests for graph algorithms and graph data utilities.

# v0.1.0

## Updates
Expand Down
7 changes: 7 additions & 0 deletions docs/assets/changelog/zh/release.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# v0.1.1

## 更新内容

- Restore the optional Viewer setRenderOrder callback for mixed node and group title rendering, with regression tests and a comparison example.
- Add edge-case tests for graph algorithms and graph data utilities.

# v0.1.0

## 更新内容
Expand Down
22 changes: 22 additions & 0 deletions docs/assets/guide/en/react-node-spec/react-viewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,35 @@ export default () => {
| setAnchor | (node: Node, anchor: AnchorConfigs) => ReactNode | The React anchor component. |
| setAnchorClassName | (node: Node) => string \| string[] | Adds a `className` to the anchor container. |
| setGroupTitle | (group: Group) => ReactNode | \[NEW] The React group title component. Please configure `titleSize` on the group to use it. |
| setRenderOrder | (items: (Node \| Group)[]) => (Node \| Group)[] | Customize the DOM order of visible nodes and group titles. Defaults to group titles followed by nodes. Receives a new mixed array and returns the desired order. |
| localRendering | boolean | Whether to enable local rendering. When enabled, nodes only support stateless components. When disabled, they support stateful components. Default is enabled. |
| hideDetails | object | When the zoom ratio is very small, there may be many nodes on the screen, and the content of these nodes is basically unreadable. You can configure this option to display summary information and improve fluency. |
| hideDetails.ratio | number | Hides node details when the zoom ratio is less than `ratio`. |
| hideDetails.getNodeStyles | (node: Node) => Record<string, any> | The CSS style to be added to the container when the node is hidden. This can be used to display node categories, etc., to help users quickly locate nodes when they are very small. |
| responsiveNode | boolean | Whether to enable responsive React nodes. If enabled, it will respond to changes in the width and height of React nodes and trigger the redrawing of connection positions. |
| onResizeNode | (node: Node, bbox: BBox) => void | The callback function for when the width and height of a node change. |

### Custom Node and Group Title Order

```tsx
<Viewer
graph={graph}
setNode={setNode}
setGroupTitle={setGroupTitle}
setRenderOrder={(items) => items.reverse()}
/>
```

This reverses the default group-title-then-node order. The callback receives a
new array of visible elements, so in-place sorting does not mutate the Viewer's
node or group state arrays. It may run on every render, including an initial
empty array. Return the desired order without updating React state inside the
callback. Later elements usually cover earlier ones in the same stacking context;
explicit CSS stacking rules can change the final overlap.

The local `render_order.html` example compares both orders and verifies callback
execution and DOM order.

### Viewer ref Methods
| Method | Type | Description |
| --- | --- | --- |
Expand Down
21 changes: 20 additions & 1 deletion docs/assets/guide/zh/react-node-spec/react-viewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,34 @@ export default () => {
| setAnchor | (node: Node, anchor: AnchorConfigs) => ReactNode | React 锚点组件 |
| setAnchorClassName | (node: Node) => string \| string\[\] | 给锚点容器添加 className |
| setGroupTitle | (group: Group) => ReactNode | \[NEW\] React 分组标题组件。请在 group 上配置 `titleSize` 配合使用。 |
| setRenderOrder | (items: (Node \| Group)[]) => (Node \| Group)[] | 自定义可见节点与分组标题的 DOM 顺序。默认先分组标题、后节点;回调接收新的混合数组,返回期望的排列。 |
| localRendering | boolean | 是否开启局部渲染,开启后节点仅支持无状态组件,关闭后支持有状态组件。默认开启。 |
| hideDetails | object | 当缩放比很小时屏幕中可能有很多节点,而这些节点内容基本看不清,可以配置此选项显示概要信息并提升流畅度 |
| hideDetails.ratio | number | 当缩放比小于 ratio 时隐藏节点细节 |
| hideDetails.getNodeStyles | (node: Node) => Record<string, any> | 隐藏节点时加到容器上的 css 样式,可以在节点很小的时候展示节点分类等帮助用户快速定位节点。 |
| responsiveNode | boolean | 是否开启响应式 React 节点,如果开启,则会响应 React 节点的宽高变化并触发连线位置的重新绘制。 |
| onResizeNode | (node: Node, bbox: BBox) => void | 节点宽高发生变化时的回调函数。 |

### 自定义节点与分组标题的顺序

```tsx
<Viewer
graph={graph}
setNode={setNode}
setGroupTitle={setGroupTitle}
setRenderOrder={(items) => items.reverse()}
/>
```

这里将默认的“分组标题 → 节点”反转。回调接收当前可见元素的新数组,
原地排序不会改变 Viewer 的节点或分组状态数组。回调可能在每次渲染时执行,
包括初次渲染的空数组,应只返回排列结果,避免在其中更新 React 状态。
同一层叠上下文中,后面的元素通常覆盖前面的元素;显式 CSS 层级仍会影响最终遮挡。

本地 `render_order.html` 示例提供默认与反转顺序的对照,并校验回调与 DOM 顺序。

### Viewer ref 方法
| 方法 | 类型 | 描述 |
| --------- | ------------------------------------------------------------ | -------------------------------------------------- |
| refresh | (forced=false) => void; | 刷新 react 视图。Viewer 仅会在 graph 发生平移缩放时进行自动刷新,其余情况请按需手动刷新。当数据刷新时建议配置 force 为 true 强制刷新一次。 |
| updateSize | () => void; | 当图实例的大小发生变化时请调用 updateSize 保持组件的大小一致 |
| updateSize | () => void; | 当图实例的大小发生变化时请调用 updateSize 保持组件的大小一致 |
6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
},
"dependencies": {
"@arco-design/web-react": "2.39.3",
"@visactor/vgraph": "workspace:0.1.0",
"@visactor/react-vgraph": "workspace:0.1.0",
"@visactor/react-vgraph-ui": "workspace:0.1.0",
"@visactor/vgraph": "workspace:0.1.1",
"@visactor/react-vgraph": "workspace:0.1.1",
"@visactor/react-vgraph-ui": "workspace:0.1.1",
"buble": "^0.20.0",
"highlight.js": "^11.8.0",
"markdown-it": "^13.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/react-vgraph-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/react-vgraph-ui",
"version": "0.1.0",
"version": "0.1.1",
"description": "React UI components for VGraph",
"keywords": [
"react",
Expand Down Expand Up @@ -58,7 +58,7 @@
"@babel/preset-typescript": "^7.26.0",
"@internal/eslint-config": "workspace:*",
"@rushstack/eslint-patch": "~1.1.4",
"@visactor/vgraph": "workspace:0.1.0",
"@visactor/vgraph": "workspace:0.1.1",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "12",
"@types/jest": "^27.0.2",
Expand Down Expand Up @@ -93,7 +93,7 @@
"worker-loader": "^3.0.8"
},
"peerDependencies": {
"@visactor/vgraph": "^0.1.0",
"@visactor/vgraph": "^0.1.1",
"@arco-design/web-react": "^2.39.3",
"react": ">=16",
"react-dom": ">=16"
Expand Down
Loading
Loading