Compare commits

..

14 Commits

Author SHA1 Message Date
502422fe24 Delete .lgtm.yml 2022-12-05 17:06:19 +08:00
bubkoo
8daf0fd62c chore: config codeql 2022-12-05 16:55:39 +08:00
x6-bot[bot]
a108b50a66 chore: update contributors [skip ci] 2022-12-03 03:49:59 +00:00
vector
525bac1907 chore: release @antv/x6-plugin-selection@2.1.5 (#2994) 2022-12-03 11:49:38 +08:00
x6-bot[bot]
34ec3d29ab chore: update CONTRIBUTORS [skip ci] 2022-12-03 03:34:26 +00:00
Simon He
74fb7b86d7 chore: add eslintcache (#2993)
* chore: add eslintcache

* chore: add eslintcache
2022-12-03 11:27:56 +08:00
vector
1fb2d8308a fix: use geometry in selection box (#2992) 2022-12-02 17:49:13 +08:00
x6-bot[bot]
b2b8ac578c chore: update CONTRIBUTORS [skip ci] 2022-12-02 08:51:57 +00:00
x6-bot[bot]
1b03004ee5 chore: update contributors [skip ci] 2022-12-02 08:44:34 +00:00
njshuisheng
53c9eaf626 chore: update wrong comment word (#2991)
Co-authored-by: hehongsheng <hehongsheng@dolinkhub.com>
2022-12-02 16:44:14 +08:00
vector
05d1fe35d6 fix: remove lint error (#2979)
* chore: release 4 packages

x6@2.0.6
x6-plugin-export@2.1.4
x6-plugin-snapline@2.1.6
x6-react-shape@2.0.6

* fix: remove lint error
2022-12-01 11:51:31 +08:00
bubkoo
b05d1596dd chore: update deps 2022-12-01 11:38:15 +08:00
bubkoo
8843212f53 chore: move '--debug' to env variable 'SRM_DEBUG' 2022-12-01 11:38:15 +08:00
vector
f920d5a4ee fix: export toJpeg methods in export plugin (#2974) 2022-11-30 10:50:30 +08:00
31 changed files with 6247 additions and 4201 deletions

View File

@@ -1,4 +1,4 @@
name: "CodeQL"
name: ⛵️ CodeQL
on:
push:
@@ -30,7 +30,7 @@ jobs:
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql.yml
config-file: ./.github/workflows/config/codeql.yml
queries: +security-and-quality
- name: Autobuild

View File

@@ -57,8 +57,9 @@ jobs:
private_key: ${{ secrets.PRIVATE_KEY }}
- name: 📦 Semantic Release
run: pnpm srm --debug --combine-commits --comment-footer 'Thanks for being a part of the [AntV](https://github.com/antvis) community! 💪💯'
run: pnpm srm --combine-commits --comment-footer 'Thanks for being a part of the [AntV](https://github.com/antvis) community! 💪💯'
env:
SRM_DEBUG: ${{ secrets.SRM_DEBUG }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ env.BOT_TOKEN }}

1
.gitignore vendored
View File

@@ -15,3 +15,4 @@ dist
tmp
test/coverage
packages/**/src/style/raw.ts
.eslintcache

View File

@@ -1,12 +0,0 @@
# @see https://help.semmle.com/lgtm-enterprise/user/help/lgtm.yml-configuration-file.html
# @template https://lgtm.com/static/downloads/lgtm.template.yml
queries:
- exclude: js/use-before-declaration
- exclude: js/polynomial-redos
extraction:
javascript:
index:
filters:
- exclude: "sites/x6-sites/static"

View File

@@ -27,6 +27,7 @@ Opportunity <opportunity@live.in>
Questions <chip@twostewards.com>
RuiLin <on>
SSC <273702440@qq.com>
Simon <>
Sindori <441933726@qq.com>
Susan <527971893@qq.com>
Thomas <eugne>
@@ -58,6 +59,7 @@ myzxlin <myzxlin@163.com>
newbyvector <vectorse@126.com>
niexq <1879633916@qq.com>
niexq <niexq@firstgrid.cn>
njshuisheng <34205271+njshuisheng@users.noreply.github.com>
pengxingjian.pxj <pengxingjian.pxj@alibaba-inc.com>
pfdgithub <pfdgithub@users.noreply.github.com>
qingchi <qinky94@163.com>

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 11 MiB

After

Width:  |  Height:  |  Size: 12 MiB

View File

@@ -3,8 +3,8 @@
"private": true,
"scripts": {
"preinstall": "node ./scripts/preinstall",
"lint:ts": "eslint '**/src/**/*.{js,ts}?(x)' --fix",
"lint:style": "stylelint '**/src/**/*.less' --syntax less --fix",
"lint:ts": "eslint '**/src/**/*.{js,ts}?(x)' --cache --fix",
"lint:style": "stylelint '**/src/**/*.less' --syntax less --cache --fix",
"lint": "run-s lint:ts lint:style",
"prettier": "prettier --write '**/*.{js,mjs,jsx,tsx,ts,less,md,json}'",
"pretty-quick": "pretty-quick",
@@ -89,23 +89,23 @@
}
},
"dependencies": {
"@babel/core": "^7.20.2",
"@babel/core": "^7.20.5",
"@babel/plugin-syntax-flow": "^7.18.6",
"@babel/plugin-transform-react-jsx": "^7.19.0",
"@commitlint/config-conventional": "^17.3.0",
"@rollup/plugin-commonjs": "^23.0.2",
"@rollup/plugin-commonjs": "^23.0.3",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-replace": "^5.0.1",
"@rollup/plugin-typescript": "^8.2.5",
"@semantic-release-monorepo/cli": "^2.1.0",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release-monorepo/cli": "^2.1.2",
"@semantic-release/changelog": "^6.0.2",
"@semantic-release/git": "^10.0.1",
"@types/jasmine": "^4.3.0",
"@types/jest": "^29.2.3",
"@types/node": "^18.11.9",
"@types/node": "^18.11.10",
"@types/sinon": "^10.0.2",
"@typescript-eslint/eslint-plugin": "^5.44.0",
"@typescript-eslint/parser": "^5.44.0",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"boxen": "^7.0.0",
"colors": "^1.4.0",
"coveralls": "^3.1.1",
@@ -121,8 +121,8 @@
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.31.11",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-unicorn": "^45.0.0",
"fs-extra": "^10.0.0",
"eslint-plugin-unicorn": "^45.0.1",
"fs-extra": "^11.1.0",
"husky": "^8.0.1",
"is-ci": "^3.0.0",
"jasmine-core": "^4.5.0",
@@ -141,7 +141,7 @@
"prettier": "^2.8.0",
"pretty-quick": "^3.1.1",
"rimraf": "^3.0.2",
"rollup": "^3.4.0",
"rollup": "^3.5.0",
"rollup-plugin-auto-external": "^2.0.0",
"rollup-plugin-filesize": "^9.1.1",
"rollup-plugin-postcss": "^4.0.1",
@@ -149,7 +149,7 @@
"rollup-plugin-terser": "^7.0.2",
"run-shared-scripts": "^1.1.4",
"semantic-release": "^19.0.5",
"sinon": "^14.0.1",
"sinon": "^15.0.0",
"stylelint": "^14.15.0",
"stylelint-config-prettier": "^9.0.4",
"stylelint-config-rational-order": "^0.1.2",

View File

@@ -1,6 +1,6 @@
{
"name": "@antv/x6-common",
"version": "2.0.2",
"version": "2.0.3",
"description": "Basic toolkit for X6",
"main": "lib/index.js",
"module": "es/index.js",

View File

@@ -6,5 +6,5 @@ export {
sortBy,
groupBy,
difference,
max
max,
} from 'lodash-es'

View File

@@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-export",
"version": "2.1.2",
"version": "2.1.4",
"description": "export plugin for X6.",
"main": "lib/index.js",
"module": "es/index.js",

View File

@@ -3,12 +3,54 @@ import { Export } from './index'
declare module '@antv/x6/lib/graph/graph' {
interface Graph {
toSVG: (
callback: Export.ToSVGCallback,
options: Export.ToSVGOptions,
) => void
toPNG: (
callback: Export.ToSVGCallback,
options: Export.ToImageOptions,
) => void
toJPEG: (
callback: Export.ToSVGCallback,
options: Export.ToImageOptions,
) => void
exportPNG: (fileName?: string, options?: Export.ToImageOptions) => void
exportJPEG: (fileName?: string, options?: Export.ToImageOptions) => void
exportSVG: (fileName?: string, options?: Export.ToSVGOptions) => void
}
}
Graph.prototype.toSVG = function (
callback: Export.ToSVGCallback,
options: Export.ToSVGOptions,
) {
const instance = this.getPlugin('export') as Export
if (instance) {
instance.toSVG(callback, options)
}
}
Graph.prototype.toPNG = function (
callback: Export.ToSVGCallback,
options: Export.ToImageOptions,
) {
const instance = this.getPlugin('export') as Export
if (instance) {
instance.toPNG(callback, options)
}
}
Graph.prototype.toJPEG = function (
callback: Export.ToSVGCallback,
options: Export.ToImageOptions,
) {
const instance = this.getPlugin('export') as Export
if (instance) {
instance.toJPEG(callback, options)
}
}
Graph.prototype.exportPNG = function (
fileName?: string,
options?: Export.ToImageOptions,

View File

@@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-selection",
"version": "2.1.4",
"version": "2.1.5",
"description": "selection plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",

View File

@@ -464,7 +464,6 @@ export namespace Selection {
multipleSelectionModifiers: ['ctrl', 'meta'],
movable: true,
strict: false,
useCellGeometry: false,
selectCellOnMoved: false,
selectNodeOnMoved: false,
selectEdgeOnMoved: false,

View File

@@ -607,29 +607,21 @@ export class SelectionImpl extends View<SelectionImpl.EventArgs> {
let views: CellView[] = []
if (this.options.rubberNode) {
if (this.options.useCellGeometry) {
views = views.concat(
graph.model
.getNodesInArea(rect, options)
.map((node) => graph.renderer.findViewByCell(node))
.filter((view) => view != null) as CellView[],
)
} else {
views = views.concat(graph.renderer.findViewsInArea(rect, options))
}
views = views.concat(
graph.model
.getNodesInArea(rect, options)
.map((node) => graph.renderer.findViewByCell(node))
.filter((view) => view != null) as CellView[],
)
}
if (this.options.rubberEdge) {
if (this.options.useCellGeometry) {
views = views.concat(
graph.model
.getEdgesInArea(rect, options)
.map((edge) => graph.renderer.findViewByCell(edge))
.filter((view) => view != null) as CellView[],
)
} else {
views = views.concat(graph.renderer.findEdgeViewsInArea(rect, options))
}
views = views.concat(
graph.model
.getEdgesInArea(rect, options)
.map((edge) => graph.renderer.findViewByCell(edge))
.filter((view) => view != null) as CellView[],
)
}
return views
@@ -761,7 +753,7 @@ export class SelectionImpl extends View<SelectionImpl.EventArgs> {
const view = this.graph.renderer.findViewByCell(cell)
if (view) {
const bbox = view.getBBox({
useCellGeometry: this.options.useCellGeometry,
useCellGeometry: true,
})
origin.x = Math.min(origin.x, bbox.x)
origin.y = Math.min(origin.y, bbox.y)
@@ -822,7 +814,7 @@ export class SelectionImpl extends View<SelectionImpl.EventArgs> {
const view = this.graph.renderer.findViewByCell(cell)
if (view) {
const bbox = view.getBBox({
useCellGeometry: this.options.useCellGeometry,
useCellGeometry: true,
})
const className = this.boxClassName
@@ -899,7 +891,7 @@ export class SelectionImpl extends View<SelectionImpl.EventArgs> {
protected onCellAdded({ cell }: Collection.EventArgs['added']) {
// The collection do not known the cell was removed when cell was
// removed by interaction(such as, by "delete" shortcut), so we should
// manually listen to cell's remove evnet.
// manually listen to cell's remove event.
this.listenCellRemoveEvent(cell)
this.createSelectionBox(cell)
this.updateContainer()
@@ -971,7 +963,6 @@ export namespace SelectionImpl {
showNodeSelectionBox?: boolean
movable?: boolean
following?: boolean
useCellGeometry?: boolean
content?: Content
// Can select node or edge when rubberband

View File

@@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-snapline",
"version": "2.1.4",
"version": "2.1.6",
"description": "snapline plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",

View File

@@ -57,17 +57,17 @@
"classnames": "^2.2.6",
"rc-dropdown": "^3.0.0-alpha.0",
"rc-util": "^4.15.7",
"react-color": "2.17.1",
"react-color": "2.19.3",
"react-resize-detector": "^7.0.0",
"ua-parser-js": "^0.7.20"
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-color": "^3.0.1",
"@types/react-resize-detector": "^6.1.0",
"@types/react-dom": "^18.0.9",
"@types/react-resize-detector": "^6.1.0",
"@types/ua-parser-js": "^0.7.33",
"antd": "^5.0.0",
"antd": "^5.0.3",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},

View File

@@ -1,6 +1,6 @@
{
"name": "@antv/x6-react-shape",
"version": "2.0.5",
"version": "2.0.7",
"description": "X6 shape for rendering react components.",
"main": "lib/index.js",
"module": "es/index.js",

View File

@@ -13,7 +13,7 @@ export class ReactShapeView extends NodeView<ReactShape> {
root?: Root
getComponentContainer() {
return this.selectors.foContent as HTMLDivElement
return this.selectors && (this.selectors.foContent as HTMLDivElement)
}
confirmUpdate(flag: number) {

View File

@@ -18,7 +18,7 @@ export class VueShapeView extends NodeView<VueShape> {
})
}
protected targetId(){
protected targetId() {
return `${this.graph.view.cid}:${this.cell.id}`
}

View File

@@ -1,6 +1,6 @@
{
"name": "@antv/x6",
"version": "2.0.3",
"version": "2.0.6",
"description": "JavaScript diagramming library that uses SVG and HTML for rendering",
"main": "lib/index.js",
"module": "es/index.js",

View File

@@ -149,7 +149,7 @@ export class GraphView extends View {
protected onContextMenu(evt: Dom.ContextMenuEvent) {
const e = this.normalizeEvent(evt)
const view = this.findView(e.target)
if (this.isPreventDefaultContextMenu(view)) {
evt.preventDefault()
}

View File

@@ -54,7 +54,7 @@ export interface ResolvedOptions {
/**
* Should certain nodes not be considered as obstacles?
*/
excludeNodes: Node[]
excludeNodes: Node[]
/**
* Possible starting directions from a node.

View File

@@ -328,7 +328,7 @@ export const router: Router.Definition<ManhattanRouterOptions> = function (
if (partialRoute === null) {
// eslint-next-line
console.warn(`Unable to execute manhattan algorithm, use orth instead`)
return FunctionExt.call(
options.fallbackRouter,
this,

View File

@@ -827,7 +827,10 @@ export class NodeView<
})
this.stopPropagation(e)
} else {
if (Dom.hasClass(magnet, 'x6-port-body') || !!magnet.closest('.x6-port-body')) {
if (
Dom.hasClass(magnet, 'x6-port-body') ||
!!magnet.closest('.x6-port-body')
) {
this.stopPropagation(e)
}
this.onMouseDown(e, x, y)

10194
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,10 @@ import React, { PropsWithChildren } from 'react'
import { Toolbar } from '../toolbar'
import './content.css'
export class Content extends React.Component<PropsWithChildren<Content.Props>, Content.State> {
export class Content extends React.Component<
PropsWithChildren<Content.Props>,
Content.State
> {
private container: HTMLDivElement
constructor(props: Content.Props) {

View File

@@ -1,18 +0,0 @@
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/typescript/recommended'
],
parserOptions: {
ecmaVersion: 2020
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
}
}

View File

@@ -1,7 +1,6 @@
import { createApp } from 'vue'
import App from './App.vue'
import ElementUI from 'element-plus'
import App from './App.vue'
import 'element-plus/dist/index.css'
createApp(App).use(ElementUI).mount('#app')

View File

@@ -1,18 +0,0 @@
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/typescript/recommended'
],
parserOptions: {
ecmaVersion: 2020
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
}
}

View File

@@ -1,7 +1,6 @@
import { createApp } from 'vue'
import App from './App.vue'
import ElementUI from 'element-plus'
import App from './App.vue'
import 'element-plus/dist/index.css'
createApp(App).use(ElementUI).mount('#app')