diff --git a/.github/workflows/auto-comment.yml b/.github/workflows/auto-comment.yml index de6abf7e737..bba2780841d 100644 --- a/.github/workflows/auto-comment.yml +++ b/.github/workflows/auto-comment.yml @@ -2,15 +2,14 @@ name: 💬 Auto Comment on: [issues, pull_request_target] +permissions: + contents: read + issues: write + pull-requests: write jobs: comment: runs-on: ubuntu-latest steps: - - uses: wow-actions/use-app-token@v1 - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.PRIVATE_KEY }} - env_name: bot_token - uses: wow-actions/auto-comment@v1 with: - GITHUB_TOKEN: ${{ env.bot_token }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f3a98956fad..7ef29b4a258 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [16.x] + node-version: [20.x] steps: - name: ⤵️ Checkout uses: actions/checkout@v3 diff --git a/.github/workflows/pr-label-file-paths.yml b/.github/workflows/pr-label-file-paths.yml index 6fe74808a3a..9708c95d64d 100644 --- a/.github/workflows/pr-label-file-paths.yml +++ b/.github/workflows/pr-label-file-paths.yml @@ -3,16 +3,14 @@ name: 🏷️ Label(File Paths) on: pull_request_target +permissions: + contents: read + pull-requests: write jobs: label: runs-on: ubuntu-latest steps: - - uses: wow-actions/use-app-token@v1 - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.PRIVATE_KEY }} - env_name: bot_token - uses: actions/labeler@v4 with: - repo-token: ${{ env.bot_token }} + repo-token: ${{ secrets.GITHUB_TOKEN }} configuration-path: .github/workflows/config/pr-label-file-paths.yml diff --git a/.github/workflows/pr-label-patch-size.yml b/.github/workflows/pr-label-patch-size.yml index 98bda62ffa4..e300e892dc1 100644 --- a/.github/workflows/pr-label-patch-size.yml +++ b/.github/workflows/pr-label-patch-size.yml @@ -2,17 +2,15 @@ name: 🏷️ Label(Patch Size) on: pull_request_target +permissions: + contents: read + pull-requests: write jobs: label: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: wow-actions/use-app-token@v1 - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.PRIVATE_KEY }} - env_name: bot_token - uses: pascalgn/size-label-action@v0.4.3 env: - GITHUB_TOKEN: ${{ env.bot_token }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} IGNORED: "!.gitignore\nyarn.lock" diff --git a/.github/workflows/pr-label-status.yml b/.github/workflows/pr-label-status.yml index d69d943477a..b2f89cf9b7a 100644 --- a/.github/workflows/pr-label-status.yml +++ b/.github/workflows/pr-label-status.yml @@ -7,16 +7,14 @@ on: workflow_run: workflows: ['🏷️ Label(Status) Dummy'] # the workflow in step 1 types: [requested] +permissions: + contents: read + pull-requests: write jobs: triage: runs-on: ubuntu-latest steps: - - uses: wow-actions/use-app-token@v1 - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.PRIVATE_KEY }} - env_name: bot_token - uses: wow-actions/pr-triage@v1 with: - GITHUB_TOKEN: ${{ env.bot_token }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} WORKFLOW_ID: ${{ github.event.workflow_run.id }} diff --git a/.github/workflows/update-cache.yaml b/.github/workflows/update-cache.yaml index cfbc7f71f75..4681ddd1585 100644 --- a/.github/workflows/update-cache.yaml +++ b/.github/workflows/update-cache.yaml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [16.x] + node-version: [20.x] steps: - name: ⤵️ Checkout uses: actions/checkout@v3 diff --git a/examples/x6-example-features/src/pages/undo/index.tsx b/examples/x6-example-features/src/pages/undo/index.tsx index 695c8c785ab..1260f5ba210 100644 --- a/examples/x6-example-features/src/pages/undo/index.tsx +++ b/examples/x6-example-features/src/pages/undo/index.tsx @@ -22,10 +22,46 @@ export default class Example extends React.Component< container: this.container, width: 800, height: 600, - grid: true, - history: true, + grid: { + size: 10, + visible: true, + type: 'doubleMesh', + args: [ + { + color: '#e6e6e6', + thickness: 1 + }, + { + color: '#ddd', + thickness: 1, + factor: 4 + } + ] + }, + history: { + enabled: true, + beforeAddCommand(event, args) { + if (args && 'options' in args && args.options) { + return args.options.ignore !== true + } + } + }, + selecting: { + enabled: true + }, embedding: { enabled: true, + findParent({ node }) { + const bbox = node.getBBox() + return this.getNodes().filter((node) => { + const data = node.getData() + if (data && data.parent) { + const targetBBox = node.getBBox() + return bbox.isIntersectWithRect(targetBBox) + } + return false + }) + } }, }) @@ -42,6 +78,7 @@ export default class Example extends React.Component< y: 120, width: 100, height: 40, + zIndex: 10, attrs: { label: { text: 'Hello', @@ -50,13 +87,14 @@ export default class Example extends React.Component< strokeWidth: 1, }, }, - }) + }, { ignore: true }) const target = graph.addNode({ x: 300, y: 320, width: 100, height: 40, + zIndex: 10, attrs: { label: { text: 'World', @@ -65,13 +103,14 @@ export default class Example extends React.Component< strokeWidth: 1, }, }, - }) + }, { ignore: true }) graph.addNode({ x: 400, y: 100, width: 150, height: 150, + zIndex: 1, attrs: { label: { text: '🌎', @@ -80,9 +119,64 @@ export default class Example extends React.Component< strokeWidth: 1, }, }, + data: { + parent: true + }, + }, { ignore: true }) + + graph.addEdge( + { + source, + target, + arrts: { + line: { + strokeWidth: 1 + } + }, + vertices: [ + { + x: 220, + y: 220 + }, + { + x: 120, + y: 320 + }, + { + x: 300, + y: 400 + } + ] + }, + { ignore: true } + ) + + graph.on('edge:click', ({ cell }) => { + if (!cell.hasTool('vertices')) { + cell.addTools( + { + name: 'vertices', + args: { + stopPropagation: false, + addable: true, + removeable: false, + removeRedundancies: false, + snapRadius: 10, + attrs: { + r: 4 + } + } + } + ) + } }) - graph.addEdge({ source, target, arrts: { line: { strokeWidth: 1 } } }) + graph.on('edge:unselected', ({ cell }) => { + cell.removeTools() + }) + graph.on('edge:mouseup', ({ cell }) => { + console.log('edge:mouseup', cell) + }) } onUndo = () => { @@ -100,7 +194,7 @@ export default class Example extends React.Component< render() { return (
-

Default Settings

+

Edge Vertices & History & Embedding