Compare commits

..

218 Commits

Author SHA1 Message Date
2685e331bb chore: release 2 packages () 2023-03-02 17:36:39 +08:00
ab0c7fe8f2 docs: fix error in cylinder shape () 2023-03-02 17:24:58 +08:00
c76a23b534 fix: add excludeShapes options for manhattan router () 2023-03-02 17:24:46 +08:00
2285e5592e chore: add src to files () 2023-03-02 17:01:55 +08:00
8ebd6dfd76 Feat/history add getSize ()
* feat: add getSize api

* doc: history doc

* feat: add setSize api

* feat: change order

* feat: fix setSize

* fix: add get  hisotry undo stack remain size

* feat: plugin get size

* feat: add doc
2023-03-02 16:53:57 +08:00
a1d86424cf fix: throw error when render edge without terminal () 2023-03-02 16:39:04 +08:00
309b5a7ff7 docs: remove freeze call () 2023-03-02 16:38:46 +08:00
5338b73861 chore(release): release 1 package [skip ci]
[@antv/x6-sites@1.6.3](https://github.com/antvis/X6/releases/tag/%40antv/x6-sites%401.6.3)
2023-03-02 06:13:24 +00:00
90f5912529 docs: update screenshot for curve demo () 2023-03-02 14:02:12 +08:00
3cd75ec40e chore: update contributors [skip ci] 2023-03-01 11:13:18 +00:00
1904e28f77 chore: should toast pnpm >= 7 ()
feat: should limit pnpm >= 7
2023-03-01 19:12:53 +08:00
75c878009e chore: update contributors [skip ci] 2023-03-01 06:31:31 +00:00
ece81529bb chore: add awesome-x6 link ()
* chore: add awesome-x6 link

* chore: add awesome-x6 link
2023-03-01 14:31:09 +08:00
94a7f85882 chore: not required plugin should use optional options ()
chore: not required should use optional
2023-03-01 10:18:31 +08:00
11ae288eb0 chore: update contributors [skip ci] 2023-03-01 01:30:28 +00:00
3cc8b764b1 chore(release): release 1 package [skip ci]
[@antv/x6-sites@1.6.2](https://github.com/antvis/X6/releases/tag/%40antv/x6-sites%401.6.2)
2023-02-28 07:41:12 +00:00
5758ef80ef docs: getstart () 2023-02-28 15:25:42 +08:00
3811a6c0b2 chore(release): release 1 package [skip ci]
[@antv/x6-sites@1.6.1](https://github.com/antvis/X6/releases/tag/%40antv/x6-sites%401.6.1)
2023-02-27 09:14:54 +00:00
672f104991 docs: update example styles for website () 2023-02-27 17:00:15 +08:00
2571cb4ceb chore: update license () 2023-02-27 16:19:16 +08:00
d83bcea863 chore: update contributors [skip ci] 2023-02-27 07:59:22 +00:00
38bdf65dde feat: support angular shape for 2.x ()
* feat: add angular shape

* docs: add angular shape docs

* docs: update docs

* fix: 修复无法在 shape 内部安装依赖的问题
2023-02-27 15:59:01 +08:00
f5db2bb415 chore: update contributors [skip ci] 2023-02-27 07:43:52 +00:00
a3aa2a0da2 fix: fix editor-tool for edge () 2023-02-27 15:43:29 +08:00
2bce01dee8 chore: update CONTRIBUTORS [skip ci] 2023-02-27 03:42:56 +00:00
a30b6632a0 feat: add view:mounted and view:unmounted event () 2023-02-27 11:41:22 +08:00
7656b38735 fix: cannot be invoked without new ()
fix Class constructor xx cannot be invoked without 'new'
2023-02-27 11:35:37 +08:00
d953a732b3 chore(release): release 1 package [skip ci]
[@antv/x6-sites@1.5.5](https://github.com/antvis/X6/releases/tag/%40antv/x6-sites%401.5.5)
2023-02-27 03:05:34 +00:00
6317493347 docs: optimize examples style for doc () 2023-02-27 10:54:45 +08:00
8fc0b72b66 chore: update contributors [skip ci] 2023-02-27 01:29:39 +00:00
18fca29bd7 chore: update contributors [skip ci] 2023-02-24 12:33:15 +00:00
7e61014b65 docs: set version list to 2.x and 1.x () 2023-02-24 20:32:48 +08:00
8dd2b66633 chore(release): release 3 packages [skip ci]
[@antv/x6-common@2.0.10](https://www.npmjs.com/package/@antv/x6-common/v/2.0.10)
[@antv/x6-common@2.0.10](https://github.com/antvis/X6/releases/tag/%40antv/x6-common%402.0.10)

[@antv/x6-plugin-transform@2.1.6](https://www.npmjs.com/package/@antv/x6-plugin-transform/v/2.1.6)
[@antv/x6-plugin-transform@2.1.6](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-transform%402.1.6)

[@antv/x6-sites@1.5.4](https://github.com/antvis/X6/releases/tag/%40antv/x6-sites%401.5.4)
2023-02-24 08:56:41 +00:00
76fb1acf74 fix: add textLength & lengthAdjust to CASE_SENSITIVE_ATTR () 2023-02-24 16:45:35 +08:00
709a141e28 fix: transform active-handle class should remove when active removed ()
fix: transform
2023-02-24 16:42:49 +08:00
2ee81fd94b chore: update CONTRIBUTORS [skip ci] 2023-02-23 15:00:09 +00:00
054eb998fa chore: update contributors [skip ci] 2023-02-23 14:53:56 +00:00
e32227ae31 docs: fix warning display style () 2023-02-23 22:53:33 +08:00
278b798c0a chore: update CONTRIBUTORS [skip ci] 2023-02-23 13:37:37 +00:00
c4e11dc98f chore: update contributors [skip ci] 2023-02-23 13:29:51 +00:00
df8466aa33 doc: 修复graph文档 () 2023-02-23 21:29:31 +08:00
1b958d626f chore: release x6@2.5.1 () 2023-02-23 11:17:21 +08:00
946582c242 fix: add judgment for edge view () 2023-02-23 11:12:42 +08:00
482d77ad09 chore(release): release 1 package [skip ci]
[@antv/x6-sites@1.5.3](https://github.com/antvis/X6/releases/tag/%40antv/x6-sites%401.5.3)
2023-02-23 03:01:42 +00:00
3103c11991 chore: change docsearch appid () 2023-02-23 10:50:48 +08:00
3c9093f3ec chore: release 2 packages () 2023-02-23 10:50:29 +08:00
8a89caab27 chore: update contributors [skip ci] 2023-02-23 01:29:28 +00:00
ed999c630c docs: fix a broken link in model.zh.md () 2023-02-22 21:03:46 +08:00
34bcd12038 chore: update CONTRIBUTORS [skip ci] 2023-02-22 08:09:25 +00:00
9138978918 fix: leading reset render area when init ()
feat: refactor the virtual rendering logic
2023-02-22 16:02:44 +08:00
46f4c8ac2a chore: update CONTRIBUTORS [skip ci] 2023-02-21 07:09:05 +00:00
7519b11e66 chore: update contributors [skip ci] 2023-02-21 07:01:22 +00:00
5882b6a599 docs: fix typo in stencil.md () 2023-02-21 15:01:00 +08:00
9781fb48f5 chore: update CONTRIBUTORS [skip ci] 2023-02-20 07:21:00 +00:00
c8a03ed2ba chore: update contributors [skip ci] 2023-02-20 07:14:36 +00:00
b944419572 docs: fix typo in labels.zh.md () 2023-02-20 15:14:14 +08:00
bebc5652d1 chore: update contributors [skip ci] 2023-02-19 01:29:30 +00:00
8daa2c9b98 chore(release): release 3 packages [skip ci]
[@antv/x6-common@2.0.8](https://www.npmjs.com/package/@antv/x6-common/v/2.0.8)
[@antv/x6-common@2.0.8](https://github.com/antvis/X6/releases/tag/%40antv/x6-common%402.0.8)

[@antv/x6-example-features@2.1.1](https://github.com/antvis/X6/releases/tag/%40antv/x6-example-features%402.1.1)

[@antv/x6-sites@1.5.2](https://github.com/antvis/X6/releases/tag/%40antv/x6-sites%401.5.2)
2023-02-18 22:39:19 +00:00
c510756fe4 fix: mindmap demo duplicate node id, close () 2023-02-19 06:28:20 +08:00
9b4fa86daa fix: fix typo for dom event handlers () 2023-02-19 06:28:02 +08:00
7e86ba90d6 chore: update contributors [skip ci] 2023-02-18 01:29:04 +00:00
f27bec6bb8 chore: update CONTRIBUTORS [skip ci] 2023-02-17 15:37:04 +00:00
c38006a358 docs: history插件文档补充stackSize属性的说明 () 2023-02-17 23:28:02 +08:00
5f2783aade chore(release): release 2 packages [skip ci]
[@antv/x6-example-features@2.1.0](https://github.com/antvis/X6/releases/tag/%40antv/x6-example-features%402.1.0)

[@antv/x6-plugin-history@2.2.0](https://www.npmjs.com/package/@antv/x6-plugin-history/v/2.2.0)
[@antv/x6-plugin-history@2.2.0](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-history%402.2.0)
2023-02-17 13:57:56 +00:00
fba531064a feat: history add max stack size ()
* feat: init

* feat: add demo

* feat: add demo

* feat: add demo

* feat: limit undoStack size

* feat: 0 means not limit

---------

Co-authored-by: lijianqiang.seven <lijianqiang.seven@bytedance.com>
Co-authored-by: zhangzirui.1993 <zhangzirui.1993@bytedance.com>
2023-02-17 21:46:59 +08:00
04656f33f4 feat: add updateNode/updateEdge API ()
* feat: add updateNode/updateEdge API 

* feat: add updateNode/updateEdge API 

* feat: update return value

* fix: call error create function
2023-02-17 21:27:40 +08:00
441dd564b4 chore: update CONTRIBUTORS [skip ci] 2023-02-16 11:11:30 +00:00
9ccda3e96f fix: donot empty text when only has title elem () 2023-02-16 19:04:46 +08:00
979b2556e9 chore: update contributors [skip ci] 2023-02-16 01:29:34 +00:00
153013a606 chore: update CONTRIBUTORS [skip ci] 2023-02-15 03:16:40 +00:00
2c7b966f45 chore: queueJob optimize ()
* chore: queueJob optimize

* chore: queueJob optimize

* chore: queueJob optimize
2023-02-15 11:10:00 +08:00
b199153f3b chore: update CONTRIBUTORS [skip ci] 2023-02-13 15:12:24 +00:00
608ce9ac6c chore: update contributors [skip ci] 2023-02-13 15:05:20 +00:00
eb921f7018 docs: fix typo () 2023-02-13 23:04:59 +08:00
68e7132213 chore: update contributors [skip ci] 2023-02-12 01:29:21 +00:00
62aa5323ce chore: update contributors [skip ci] 2023-02-11 01:28:45 +00:00
e380cba7d9 chore: update CONTRIBUTORS [skip ci] 2023-02-10 02:03:59 +00:00
8fada570e4 fix: add padding options for position api () 2023-02-10 09:57:41 +08:00
1096bf171b fix: fix scroller options typo () 2023-02-10 09:57:22 +08:00
1834cd2143 chore: update contributors [skip ci] 2023-02-09 06:26:51 +00:00
1cf9cb654f chore: should use local to format () 2023-02-09 14:26:30 +08:00
b392d78856 chore(release): release 3 packages [skip ci]
[@antv/x6@2.3.0](https://www.npmjs.com/package/@antv/x6/v/2.3.0)
[@antv/x6@2.3.0](https://github.com/antvis/X6/releases/tag/%40antv/x6%402.3.0)

[@antv/x6-plugin-keyboard@2.2.0](https://www.npmjs.com/package/@antv/x6-plugin-keyboard/v/2.2.0)
[@antv/x6-plugin-keyboard@2.2.0](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-keyboard%402.2.0)

[@antv/x6-sites@1.5.0](https://github.com/antvis/X6/releases/tag/%40antv/x6-sites%401.5.0)
2023-02-06 14:39:13 +00:00
58c0fe459c feat: add options for positionCell api () 2023-02-06 22:28:20 +08:00
8a510fa8f8 chore: update contributors [skip ci] 2023-02-06 14:16:48 +00:00
668c93242f feat: keyboard support clear and custom trigger ()
* feat: keyboard support clear and custom trigger

* feat: keyboard support clear and custom trigger

* feat: add return this

* feat: add doc

* feat: add doc

* feat: adjust order

* feat: change order

---------

Co-authored-by: Struggle <lijianqiang.seven@bytedance.com>
2023-02-06 22:16:28 +08:00
c122b2122c chore: update CONTRIBUTORS [skip ci] 2023-02-06 04:14:50 +00:00
3b9957efbb chore: update contributors [skip ci] 2023-02-06 04:08:38 +00:00
1f83a2b8a8 fix(scheduler): remove spammy console.log ()
fix: remove spammy console.log

Hey, 
This console.log ended up in production build, not sure it was on purpose.
2023-02-06 12:08:14 +08:00
6699c2bd00 chore: update contributors [skip ci] 2023-02-03 06:10:28 +00:00
7192209a5c Feat plugins dis and en ()
* fix: graph plugin support disable and enable

* fix: graph plugin support disable and enable

* fix: graph plugin support disable and enable and add getPlugins

* fix: deal compatibility problem

* chore: unify plugin disable and enable return value

* chore: unify plugin disable and enable return value

* feat: add disposePlugins and isEnabled

* feat: optimize test form

---------

Co-authored-by: seven <lijianqiang.seven@bytedance.com>
2023-02-03 14:10:03 +08:00
5da5575451 chore: remove empty line in comment 2023-02-03 12:13:15 +08:00
3377049a49 chore: checkout repo without credentials 2023-02-03 12:13:15 +08:00
4e76734cee chore(release): release 1 package [skip ci]
[@antv/x6@2.2.1](https://www.npmjs.com/package/@antv/x6/v/2.2.1)
[@antv/x6@2.2.1](https://github.com/antvis/X6/releases/tag/%40antv/x6%402.2.1)
2023-02-02 09:13:25 +00:00
3a59703f1c fix: ensure the container in html view () 2023-02-02 17:00:48 +08:00
45218c36f6 fix: set correct scroller options () 2023-02-02 16:39:46 +08:00
17b36e21c7 fix: clear old background when background enabled in background () 2023-02-01 22:55:29 +08:00
1682a1d953 chore: update CONTRIBUTORS [skip ci] 2023-02-01 11:27:54 +00:00
bcf3380d2b fix: get correct clipboard content when useLocalStorage enabed () 2023-02-01 19:20:26 +08:00
24368d4f86 chore(release): release 4 packages [skip ci]
[@antv/x6@2.2.0](https://www.npmjs.com/package/@antv/x6/v/2.2.0)
[@antv/x6@2.2.0](https://github.com/antvis/X6/releases/tag/%40antv/x6%402.2.0)

[@antv/x6-common@2.0.6](https://www.npmjs.com/package/@antv/x6-common/v/2.0.6)
[@antv/x6-common@2.0.6](https://github.com/antvis/X6/releases/tag/%40antv/x6-common%402.0.6)

[@antv/x6-react-components@2.0.7](https://www.npmjs.com/package/@antv/x6-react-components/v/2.0.7)
[@antv/x6-react-components@2.0.7](https://github.com/antvis/X6/releases/tag/%40antv/x6-react-components%402.0.7)

[@antv/x6-sites@1.4.0](https://github.com/antvis/X6/releases/tag/%40antv/x6-sites%401.4.0)
2023-01-31 09:52:16 +00:00
3265fe5b98 feat: add port events () 2023-01-31 17:41:12 +08:00
5599286473 chore: update CONTRIBUTORS [skip ci] 2023-01-30 19:48:36 +00:00
d64150bfad fix: fix index error for priorityQueue () 2023-01-31 03:41:53 +08:00
cae8625feb fix: don't hide when click on color picker () 2023-01-29 14:47:43 +08:00
d8f1729f09 chore: update contributors [skip ci] 2023-01-28 07:57:12 +00:00
20c170b44a Fix/edge mousedown ()
* fix: onMousedown add event notify

* fix: onMousedown add super event notify

* fix: use notifyMouseDown

---------

Co-authored-by: seven <lijianqiang.seven@bytedance.com>
2023-01-28 15:56:54 +08:00
0e8769642a chore: update contributors [skip ci] 2023-01-28 06:20:00 +00:00
bd30f7f61d fix: prevent highlighting new edge () 2023-01-28 14:19:38 +08:00
e3e7cfc66f chore: update CONTRIBUTORS [skip ci] 2023-01-28 02:17:37 +00:00
c86ed1a031 chore: use find to repalce forEach ()
Co-authored-by: seven <lijianqiang.seven@bytedance.com>
2023-01-28 10:09:53 +08:00
ae179eb2cd chore(release): release 1 package [skip ci]
[@antv/x6@2.1.6](https://www.npmjs.com/package/@antv/x6/v/2.1.6)
[@antv/x6@2.1.6](https://github.com/antvis/X6/releases/tag/%40antv/x6%402.1.6)
2023-01-19 02:28:11 +00:00
2a3e523b1b refactor: refactor cell remove schedule () 2023-01-19 10:17:11 +08:00
b5af7844af chore(release): release 1 package [skip ci]
[@antv/x6-common@2.0.5](https://www.npmjs.com/package/@antv/x6-common/v/2.0.5)
[@antv/x6-common@2.0.5](https://github.com/antvis/X6/releases/tag/%40antv/x6-common%402.0.5)
2023-01-18 15:08:37 +00:00
9c48ad8dfc fix: optimize css loader () 2023-01-18 22:55:16 +08:00
1a5f1655df chore(release): release 2 packages [skip ci]
[@antv/x6-example-features@2.0.2](https://github.com/antvis/X6/releases/tag/%40antv/x6-example-features%402.0.2)

[@antv/x6-react-components@2.0.6](https://www.npmjs.com/package/@antv/x6-react-components/v/2.0.6)
[@antv/x6-react-components@2.0.6](https://github.com/antvis/X6/releases/tag/%40antv/x6-react-components%402.0.6)
2023-01-17 01:56:18 +00:00
90dad14d7e fix: stop propagation when click menu item () 2023-01-17 09:42:30 +08:00
323e01559d chore: update contributors [skip ci] 2023-01-16 15:20:32 +00:00
bfc8d7f17a fix(mindmap demo): can not find target id when create edge () 2023-01-16 23:20:08 +08:00
df24392728 chore: update contributors [skip ci] 2023-01-15 13:21:33 +00:00
fc940fa53c refactor: mindmap demo remove resetCells () 2023-01-15 21:21:12 +08:00
604c848c2a chore(release): release 3 packages [skip ci]
[@antv/x6@2.1.5](https://www.npmjs.com/package/@antv/x6/v/2.1.5)
[@antv/x6@2.1.5](https://github.com/antvis/X6/releases/tag/%40antv/x6%402.1.5)

[@antv/x6-plugin-dnd@2.0.4](https://www.npmjs.com/package/@antv/x6-plugin-dnd/v/2.0.4)
[@antv/x6-plugin-dnd@2.0.4](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-dnd%402.0.4)

[@antv/x6-sites@1.3.2](https://github.com/antvis/X6/releases/tag/%40antv/x6-sites%401.3.2)
2023-01-13 14:20:05 +00:00
7b091f35de fix: change dragging container options () 2023-01-13 22:09:21 +08:00
95c72c3033 chore: update CONTRIBUTORS [skip ci] 2023-01-13 13:13:12 +00:00
0c91218b64 chore: update contributors [skip ci] 2023-01-13 13:06:09 +00:00
61c030a162 docs: fix document formatting ()
docs: fix document formatting
2023-01-13 21:05:46 +08:00
5c5f3e5319 chore: update contributors [skip ci] 2023-01-11 02:13:33 +00:00
06a8f28c2d chore: update contributors [skip ci] 2023-01-10 02:17:09 +00:00
ece198265b chore: update contributors [skip ci] 2023-01-05 14:48:42 +00:00
6abd0683ea fix: update group even group is empty () 2023-01-05 22:48:20 +08:00
fff95806c8 docs: add LEGAL for sites () 2023-01-04 20:41:06 +08:00
a069449782 chore: update badge style 2023-01-04 12:18:58 +08:00
3b25683529 chore(release): release 2 packages [skip ci]
[@antv/x6@2.1.4](https://www.npmjs.com/package/@antv/x6/v/2.1.4)
[@antv/x6@2.1.4](https://github.com/antvis/X6/releases/tag/%40antv/x6%402.1.4)

[@antv/x6-sites@1.3.1](https://github.com/antvis/X6/releases/tag/%40antv/x6-sites%401.3.1)
2023-01-03 14:07:28 +00:00
45337e4a62 fix: optimize rendering logic to prevent loops () 2023-01-03 21:56:57 +08:00
91fc97791b chore(release): release 1 package [skip ci]
[@antv/x6-sites@1.3.0](https://github.com/antvis/X6/releases/tag/%40antv/x6-sites%401.3.0)
2023-01-01 11:58:39 +00:00
cdd0913eee Update license copyright year(s) ()
docs(license): update copyright year(s)

Co-authored-by: github-actions <github-actions@github.com>
2023-01-01 19:48:23 +08:00
a696009ede chore: update contributors [skip ci] 2022-12-27 01:29:01 +00:00
c808ca6d2b chore: update CONTRIBUTORS [skip ci] 2022-12-26 03:30:48 +00:00
d3301d33d5 feat: add data processing dag example ()
chore: stash code

feat: add dataProcessingDagre demo

feat: dataProcessingDagre demo add animate and cell status style

chore: perf code

chore: perf code

chore: perf code

chore: perf code
2022-12-26 03:23:31 +00:00
0029555458 chore: force use pnpm package manager in this project 2022-12-25 16:13:18 +08:00
cc18463c53 chore(release): release 3 packages [skip ci]
[@antv/x6@2.1.3](https://www.npmjs.com/package/@antv/x6/v/2.1.3)
[@antv/x6@2.1.3](https://github.com/antvis/X6/releases/tag/%40antv/x6%402.1.3)

[@antv/x6-plugin-transform@2.1.5](https://www.npmjs.com/package/@antv/x6-plugin-transform/v/2.1.5)
[@antv/x6-plugin-transform@2.1.5](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-transform%402.1.5)

[@antv/x6-sites@1.2.2](https://github.com/antvis/X6/releases/tag/%40antv/x6-sites%401.2.2)
2022-12-24 14:05:12 +00:00
fb8098c1c0 fix: add defense for view in transform plugin () 2022-12-24 21:54:09 +08:00
c250caba6a chore: update CONTRIBUTORS [skip ci] 2022-12-23 12:08:08 +00:00
019333d79d fix: schedule edge when source and target is not ready () 2022-12-23 20:00:15 +08:00
33c2e59207 chore(release): release 1 package [skip ci]
[@antv/x6-vue-shape@2.0.9](https://www.npmjs.com/package/@antv/x6-vue-shape/v/2.0.9)
[@antv/x6-vue-shape@2.0.9](https://github.com/antvis/X6/releases/tag/%40antv/x6-vue-shape%402.0.9)
2022-12-21 04:03:39 +00:00
844ee5fa04 fix: get graph from right place () 2022-12-21 11:52:57 +08:00
96010e3b52 fix: add createView options () 2022-12-20 20:18:59 +08:00
a98e97db11 fix: add getGraph provide () 2022-12-20 20:16:07 +08:00
30c2ed2655 fix: optimize snapToGrid options for manhattan () 2022-12-20 20:15:55 +08:00
3a020d17c3 chore(release): release 1 package [skip ci]
[@antv/x6-common@2.0.4](https://www.npmjs.com/package/@antv/x6-common/v/2.0.4)
[@antv/x6-common@2.0.4](https://github.com/antvis/X6/releases/tag/%40antv/x6-common%402.0.4)
2022-12-20 03:52:49 +00:00
d8e1e637d8 fix: fix window incompatibility problem () 2022-12-20 11:39:53 +08:00
2d04848d52 chore(release): release 1 package [skip ci]
[@antv/x6@2.1.1](https://www.npmjs.com/package/@antv/x6/v/2.1.1)
[@antv/x6@2.1.1](https://github.com/antvis/X6/releases/tag/%40antv/x6%402.1.1)
2022-12-19 14:40:16 +00:00
e2bb71d954 fix: set snapToGrid to false by default () 2022-12-19 22:29:40 +08:00
8b145941ec chore: update contributors [skip ci] 2022-12-19 14:28:26 +00:00
2c7a04a6f4 chore: move file 2022-12-19 22:27:23 +08:00
dfa8c492da chore: update CONTRIBUTORS [skip ci] 2022-12-19 12:57:10 +00:00
3b668feb4e fix: arrowhead not get options bug () 2022-12-19 20:49:55 +08:00
07f4739979 chore(release): release 1 package [skip ci]
[@antv/x6@2.1.0](https://www.npmjs.com/package/@antv/x6/v/2.1.0)
[@antv/x6@2.1.0](https://github.com/antvis/X6/releases/tag/%40antv/x6%402.1.0)
2022-12-19 01:46:51 +00:00
824560ddda feat: add snapToGrid options for manhattan router ()
* docs: update github url

* fix: debounce update to improve performance

* feat: add snapToGrid options for manhattan router
2022-12-19 09:36:17 +08:00
9e37ea9f78 fix: debounce update to improve performance ()
* docs: update github url

* fix: debounce update to improve performance
2022-12-18 21:44:03 +08:00
610349d924 chore(release): release 3 packages [skip ci]
[@antv/x6@2.0.9](https://www.npmjs.com/package/@antv/x6/v/2.0.9)
[@antv/x6@2.0.9](https://github.com/antvis/X6/releases/tag/%40antv/x6%402.0.9)

[@antv/x6-example-features@2.0.1](https://github.com/antvis/X6/releases/tag/%40antv/x6-example-features%402.0.1)

[@antv/x6-sites@1.2.0](https://github.com/antvis/X6/releases/tag/%40antv/x6-sites%401.2.0)
2022-12-16 10:44:52 +00:00
2f92e33d0e fix: remove useless repo url 2022-12-16 18:33:03 +08:00
df540d9b79 chore: rename dir 2022-12-16 18:19:58 +08:00
3bc37971f8 chore: update deprecated terser plugin
Co-authored-by: NewByVector <vectorse@126.com>
2022-12-16 18:07:58 +08:00
50284c2d51 chore: update contributors [skip ci] 2022-12-16 08:44:49 +00:00
15284e778a fix: 🐛 char ghosting when edit text () ()
* fix: 🐛 char ghosting when edit text ()

* fix: 🐛 grammar style improvement
2022-12-16 16:44:28 +08:00
1a0e8cf969 docs: fix broken CI status badge 2022-12-16 15:44:05 +08:00
1089109b08 chore: update build:watch script () 2022-12-12 21:26:40 +08:00
faf294a5ec chore: only support react18 in 2.1.x () 2022-12-12 21:21:41 +08:00
25461fd985 docs: update vue demo ()
* chore: refactor x6-site

* docs: update vue demo
2022-12-12 16:38:16 +08:00
35f2966219 chore: refactor x6-site ()
* chore: refactor x6-site

* chore: fix ts lint and style lint error
2022-12-12 16:21:09 +08:00
26df790b8c chore: remove sites files () 2022-12-12 10:25:03 +08:00
bc7efe8db9 chore: update package version () 2022-12-11 20:15:16 +08:00
abeb009d0a fix: cancel debounce update for scroller plugin () 2022-12-11 17:44:13 +08:00
ad08cf87ef chore: update contributors [skip ci] 2022-12-10 01:29:38 +00:00
16c2ef35e0 chore(release): release 1 package [skip ci]
[@antv/x6-vue-shape@2.0.7](https://www.npmjs.com/package/@antv/x6-vue-shape/v/2.0.7)
[@antv/x6-vue-shape@2.0.7](https://github.com/antvis/X6/releases/tag/%40antv/x6-vue-shape%402.0.7)
2022-12-09 07:37:48 +00:00
187e318aee fix: cannot read properties of undefined when unmount vue component ()
* fix: cannot read properties of undefined when unmount vue component

* fix: cannot read properties of undefined when unmount vue component
2022-12-09 15:26:57 +08:00
f07abff980 chore(release): release 1 package [skip ci]
[@antv/x6@2.0.8](https://www.npmjs.com/package/@antv/x6/v/2.0.8)
[@antv/x6@2.0.8](https://github.com/antvis/X6/releases/tag/%40antv/x6%402.0.8)
2022-12-08 01:44:43 +00:00
4a6a634a8a fix: trigger preventDefault by origin event () 2022-12-08 09:35:17 +08:00
627368e0dd chore(release): release 1 package [skip ci]
[@antv/x6-plugin-transform@2.1.4](https://www.npmjs.com/package/@antv/x6-plugin-transform/v/2.1.4)
[@antv/x6-plugin-transform@2.1.4](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-transform%402.1.4)
2022-12-07 09:03:49 +00:00
604c0244cd fix: make resizing options take effect () 2022-12-07 16:53:46 +08:00
80898ada1c chore(release): release 1 package [skip ci]
[@antv/x6@2.0.7](https://www.npmjs.com/package/@antv/x6/v/2.0.7)
[@antv/x6@2.0.7](https://github.com/antvis/X6/releases/tag/%40antv/x6%402.0.7)
2022-12-06 09:38:57 +00:00
057d5209ff fix: hide elems when visible is false () 2022-12-06 17:26:38 +08:00
2070828425 chore: remove ts and style lint error () 2022-12-05 17:20:38 +08:00
502422fe24 Delete .lgtm.yml 2022-12-05 17:06:19 +08:00
8daf0fd62c chore: config codeql 2022-12-05 16:55:39 +08:00
a108b50a66 chore: update contributors [skip ci] 2022-12-03 03:49:59 +00:00
525bac1907 chore: release @antv/x6-plugin-selection@2.1.5 () 2022-12-03 11:49:38 +08:00
34ec3d29ab chore: update CONTRIBUTORS [skip ci] 2022-12-03 03:34:26 +00:00
74fb7b86d7 chore: add eslintcache ()
* chore: add eslintcache

* chore: add eslintcache
2022-12-03 11:27:56 +08:00
1fb2d8308a fix: use geometry in selection box () 2022-12-02 17:49:13 +08:00
b2b8ac578c chore: update CONTRIBUTORS [skip ci] 2022-12-02 08:51:57 +00:00
1b03004ee5 chore: update contributors [skip ci] 2022-12-02 08:44:34 +00:00
53c9eaf626 chore: update wrong comment word ()
Co-authored-by: hehongsheng <hehongsheng@dolinkhub.com>
2022-12-02 16:44:14 +08:00
05d1fe35d6 fix: remove lint error ()
* 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
b05d1596dd chore: update deps 2022-12-01 11:38:15 +08:00
8843212f53 chore: move '--debug' to env variable 'SRM_DEBUG' 2022-12-01 11:38:15 +08:00
f920d5a4ee fix: export toJpeg methods in export plugin () 2022-11-30 10:50:30 +08:00
6a81805075 fix: render react shape in dnd graph () 2022-11-29 21:22:49 +08:00
94f90425f6 fix: support react 17 () 2022-11-29 19:40:46 +08:00
cd85c5bd26 chore(release): release 1 package [skip ci]
[@antv/x6-geometry@2.0.4](https://www.npmjs.com/package/@antv/x6-geometry/v/2.0.4)
[@antv/x6-geometry@2.0.4](https://github.com/antvis/X6/releases/tag/%40antv/x6-geometry%402.0.4)
2022-11-29 09:41:38 +00:00
16b6c89e6b fix: regex for excluding coverage 2022-11-29 17:29:47 +08:00
76be8db8ca docs: update sites url 2022-11-29 17:27:40 +08:00
18c0edf483 chore(release): release 1 package [skip ci]
[@antv/x6-plugin-keyboard@2.1.4](https://www.npmjs.com/package/@antv/x6-plugin-keyboard/v/2.1.4)
[@antv/x6-plugin-keyboard@2.1.4](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-keyboard%402.1.4)
2022-11-29 08:53:51 +00:00
4978110b45 fix: not trigger keyboard event whith delete key in contenteditable elem () 2022-11-29 16:44:32 +08:00
8eb43874a5 Add CodeQL workflow for GitHub code scanning ()
Co-authored-by: LGTM Migrator <lgtm-migrator@users.noreply.github.com>
2022-11-29 15:53:33 +08:00
83d0295596 chore: update readme () 2022-11-29 14:58:10 +08:00
2c40e3d129 chore: hide coverage badge 2022-11-29 10:03:52 +08:00
d903e5a5b6 fix: trigger transform knob after click node () 2022-11-28 20:19:27 +08:00
c350371d3c fix: dom.data support custom object () 2022-11-28 16:10:34 +08:00
9f3ba0f3b4 chore: update contributors [skip ci] 2022-11-28 01:30:11 +00:00
b0555151e9 fix: render vue shape in minimap with same cellid when using teleport ()
* fix: render vue shape in minimap with same cellid when using teleport

* fix: render vue shape in minimap with same cellid when using teleport
2022-11-27 10:42:13 +08:00
1d324df545 chore(release): release 1 package [skip ci]
[@antv/x6-plugin-clipboard@2.1.3](https://www.npmjs.com/package/@antv/x6-plugin-clipboard/v/2.1.3)
[@antv/x6-plugin-clipboard@2.1.3](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-clipboard%402.1.3)
2022-11-25 11:48:13 +00:00
d6df2d5981 fix: broken file 2022-11-25 18:15:46 +08:00
273102322b chore: update package version ()
* chore: update package version

* chore: fix repository url

* chore: enable publish to npm

Co-authored-by: bubkoo <bubkoo.wy@gmail.com>
2022-11-25 18:13:10 +08:00
1dcab69b18 chore(release): release 17 packages [skip ci]
[@antv/x6@2.0.4](https://github.com/antvis/X6/releases/tag/%40antv/x6%402.0.4)

[@antv/x6-common@2.0.1](https://github.com/antvis/X6/releases/tag/%40antv/x6-common%402.0.1)

[@antv/x6-geometry@2.0.3](https://github.com/antvis/X6/releases/tag/%40antv/x6-geometry%402.0.3)

[@antv/x6-plugin-clipboard@2.1.2](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-clipboard%402.1.2)

[@antv/x6-plugin-dnd@2.0.3](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-dnd%402.0.3)

[@antv/x6-plugin-export@2.1.2](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-export%402.1.2)

[@antv/x6-plugin-history@2.1.3](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-history%402.1.3)

[@antv/x6-plugin-keyboard@2.1.3](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-keyboard%402.1.3)

[@antv/x6-plugin-minimap@2.0.3](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-minimap%402.0.3)

[@antv/x6-plugin-scroller@2.0.3](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-scroller%402.0.3)

[@antv/x6-plugin-selection@2.1.4](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-selection%402.1.4)

[@antv/x6-plugin-snapline@2.1.4](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-snapline%402.1.4)

[@antv/x6-plugin-stencil@2.0.3](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-stencil%402.0.3)

[@antv/x6-plugin-transform@2.1.2](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-transform%402.1.2)

[@antv/x6-react-components@2.0.5](https://github.com/antvis/X6/releases/tag/%40antv/x6-react-components%402.0.5)

[@antv/x6-react-shape@2.0.4](https://github.com/antvis/X6/releases/tag/%40antv/x6-react-shape%402.0.4)

[@antv/x6-vue-shape@2.0.4](https://github.com/antvis/X6/releases/tag/%40antv/x6-vue-shape%402.0.4)
2022-11-25 09:50:08 +00:00
cb0cfdeb4d fix: npm version 2022-11-25 17:44:42 +08:00
bdba8cef5c chore(release): release 16 packages [skip ci]
[@antv/x6@2.0.3](https://github.com/antvis/X6/releases/tag/%40antv/x6%402.0.3)

[@antv/x6-geometry@2.0.2](https://github.com/antvis/X6/releases/tag/%40antv/x6-geometry%402.0.2)

[@antv/x6-plugin-clipboard@2.1.1](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-clipboard%402.1.1)

[@antv/x6-plugin-dnd@2.0.2](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-dnd%402.0.2)

[@antv/x6-plugin-export@2.1.1](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-export%402.1.1)

[@antv/x6-plugin-history@2.1.2](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-history%402.1.2)

[@antv/x6-plugin-keyboard@2.1.2](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-keyboard%402.1.2)

[@antv/x6-plugin-minimap@2.0.2](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-minimap%402.0.2)

[@antv/x6-plugin-scroller@2.0.2](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-scroller%402.0.2)

[@antv/x6-plugin-selection@2.1.3](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-selection%402.1.3)

[@antv/x6-plugin-snapline@2.1.3](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-snapline%402.1.3)

[@antv/x6-plugin-stencil@2.0.2](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-stencil%402.0.2)

[@antv/x6-plugin-transform@2.1.1](https://github.com/antvis/X6/releases/tag/%40antv/x6-plugin-transform%402.1.1)

[@antv/x6-react-components@2.0.4](https://github.com/antvis/X6/releases/tag/%40antv/x6-react-components%402.0.4)

[@antv/x6-react-shape@2.0.3](https://github.com/antvis/X6/releases/tag/%40antv/x6-react-shape%402.0.3)

[@antv/x6-vue-shape@2.0.3](https://github.com/antvis/X6/releases/tag/%40antv/x6-vue-shape%402.0.3)
2022-11-25 09:27:28 +00:00
6c4244c747 chore: ignore build 2022-11-25 17:06:13 +08:00
e6a1a71932 chore: disable publish to npm 2022-11-25 17:01:54 +08:00
1678 changed files with 64577 additions and 92552 deletions
.github/workflows
.gitignore.lgtm.yml.prettierignore.stylelintrcCONTRIBUTORSCONTRIBUTORS.svgLICENSEREADME.en-us.mdREADME.md
examples/x6-example-features
karma.conf.jspackage.json
packages
x6-angular-shape
x6-common
x6-geometry
x6-plugin-clipboard
x6-plugin-dnd
x6-plugin-export
x6-plugin-history
x6-plugin-keyboard
x6-plugin-minimap
x6-plugin-scroller
x6-plugin-selection
x6-plugin-snapline
x6-plugin-stencil
x6-plugin-transform
x6-react-components
CHANGELOG.mdLICENSEpackage.json
src
auto-scroll-box/style
color-picker
context-menu/style
dropdown/style
menu/style
menubar
scroll-box/style
scrollbar/style
split-box/style
style
toolbar/style
x6-react-shape
x6-vue-shape
x6
pnpm-lock.yamlpnpm-workspace.yamlrollup.config.js
scripts
sites
x6-sites-demos-helper
x6-sites-demos
CHANGELOG.mdpackage.json
packages
api
graph
registry
attr
background
connection-point/playground
connector
edge-anchor/playground
edge-tool
filter
grid
node-anchor/playground
node-tool
port-label-layout
port-layout
router
ui
performance
scene/sankey
tutorial
basic
edge
events/custom-click
graph
interacting
node
port
serialization
getting-started
intermediate
plugins
x6-sites
.dumi
global.ts
theme/locales
.dumirc.ts.eslintrc.gitignoreCHANGELOG.mdCNAMELEGAL.md
docs
api
temp
tutorial
examples
gatsby-browser.jsgatsby-config.jsgatsby-node.jspackage.json
public
site
src
tutorial
basic
getting-started
intermediate
plugins
typings
tsconfig.json

42
.github/workflows/codeql.yml vendored Normal file

@ -0,0 +1,42 @@
name:  CodeQL
on:
push:
branches: [ "master", "bot", "gh-pages", "v1" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: "41 2 * * 1"
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ javascript ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config-file: ./.github/workflows/config/codeql.yml
queries: +security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ matrix.language }}"

7
.github/workflows/config/codeql.yml vendored Normal file

@ -0,0 +1,7 @@
paths-ignore:
- sites/public
query-filters:
- exclude:
id: js/use-before-declaration
- exclude:
id: js/polynomial-redos

@ -15,7 +15,8 @@ jobs:
steps:
- name:  Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- name: 🎉 Setup nodejs
uses: actions/setup-node@v3
with:
@ -57,8 +58,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 }}

@ -20,9 +20,7 @@ jobs:
👋 @{{ author }}
Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.
To help make it easier for us to investigate your issue, please follow the [contributing guidelines](https://github.com/antvis/X6/blob/master/CONTRIBUTING.md).
We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
FIRST_PR: |

2
.gitignore vendored

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

@ -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"

@ -12,5 +12,5 @@ es/
lib/
dist/
coverage/
sites/x6-sites/static/demos
sites/public
csstype.ts

@ -15,6 +15,11 @@
"no-invalid-double-slash-comments": null,
"no-descending-specificity": null,
"declaration-empty-line-before": null,
"no-duplicate-selectors": null
"no-duplicate-selectors": null,
"value-no-vendor-prefix": null,
"selector-pseudo-class-no-unknown": null,
"selector-class-pattern": null,
"keyframes-name-pattern": null,
"number-max-precision": null
}
}

@ -1,21 +1,24 @@
BARM <284942955@qq.com>
Candy <563378816@qq.com>
Chaoqi <HAN>
Clifford <ajard>
Chaoqi ZHANG <prncoprs@163.com>
Clifford Fajardo <cliffordfajardo@users.noreply.github.com>
DaiGang <42136433+daigang666@users.noreply.github.com>
Dong <48054715+halodong@users.noreply.github.com>
Draco <Draco.coder@gmail.com>
Eve-Sama <17764594863@163.com>
Eve-Sama <948832626@qq.com>
Gossypol <31892817+gossypol@users.noreply.github.com>
HQidea <HQidea@users.noreply.github.com>
ImgBotApp <ImgBotHelp@gmail.com>
Indomi <indomi126@gmail.com>
James <san>
Jógvan <lse>
Ken <ei>
James Tsang <wtzeng1@gmail.com>
Jógvan Olsen <jogvanolsen@hotmail.com>
Ken Geis <geis.ken@gmail.com>
Kent Wood <minzojian@hotmail.com>
Ko.Rei <32183014+Ko-Rei@users.noreply.github.com>
Limbo <49612796+JUST-Limbo@users.noreply.github.com>
Lixu <37231473+wflixu@users.noreply.github.com>
Lloyd <ho>
Lloyd Zhou <lloydzhou@users.noreply.github.com>
Lyn <47809781+lyn-boyu@users.noreply.github.com>
MOMO <329053928@qq.com>
Mingfei <az8641683@163.com>
@ -25,16 +28,22 @@ NewByVector <NewByVector@users.noreply.github.com>
Olive.Wang <olivewind.wang@gmail.com>
Opportunity <opportunity@live.in>
Questions <chip@twostewards.com>
RuiLin <on>
RuiLin Dong <48054715+halodong@users.noreply.github.com>
SSC <273702440@qq.com>
Samuel Bodin <1637651+bodinsamuel@users.noreply.github.com>
Simon He <57086651+Simon-He95@users.noreply.github.com>
Sindori <441933726@qq.com>
Struggle <1178825961@qq.com>
Struggle Roue <47975400+struggleRoue@users.noreply.github.com>
Susan <527971893@qq.com>
Thomas <eugne>
Tony <>
Thomas Zeugner <tomsoftware@gmx.de>
Tony Wu <93302820+tonywu6@users.noreply.github.com>
Utopia <greatauk11@gmail.com>
XLZY <1017866168@qq.com>
Xingjian <han>
Zhenyu <o>
Xia Wenqi <xiawenqi90@gmail.com>
Xingjian Zhang <44231913+THUzxj@users.noreply.github.com>
Zhenyu Hou <skyking_H@hotmail.com>
_XiaoTian <istianlei@qq.com>
arthur657834 <kingkom7834@126.com>
boyu.zlj <boyu.zlj@antgroup.com>
breezefaith <nyzhangzc@qq.com>
@ -50,6 +59,8 @@ kelin.zrh <34393362+AricZhu@users.noreply.github.com>
kingshuaishuai <ken.wang@mrs.ai>
kio <1421104933@qq.com>
lijing666 <lijing241@yeah.net>
linkun <33945539+linkun-wang@users.noreply.github.com>
linkun <linkun0922@163.com>
lopn <lopnxrp@126.com>
luchunwei <luchunwei@gmail.com>
luzhuang <364439895@qq.com>
@ -58,17 +69,21 @@ myzxlin <myzxlin@163.com>
newbyvector <vectorse@126.com>
niexq <1879633916@qq.com>
niexq <niexq@firstgrid.cn>
njshuisheng <34205271+njshuisheng@users.noreply.github.com>
nobugforever <84232410+mengYu-Jin@users.noreply.github.com>
pengxingjian.pxj <pengxingjian.pxj@alibaba-inc.com>
pfdgithub <pfdgithub@users.noreply.github.com>
qingchi <qinky94@163.com>
qu <33251372+Qujh97@users.noreply.github.com>
sallen450 <qinghua10199@gmail.com>
semantic-release-bot <semantic-release-bot@martynus.net>
siaikin <abc1310054026@outlook.com>
vector <vectorse@126.com>
wenbei <38773084+wb-wenbei@users.noreply.github.com>
wgf <34190465+evelope@users.noreply.github.com>
wind <>
wind X <35559153+XueMeijing@users.noreply.github.com>
wjqsummer <52412389+wjqsummer@users.noreply.github.com>
wseven7677 <caoyu_92@126.com>
wtzeng1 <wtzeng1@gmail.com>
x6-bot <x6-bot@users.noreply.github.com>
xrkffgg <xrkffgg@gmail.com>
@ -77,10 +92,12 @@ zdc1111 <39116292+zdc1111@users.noreply.github.com>
€alix <qq287649920@gmail.com>
九思⚡⚡⚡ <2228429150@qq.com>
何腾飞 <avrin.live.cn@outlook.com>
依枫 <deng25st@163.com>
偏右 <afc163@gmail.com>
小耀 <jinyue.gjy@antfin.com>
崖 <bubkoo.wy@gmail.com>
崖崖崖 <bubkoo.wy@gmail.com>
张子睿 <411489774@qq.com>
文瑀 <wenyu.jqq@antfin.com>
映月 <38279397+orientMoon@users.noreply.github.com>
杨凌 <89915256@qq.com>

File diff suppressed because one or more lines are too long

Before

(image error) Size: 11 MiB

After

(image error) Size: 14 MiB

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021-2022 Alipay.inc
Copyright (c) 2021-2023 Alipay.inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

@ -17,7 +17,7 @@
<a href="/LICENSE"><img src="https://img.shields.io/github/license/antvis/x6?style=flat-square" alt="MIT License"></a>
<a href="https://www.typescriptlang.org"><img alt="Language" src="https://img.shields.io/badge/language-TypeScript-blue.svg?style=flat-square"></a>
<a href="https://github.com/antvis/x6/pulls"><img alt="PRs Welcome" src="https://img.shields.io/badge/PRs-Welcome-brightgreen.svg?style=flat-square"></a>
<a href="https://x6.antv.vision"><img alt="website" src="https://img.shields.io/static/v1?label=&labelColor=505050&message=website&color=0076D6&style=flat-square&logo=google-chrome&logoColor=0076D6"></a>
<a href="https://x6.antv.antgroup.com/"><img alt="website" src="https://img.shields.io/static/v1?label=&labelColor=505050&message=website&color=0076D6&style=flat-square&logo=google-chrome&logoColor=0076D6"></a>
</p>
## Features
@ -84,12 +84,13 @@ graph.addEdge({
## Links
- [Documents](https://x6.antv.vision/zh/docs/tutorial/about)
- [Samples](https://x6.antv.vision/zh/examples/gallery)
- [Documents](https://x6.antv.antgroup.com/tutorial/about)
- [Samples](https://x6.antv.antgroup.com/examples)
- [Blog](https://www.yuque.com/antv/x6/gcinvi)
- [Versioning Release Note](https://www.yuque.com/antv/x6/bbfu6r)
- [FAQ](https://www.yuque.com/antv/x6/be9pfx)
- [CodeSanbox Template](https://codesandbox.io/s/qosj0?file=/src/app.tsx)
- [awesome-x6](https://github.com/lloydzhou/awesome-x6)
## Development

@ -6,18 +6,17 @@
<p align="center"><strong>提供简单易用的节点定制能力和开箱即用的交互组件方便我们快速搭建流程图、DAG 图、ER 图等图应用</strong></p>
<p align="center">
<a href="https://github.com/antvis/X6/actions/workflows/ci.yml"><img alt="build" src="https://img.shields.io/github/workflow/status/antvis/x6/%F0%9F%91%B7%E3%80%80CI/master?logo=github&style=flat-square"></a>
<a href="https://app.codecov.io/gh/antvis/X6"><img alt="coverage" src="https://img.shields.io/codecov/c/gh/antvis/x6?logo=codecov&style=flat-square&token=15CO54WYUV"></a>
<a href="https://lgtm.com/projects/g/antvis/x6/context:javascript"><img alt="Language grade: JavaScript" src="https://img.shields.io/lgtm/grade/javascript/g/antvis/x6.svg?logo=lgtm&style=flat-square"></a>
<a href="https://www.npmjs.com/package/@antv/x6"><img alt="NPM Package" src="https://img.shields.io/npm/v/@antv/x6.svg?style=flat-square"></a>
<a href="https://www.npmjs.com/package/@antv/x6"><img alt="NPM Downloads" src="https://img.shields.io/npm/dm/@antv/x6?logo=npm&style=flat-square"></a>
<a href="https://github.com/antvis/X6/actions/workflows/ci.yml"><img alt="build" src="https://img.shields.io/github/actions/workflow/status/antvis/x6/ci.yml?branch=master&style=for-the-badge&logo=github"></a>
<!-- <a href="https://app.codecov.io/gh/antvis/X6"><img alt="coverage" src="https://img.shields.io/codecov/c/gh/antvis/x6?logo=codecov&style=for-the-badge&token=15CO54WYUV"></a> -->
<a href="https://www.npmjs.com/package/@antv/x6"><img alt="NPM Package" src="https://img.shields.io/npm/v/@antv/x6.svg?logo=npm&style=for-the-badge"></a>
<a href="https://www.npmjs.com/package/@antv/x6"><img alt="NPM Downloads" src="https://img.shields.io/npm/dm/@antv/x6?logo=npm&style=for-the-badge"></a>
</p>
<p align="center">
<a href="/LICENSE"><img src="https://img.shields.io/github/license/antvis/x6?style=flat-square" alt="MIT License"></a>
<a href="https://www.typescriptlang.org"><img alt="Language" src="https://img.shields.io/badge/language-TypeScript-blue.svg?style=flat-square"></a>
<a href="https://github.com/antvis/x6/pulls"><img alt="PRs Welcome" src="https://img.shields.io/badge/PRs-Welcome-brightgreen.svg?style=flat-square"></a>
<a href="https://x6.antv.vision"><img alt="website" src="https://img.shields.io/static/v1?label=&labelColor=505050&message=website&color=0076D6&style=flat-square&logo=google-chrome&logoColor=0076D6"></a>
<a href="/LICENSE"><img src="https://img.shields.io/github/license/antvis/x6?style=for-the-badge" alt="MIT License"></a>
<a href="https://www.typescriptlang.org"><img alt="Language" src="https://img.shields.io/badge/language-TypeScript-blue.svg?style=for-the-badge"></a>
<a href="https://github.com/antvis/x6/pulls"><img alt="PRs Welcome" src="https://img.shields.io/badge/PRs-Welcome-brightgreen.svg?style=for-the-badge"></a>
<a href="https://x6.antv.antgroup.com"><img alt="website" src="https://img.shields.io/static/v1?label=&labelColor=505050&message=website&color=0076D6&style=for-the-badge&logo=google-chrome&logoColor=f5f5f5"></a>
</p>
## 特性
@ -29,12 +28,12 @@
## 兼容环境
- 现代浏览器和 IE11需要 polyfills
- 现代浏览器
- 支持服务端渲染。
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Safari |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| IE11, Edge | last 2 versions | last 2 versions | last 2 versions |
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Safari |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| last 2 versions | last 2 versions | last 2 versions |
## 安装
@ -84,12 +83,13 @@ graph.addEdge({
## 链接
- [文档](https://x6.antv.vision/zh/docs/tutorial/about)
- [示例](https://x6.antv.vision/zh/examples/gallery)
- [博客](https://www.yuque.com/antv/x6/gcinvi)
- [文档](http://x6.antv.antgroup.com/tutorial/about)
- [示例](http://x6.antv.antgroup.com/examples)
- [博客](https://www.yuque.com/antv/x6/huhla47wqalq5n7r)
- [更新日志](https://www.yuque.com/antv/x6/bbfu6r)
- [常见问题](https://www.yuque.com/antv/x6/be9pfx)
- [CodeSanbox 模板](https://codesandbox.io/s/qosj0?file=/src/app.tsx)
- [常见问题](https://www.yuque.com/antv/x6/tox1ukbz5cw57qfy)
- [CodeSanbox 模板](https://codesandbox.io/s/mo-ban-wchooy?file=/src/App.tsx)
- [awesome-x6](https://github.com/lloydzhou/awesome-x6)
## 本地开发

@ -1,3 +1,31 @@
## @antv/x6-example-features [2.1.1](https://github.com/antvis/X6/compare/@antv/x6-example-features@2.1.0...@antv/x6-example-features@2.1.1) (2023-02-18)
### Bug Fixes
* mindmap demo duplicate node id, close [#3256](https://github.com/antvis/X6/issues/3256) ([#3257](https://github.com/antvis/X6/issues/3257)) ([c510756](https://github.com/antvis/X6/commit/c510756fe4e96c8e7471c2fb558e6019ec69b057))
# @antv/x6-example-features [2.1.0](https://github.com/antvis/X6/compare/@antv/x6-example-features@2.0.3...@antv/x6-example-features@2.1.0) (2023-02-17)
### Features
* history add max stack size ([#3253](https://github.com/antvis/X6/issues/3253)) ([fba5310](https://github.com/antvis/X6/commit/fba531064ad8027c451a81b60d5efd7f7314a0fa))
## @antv/x6-example-features [2.0.2](https://github.com/antvis/X6/compare/@antv/x6-example-features@2.0.1...@antv/x6-example-features@2.0.2) (2023-01-17)
### Bug Fixes
* **mindmap demo:** can not find target id when create edge ([#3144](https://github.com/antvis/X6/issues/3144)) ([bfc8d7f](https://github.com/antvis/X6/commit/bfc8d7f17ac900f70b696c1fa7a3f3f3a389103f))
## @antv/x6-example-features [2.0.1](https://github.com/antvis/X6/compare/@antv/x6-example-features@2.0.0...@antv/x6-example-features@2.0.1) (2022-12-16)
### Bug Fixes
* make resizing options take effect ([#3014](https://github.com/antvis/X6/issues/3014)) ([604c024](https://github.com/antvis/X6/commit/604c0244cd71ec8e911754dfe524f12c04e4e9ad))
# @antv/x6-example-features [2.0.0](https://github.com/antvis/X6/compare/@antv/x6-example-features@1.1.2...@antv/x6-example-features@2.0.0) (2022-11-24)

@ -1,17 +1,18 @@
{
"private": true,
"name": "@antv/x6-example-features",
"version": "2.0.0",
"version": "2.1.1",
"scripts": {
"start": "umi dev",
"build": "umi build",
"lint": "eslint 'src/**/*.{js,ts}?(x)' --fix",
"precommit": "lint-staged"
"lint": "eslint 'src/**/*.{js,ts}?(x)' --fix"
},
"dependencies": {
"@antv/hierarchy": "^0.6.8",
"@antv/x6": "^2.x",
"@antv/x6-plugin-clipboard": "^2.x",
"@antv/x6-plugin-dnd": "^2.x",
"@antv/x6-plugin-export": "^2.x",
"@antv/x6-plugin-history": "^2.x",
"@antv/x6-plugin-keyboard": "^2.x",
"@antv/x6-plugin-minimap": "^2.x",
@ -20,42 +21,34 @@
"@antv/x6-plugin-snapline": "^2.x",
"@antv/x6-plugin-stencil": "^2.x",
"@antv/x6-plugin-transform": "^2.x",
"@antv/x6-plugin-export": "^2.x",
"@antv/x6-react-components": "^2.x",
"@antv/x6-react-shape": "^2.x",
"antd": "^4.4.2",
"classnames": "^2.2.6",
"dagre": "^0.8.5",
"elkjs": "^0.7.1",
"elkjs": "^0.8.2",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-helmet": "^6.0.0",
"@antv/hierarchy": "^0.6.8"
"react-helmet": "^6.0.0"
},
"devDependencies": {
"@ant-design/icons": "^4.2.2",
"@types/jest": "^25.2.1",
"@types/jest": "^29.2.4",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@types/react-helmet": "^6.0.0",
"@types/react-test-renderer": "^16.0.3",
"eslint": "^7.16.0",
"@types/react-test-renderer": "^18.0.0",
"babel-plugin-import": "^1.13.5",
"eslint": "^8.29.0",
"eslint-config-umi": "^1.4.0",
"eslint-plugin-flowtype": "^4.7.0",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.11.1",
"lint-staged": "^10.5.3",
"react-test-renderer": "^16.7.0",
"umi": "^2.9.0",
"umi-plugin-react": "^1.8.0",
"umi-types": "^0.3.0",
"babel-plugin-import": "^1.13.5"
},
"lint-staged": {
"src/**/*.ts": [
"eslint --fix"
]
"umi-types": "^0.3.0"
},
"engines": {
"node": ">=8.0.0"

@ -7,17 +7,17 @@
.nav {
position: absolute;
z-index: 101;
top: 0;
bottom: 0;
left: 0;
font-size: 13px;
overflow-x: hidden;
overflow-y: auto;
z-index: 101;
box-sizing: border-box;
width: 220px;
padding: 0 16px;
overflow-x: hidden;
overflow-y: auto;
font-size: 13px;
border-right: 1px solid #e9e9e9;
box-sizing: border-box;
ul {
padding-left: 16px;
@ -29,11 +29,11 @@
}
.content {
flex-grow: 1;
box-sizing: border-box;
margin-left: 220px;
padding: 34px;
overflow-x: hidden;
overflow-y: auto;
flex-grow: 1;
margin-left: 220px;
background: #ffffff;
padding: 34px;
background: #fff;
}

@ -8,13 +8,15 @@
border: 1px solid #c2c8d5;
border-left: 4px solid #1890ff;
border-radius: 4px;
box-shadow: 0 2px 5px 1px rgba(0, 0, 0, 0.06);
box-shadow: 0 2px 5px 1px rgb(0 0 0 / 6%);
img {
flex-shrink: 0;
width: 20px;
height: 20px;
flex-shrink: 0;
margin-left: 8px;
}
.label {
display: inline-block;
flex-shrink: 0;
@ -23,15 +25,19 @@
color: #666;
font-size: 12px;
}
.status {
flex-shrink: 0;
}
&.success {
border-left: 4px solid #52c41a;
}
&.failed {
border-left: 4px solid #ff4d4f;
}
&.running .status img {
animation: spin 1s linear infinite;
}
@ -43,11 +49,13 @@
border-radius: 2px;
box-shadow: 0 0 0 4px #d4e8fe;
}
.node.success {
border-color: #52c41a;
border-radius: 2px;
box-shadow: 0 0 0 4px #ccecc0;
}
.node.failed {
border-color: #ff4d4f;
border-radius: 2px;
@ -80,6 +88,7 @@
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}

@ -4,6 +4,7 @@
visibility: hidden;
cursor: pointer;
}
&:hover image {
visibility: visible;
}

@ -212,12 +212,15 @@ export default class Example extends React.Component {
return 'right'
},
})
const cells: Cell[] = []
const traverse = (hierarchyItem: HierarchyResult) => {
if (hierarchyItem) {
const { data, children } = hierarchyItem
cells.push(
graph.createNode({
// 检查当前遍历的节点已经存在还是需要新添加?
if (graph.hasCell(data.id)) {
const node = graph.getCellById(data.id)
node.prop('position', { x: hierarchyItem.x, y: hierarchyItem.y })
} else {
const node = graph.addNode({
id: data.id,
shape: data.type === 'topic-child' ? 'topic-child' : 'topic',
x: hierarchyItem.x,
@ -226,13 +229,18 @@ export default class Example extends React.Component {
height: data.height,
label: data.label,
type: data.type,
}),
)
})
}
if (children) {
children.forEach((item: HierarchyResult) => {
const { id, data } = item
cells.push(
graph.createEdge({
// 先遍历子节点里面包含创建逻辑如果画布没有开启async的时候创建边会提示找不到target节点
traverse(item)
const eid = `${hierarchyItem.id}-->${id}`
// 检查当前边是否已经存在
if (!graph.hasCell(eid)) {
graph.addEdge({
id: eid,
shape: 'mindmap-edge',
source: {
cell: hierarchyItem.id,
@ -257,15 +265,13 @@ export default class Example extends React.Component {
name: 'left',
},
},
}),
)
traverse(item)
})
}
})
}
}
}
traverse(result)
graph.resetCells(cells)
graph.centerContent()
}
@ -303,9 +309,14 @@ export default class Example extends React.Component {
if (dataItem) {
let item: MindMapData | null = null
const length = dataItem.children ? dataItem.children.length : 0
let nid = `${id}-${length + 1}`
if (graph.hasCell(nid)) {
// 如果通过length + 1拼接出来的节点id在画布中存在了就在id后面加上随机数
nid = nid + Math.random()
}
if (type === 'topic') {
item = {
id: `${id}-${length + 1}`,
id: nid,
type: 'topic-branch',
label: `分支主题${length + 1}`,
width: 100,
@ -313,7 +324,7 @@ export default class Example extends React.Component {
}
} else if (type === 'topic-branch') {
item = {
id: `${id}-${length + 1}`,
id: nid,
type: 'topic-child',
label: `子主题${length + 1}`,
width: 60,
@ -334,10 +345,16 @@ export default class Example extends React.Component {
const removeNode = (id: string) => {
const res = findItem(data, id)
const dataItem = res?.parent
if (dataItem && dataItem.children) {
const { children } = dataItem
const parentItem = res?.parent
const nodeItem = res?.node
if (parentItem && parentItem.children) {
const { children } = parentItem
const index = children.findIndex((item) => item.id === id)
// 删除的时候先删节点以及可能存在的子节点再调用render对data数据进行遍历
if (nodeItem && nodeItem.children) {
nodeItem.children.forEach((item) => graph.removeCell(item.id))
}
graph.removeCell(id)
return children.splice(index, 1)
}
return null

@ -2,24 +2,25 @@
position: relative;
}
.validating:after {
.validating::after {
position: absolute;
top: 4px;
left: 4px;
content: ' ';
display: block;
width: 50px;
height: 50px;
border-radius: 50%;
border: 6px solid #873bf4;
border-color: #873bf4 transparent #873bf4 transparent;
border-color: #873bf4 transparent;
border-radius: 50%;
animation: lds-dual-ring 1.2s linear infinite;
content: ' ';
}
@keyframes lds-dual-ring {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}

@ -2,14 +2,14 @@
.x6-example-wrap {
width: 100%;
height: 100%;
background-color: #ffffff;
background-color: #fff;
.left-side {
position: fixed;
width: 336px;
left: 24px;
top: 0px;
top: 0;
bottom: 0;
left: 24px;
width: 336px;
padding: 0 8px;
overflow-x: visible;
overflow-y: auto;
@ -17,18 +17,18 @@
.right-side {
position: fixed;
top: 0;
right: 24px;
bottom: 0;
width: 336px;
padding: 0 8px;
top: 0px;
bottom: 0;
overflow-x: visible;
overflow-y: auto;
}
.ant-card {
box-shadow: 0 0 10px 1px #e9e9e9;
margin-top: 24px;
box-shadow: 0 0 10px 1px #e9e9e9;
}
.ant-row-flex {
@ -36,14 +36,14 @@
}
.slider-value {
background: #eee;
color: #333333;
padding: 3px 7px;
border-radius: 10px;
display: inline-block;
font-size: 12px;
margin-left: 8px;
padding: 3px 7px;
color: #333;
font-size: 12px;
line-height: 1.25;
background: #eee;
border-radius: 10px;
}
.x6-graph {
@ -52,15 +52,15 @@
.x6-node {
path {
fill: #6a6c8a;
stroke-width: 0px;
transition: fill 0.1s;
fill: #6a6c8a;
stroke-width: 0;
}
text {
fill: #fff;
font-size: 12px;
font-weight: lighter;
font-size: 12px;
fill: #fff;
}
&:hover path {
@ -80,37 +80,37 @@
}
.bbox {
transition-duration: 0.5s;
transition-property: stroke-opacity;
pointer-events: none;
fill: none;
stroke: #16a085;
stroke-width: 2;
stroke-opacity: 0;
fill: none;
transition-property: stroke-opacity;
transition-duration: 0.5s;
pointer-events: none;
}
.axis {
pointer-events: none;
stroke: #95a5a6;
stroke-dasharray: 2, 4;
stroke-width: 1;
pointer-events: none;
}
.padding {
transition-duration: 1s;
transition-property: stroke-opacity;
pointer-events: none;
stroke: #1abc9c;
stroke-opacity: 0;
transition-property: stroke-opacity;
transition-duration: 1s;
pointer-events: none;
}
.grid {
transition-duration: 1s;
transition-property: stroke-opacity;
pointer-events: none;
stroke: #16a085;
stroke-width: 0.5;
stroke-opacity: 0;
transition-property: stroke-opacity;
transition-duration: 1s;
pointer-events: none;
}
.active {

@ -0,0 +1,104 @@
import React from 'react'
import { Graph } from '@antv/x6'
import { Keyboard } from '@antv/x6-plugin-keyboard'
import { Selection } from '@antv/x6-plugin-selection'
import { History } from '@antv/x6-plugin-history'
import '../index.less'
export default class Example extends React.Component<
{},
{ graph: Graph | undefined }
> {
private container: HTMLDivElement
componentDidMount() {
const graph = new Graph({
container: this.container,
width: 800,
height: 600,
grid: true,
})
this.setState({ graph })
const selection = new Selection({ enabled: true })
const keyboard = new Keyboard({ enabled: true })
const history = new History({ enabled: true, stackSize: 5 })
graph.use(selection)
graph.use(keyboard)
graph.use(history)
graph.addNode({
x: 50,
y: 50,
width: 100,
height: 40,
attrs: { label: { text: 'A' } },
})
graph.addNode({
x: 250,
y: 50,
width: 100,
height: 40,
attrs: { label: { text: 'B' } },
})
graph.addNode({
x: 350,
y: 150,
width: 100,
height: 40,
attrs: { label: { text: 'C' } },
})
keyboard.bindKey('backspace', () => {
graph.removeCells(selection.getSelectedCells())
})
keyboard.bindKey('command+z', () => {
this.undo()
})
keyboard.bindKey('command+shift+z', () => {
this.redo()
})
}
refContainer = (container: HTMLDivElement) => {
this.container = container
}
enablePlugins = () => {
const { graph } = this.state
graph?.enablePlugins('keyboard')
}
disablePlugins = () => {
const { graph } = this.state
graph?.disablePlugins('keyboard')
}
undo = () => {
const { graph } = this.state
const history = graph?.getPlugin('history') as History
history?.undo()
}
redo = () => {
const { graph } = this.state
const history = graph?.getPlugin('history') as History
history?.redo()
}
render() {
return (
<div className="x6-graph-wrap">
<div ref={this.refContainer} className="x6-graph" />
<button onClick={this.enablePlugins}>enable</button>
<button onClick={this.disablePlugins}>disable</button>
<button onClick={this.undo}>undo</button>
<button onClick={this.redo}>redo</button>
</div>
)
}
}

@ -1,9 +1,9 @@
.custom-html {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
color: #000;
font-size: 16px;
border: 1px solid #000;

@ -1,27 +1,27 @@
.x6-graph-wrap {
width: 100%;
height: 100%;
background-color: #ffffff;
overflow: auto;
padding: 32px 0;
overflow: auto;
background-color: #fff;
> h1 {
display: block;
width: 800px;
margin: 0 auto 32px auto;
margin: 0 auto 32px;
}
}
.x6-graph-tools {
width: 800px;
margin: 0 auto 32px auto;
margin: 0 auto 32px;
}
.x6-graph {
width: 100%;
height: 100%;
box-shadow: 0 0 10px 1px #e9e9e9;
margin: 0 auto;
box-shadow: 0 0 10px 1px #e9e9e9;
}
.x6-node-selected {

@ -179,6 +179,10 @@ const dataSource = [
example: 'animation/transition',
description: '动画',
},
{
example: 'history',
description: '时光回溯',
},
].map((item, index) => ({ key: index, ...item }))
const columns = [

@ -4,7 +4,10 @@ import { Keyboard } from '@antv/x6-plugin-keyboard'
import { Selection } from '@antv/x6-plugin-selection'
import '../index.less'
export default class Example extends React.Component {
export default class Example extends React.Component<
{},
{ graph: Graph | undefined }
> {
private container: HTMLDivElement
componentDidMount() {
@ -15,6 +18,8 @@ export default class Example extends React.Component {
grid: true,
})
this.setState({ graph })
const selection = new Selection({ enabled: true })
const keyboard = new Keyboard({ enabled: true })
graph.use(selection)
@ -53,10 +58,22 @@ export default class Example extends React.Component {
this.container = container
}
enablePlugins = () => {
const { graph } = this.state
graph.enablePlugins('keyboard')
}
disablePlugins = () => {
const { graph } = this.state
graph.disablePlugins('keyboard')
}
render() {
return (
<div className="x6-graph-wrap">
<div ref={this.refContainer} className="x6-graph" />
<button onClick={this.enablePlugins}>enable</button>
<button onClick={this.disablePlugins}>disable</button>
</div>
)
}

@ -1,10 +1,10 @@
.react-algo-node {
display: flex;
align-items: center;
width: 100%;
height: 100%;
border: 1px solid #5f95ff;
border-radius: 14px;
display: flex;
align-items: center;
img {
width: 24px;
@ -13,8 +13,8 @@
span {
margin-left: 4px;
font-size: 12px;
color: #000000a6;
font-size: 12px;
}
&.dark {

@ -2,20 +2,20 @@
.my-port {
width: 100%;
height: 100%;
background: #eee;
border: 1px solid #808080;
border-radius: 100%;
background: #eee;
&.connected {
width: 0;
height: 0;
margin-top: 5px;
margin-left: 1px;
border-width: 5px 4px 0;
border-style: solid;
border-color: #808080 transparent transparent;
border-radius: 0;
background-color: transparent;
border-color: #808080 transparent transparent;
border-style: solid;
border-width: 5px 4px 0;
border-radius: 0;
}
}
@ -30,30 +30,30 @@
}
body > div::before {
content: ' ';
float: left;
box-sizing: border-box;
width: 20px;
height: 20px;
margin-top: -5px;
margin-left: -5px;
background-color: rgb(57 202 116 / 60%);
border-radius: 50%;
background-color: rgba(57, 202, 116, 0.6);
box-sizing: border-box;
content: ' ';
}
body > div::after {
content: ' ';
position: relative;
z-index: 10;
float: left;
clear: both;
box-sizing: border-box;
width: 10px;
height: 10px;
margin-top: -15px;
border-radius: 50%;
background-color: #fff;
border: 1px solid #39ca74;
position: relative;
z-index: 10;
box-sizing: border-box;
border-radius: 50%;
content: ' ';
}
}
@ -65,30 +65,30 @@
}
body > div::before {
content: ' ';
float: left;
box-sizing: border-box;
width: 28px;
height: 28px;
margin-top: -9px;
margin-left: -9px;
background-color: rgb(57 202 116 / 60%);
border-radius: 50%;
background-color: rgba(57, 202, 116, 0.6);
box-sizing: border-box;
content: ' ';
}
body > div::after {
content: ' ';
position: relative;
z-index: 10;
float: left;
clear: both;
box-sizing: border-box;
width: 10px;
height: 10px;
margin-top: -19px;
border-radius: 50%;
background-color: #fff;
border: 1px solid #39ca74;
position: relative;
z-index: 10;
box-sizing: border-box;
border-radius: 50%;
content: ' ';
}
}
}

@ -1,4 +1,4 @@
.x6-graph-scroller {
box-shadow: 0 0 10px 1px #e9e9e9;
margin: 0 auto;
box-shadow: 0 0 10px 1px #e9e9e9;
}

@ -25,7 +25,6 @@ export default class Example extends React.Component {
strict: true,
showNodeSelectionBox: true,
selectCellOnMoved: false,
useCellGeometry: true,
filter(cell) {
return cell !== a
},

@ -1,20 +1,20 @@
.react-table {
width: 100%;
height: 100%;
border: 1px solid #edf2f5;
background-color: #fff;
border-radius: 5px;
overflow: hidden;
background-color: #fff;
border: 1px solid #edf2f5;
border-radius: 5px;
.inner {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
padding: 12px;
border: 1px solid #fff;
background: #edf2f5;
border: 1px solid #fff;
border-radius: 5px;
display: flex;
flex-direction: column;
}
.header {
@ -36,21 +36,21 @@
}
ul {
padding: 0;
margin: 0;
padding: 0;
}
li {
list-style: none;
height: 40px;
line-height: 40px;
padding-left: 16px;
line-height: 40px;
list-style: none;
border: 1px solid transparent;
&:hover {
border: 1px solid #1890ff;
// background: rgba(230,247,255,.92);
z-index: 0;
border: 1px solid #1890ff;
}
}
}
@ -58,8 +58,8 @@
.react-table-port {
width: 100%;
height: 100%;
overflow: hidden;
background: #eee;
border: 1px solid #808080;
border-radius: 100%;
background: #eee;
overflow: hidden;
}

@ -1,41 +1,44 @@
.tools {
width: 800px;
margin: 32px auto;
.ant-input {
margin-bottom: 16px;
}
}
.react-node {
display: flex;
align-items: center;
width: 100%;
height: 100%;
border: 1px solid #5f95ff;
border-radius: 14px;
display: flex;
align-items: center;
img {
width: 24px;
height: 24px;
}
span {
margin-left: 4px;
font-size: 12px;
color: #000000a6;
font-size: 12px;
}
}
.stutterer {
transform: scale(1.5);
height: 310px;
width: 310px;
position: absolute;
left: 0;
right: 0;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 310px;
height: 310px;
margin: auto;
box-shadow: 0 0 10px 10px rgba(0, 0, 0, 0.2);
border-radius: 200px;
box-shadow: 0 0 10px 10px rgb(0 0 0 / 20%);
transform: scale(1.5);
}
.clockHand {
@ -50,12 +53,12 @@
}
.innerLine {
border-radius: 6px;
position: absolute;
height: 149px;
left: 47.5%;
top: 0%;
left: 47.5%;
width: 5%;
height: 149px;
background-color: red;
border-radius: 6px;
transform-origin: bottom center;
}

@ -96,7 +96,7 @@ module.exports = function (config, base, karmaTypescriptConfig) {
},
coverageOptions: {
instrumentation: !isDebug,
exclude: /\.test|spec\.ts$/,
exclude: /\.(test|spec)\.ts$/,
},
reports: {
html: reportsDir,

@ -2,9 +2,9 @@
"name": "x6",
"private": true,
"scripts": {
"preinstall": "node ./scripts/preinstall",
"lint:ts": "eslint '**/src/**/*.{js,ts}?(x)' --fix",
"lint:style": "stylelint '**/src/**/*.less' --syntax less --fix",
"preinstall": "npx only-allow pnpm",
"lint:ts": "eslint '**/src/**/*.{js,ts}?(x)' --cache --fix",
"lint:style": "stylelint '**/src/**/*.less' --customSyntax postcss-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",
@ -15,7 +15,6 @@
"build:dev": "turbo run build:dev --filter=./packages/*",
"build:umd": "turbo run build:umd --filter=./packages/*",
"build:demos": "sh ./scripts/build-demos",
"build:sites": "sh ./scripts/build-sites",
"clean:turbo": "pnpm -r --if-present --parallel --filter=./packages/* run clean:turbo",
"clean:build": "pnpm -r --if-present --parallel --filter=./packages/* run clean",
"clean:modules": "pnpm -r --parallel exec rimraf node_modules && rimraf node_modules",
@ -37,8 +36,8 @@
"build:umd": "pnpm run --if-present build:less && rollup -c ../../rollup.config.js --bundleConfigAsCjs",
"build:dev": "pnpm run --if-present build:less && run-p -s build:cjs build:esm",
"build:watch": "run-s -s build:watch:esm",
"build:watch:esm": "run-s -s 'build:esm -w'",
"build:watch:cjs": "run-s -s 'build:cjs -w'",
"build:watch:esm": "run-s -s 'build:esm -- -w'",
"build:watch:cjs": "run-s -s 'build:cjs -- -w'",
"build": "run-p -s build:dev build:umd",
"prebuild": "run-s -s clean:build",
"test": {
@ -52,7 +51,7 @@
"prettier --write --ignore-unknown"
],
"*.less": [
"stylelint --syntax less --fix"
"stylelint --customSyntax postcss-less --fix"
],
"*.js": [
"prettier --write"
@ -89,40 +88,40 @@
}
},
"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.5",
"@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",
"@rollup/plugin-typescript": "^10.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/jest": "^29.2.4",
"@types/node": "^18.11.15",
"@types/sinon": "^10.0.2",
"@typescript-eslint/eslint-plugin": "^5.44.0",
"@typescript-eslint/parser": "^5.44.0",
"@typescript-eslint/eslint-plugin": "^5.46.1",
"@typescript-eslint/parser": "^5.46.1",
"boxen": "^7.0.0",
"colors": "^1.4.0",
"coveralls": "^3.1.1",
"eslint": "^8.28.0",
"eslint": "^8.29.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jest": "^27.1.6",
"eslint-plugin-jest": "^27.1.7",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^4.0.0",
"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.2",
"fs-extra": "^11.1.0",
"husky": "^8.0.1",
"is-ci": "^3.0.0",
"jasmine-core": "^4.5.0",
@ -131,25 +130,25 @@
"karma-chrome-launcher": "^3.1.0",
"karma-cli": "^2.0.0",
"karma-jasmine": "^5.1.0",
"karma-spec-reporter": "^0.0.34",
"karma-spec-reporter": "^0.0.36",
"karma-typescript": "5.5.3",
"karma-typescript-es6-transform": "5.5.3",
"less": "^4.1.1",
"lodash": "^4.17.21",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.19",
"postcss": "^8.4.20",
"postcss-less": "^6.0.0",
"prettier": "^2.8.0",
"pretty-quick": "^3.1.1",
"rimraf": "^3.0.2",
"rollup": "^3.4.0",
"rollup": "^3.7.4",
"rollup-plugin-auto-external": "^2.0.0",
"rollup-plugin-filesize": "^9.1.1",
"rollup-plugin-postcss": "^4.0.1",
"rollup-plugin-progress": "^1.1.2",
"rollup-plugin-terser": "^7.0.2",
"run-shared-scripts": "^1.1.4",
"run-shared-scripts": "^1.1.5",
"semantic-release": "^19.0.5",
"sinon": "^14.0.1",
"sinon": "^15.0.1",
"stylelint": "^14.15.0",
"stylelint-config-prettier": "^9.0.4",
"stylelint-config-rational-order": "^0.1.2",
@ -161,5 +160,11 @@
"tslib": "^2.4.1",
"turbo": "^1.6.3",
"typescript": "^4.9.3"
},
"devDependencies": {
"@rollup/plugin-terser": "^0.2.0"
},
"engines": {
"pnpm": ">=7"
}
}

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021-2023 Alipay.inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -0,0 +1,136 @@
# @antv/x6-angular-shape
## 渲染节点
我们提供了一个独立的包 `@antv/x6-angular-shape` 以支持将 Angular 的组件/模板作为节点进行渲染。
### Component 渲染
```ts
@Component({
selector: 'app-node',
templateUrl: './node.component.html',
styleUrls: ['./node.component.scss'],
})
export class NodeComponent implements AfterViewInit, OnChanges {
@Input() value: string;
}
```
```ts
import { register } from "@antv/x6-angular-shape";
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent implements AfterViewInit {
ngAfterViewInit(): void {
register({
shape: 'custom-angular-component-node',
width: 120,
height: 20,
content: NodeComponent,
injector: this.injector,
});
this.graph.addNode({
shape: 'custom-angular-component-node',
x: 100,
y: 100,
data: {
// Input 的参数必须放在这里
ngArguments: {
value: '糟糕糟糕 Oh my god',
},
},
});
}
}
```
### TemplateRef 渲染
```html
<ng-template #template let-data="ngArguments">
<section class="template-container">
<span class="value">{{ data.value }}</span>
</section>
</ng-template>
```
```ts
import { register } from "@antv/x6-angular-shape";
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent implements AfterViewInit {
@ViewChild('template') template: TemplateRef<{}>;
ngAfterViewInit(): void {
register({
shape: 'custom-angular-template-node',
width: 120,
height: 20,
content: this.template,
injector: this.injector,
});
this.graph.addNode({
shape: 'custom-angular-template-node',
x: 100,
y: 100,
data: {
ngArguments: {
value: '魔法怎么失灵啦',
},
},
});
}
}
```
## 更新节点
无论是使用 Component 还是 TemplateRef, 都是一样的更新方式.
```ts
node.setData({
ngArguments: {
value: '晚风中闪过 几帧从前啊',
},
});
```
## 有 demo 吗?
有的, 因为X6渲染节点部分与框架是解耦的. 因此 `x6-angular-shape` 包并非是直接在源代码里改的, 而是在一个单独的Angular环境中开发的. 该 demo 还提供了多种节点类型的性能测试, 详情请参考[Eve-Sama/x6-angular-shape](https://github.com/Eve-Sama/x6-angular-shape)、[X6与G6的性能对比, 以及X6多节点类型下的FPS临界点讨论](https://github.com/antvis/X6/issues/3266)
## FAQ
### 为什么输入属性不能直接放在 data 中而需要放在 ngArguments 中? 且为什么不叫 ngInput?
因为并非所有 `node.data` 中的属性都是输入属性, 所以遍历 `data` 中的所有属性进行赋值是不合适的. 至于为什么叫 `ngArguments` 主要是有两点考虑.
- 1.x版本中已经这么用了, 沿用该API可以降低用户升级成本
- `Input` 的概念其实是来自 `Component`, 而 `TemplateRef` 中是 `context`, 在二者的基础上抽象一个 `Arguments` 的概念更通用些
### 2.x版本的 x6-angular-shape 相比较1.x版本有什么新特性吗?
实现思路其实和之前是差不多的. 但是确实有几个点值得一提.
#### demo更聚焦
1.x版本的 demo 除了渲染组件外, 还写了连线、清除等一系列案例. 看似扩展, 实则眼花缭乱. 作为 `x6-angular-shape`的 demo, 2.x版本更加聚焦, 更加聚焦于shape的使用与性能测试等, 与插件无关的内容请查看X6官网.
#### 功能更稳定
在1.x版本中, 虽然实现了功能, 但是使用场景的思考不够全面. 比如`ngArguments`的变化, 对 `TemplateRef`的场景并不生效. 虽然对`Component`生效但是无法触发`ngOnChanges`. 而在新版本中, 这些问题都将不复存在.
### 版本要求
你的Angular版本至少在14及以上才可以. 14以下需要用 hack 的方式实现一些特性, 比较麻烦. 暂时不提供, 如有需要可提issue, 我再专门介绍下如何实现.

@ -0,0 +1,66 @@
{
"name": "@antv/x6-angular-shape",
"version": "2.0.0",
"description": "X6 shape for rendering angular components.",
"main": "lib/index.js",
"module": "es/index.js",
"unpkg": "dist/index.js",
"jsdelivr": "dist/index.js",
"types": "lib/index.d.ts",
"files": [
"dist",
"es",
"lib",
"src"
],
"keywords": [
"shape",
"angular",
"render",
"x6",
"antv"
],
"scripts": {
"clean:turbo": "rss",
"clean:build": "rss",
"clean:coverage": "rss",
"clean": "rss",
"build:esm": "rss",
"build:cjs": "rss",
"build:umd": "rss",
"build:dev": "rss",
"build:watch": "rss",
"build:watch:esm": "rss",
"build:watch:cjs": "rss",
"build": "rss",
"prebuild": "rss",
"test": "rss",
"coveralls": "rss",
"pretest": "rss"
},
"peerDependencies": {
"@antv/x6": "^2.x",
"@angular/core": ">= 14"
},
"devDependencies": {
"@antv/x6": "^2.x"
},
"author": {
"name": "Eve-Sama",
"email": "948832626@qq.com"
},
"license": "MIT",
"homepage": "https://x6.antv.antgroup.com/tutorial/intermediate/angular",
"bugs": {
"url": "https://github.com/antvis/x6/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/antvis/x6.git",
"directory": "packages/x6-angular-shape"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
}
}

@ -0,0 +1,3 @@
export * from './node'
export * from './view'
export * from './registry'

@ -0,0 +1,102 @@
import { Node, Markup, ObjectExt } from '@antv/x6'
export class AngularShape<
Properties extends AngularShape.Properties = AngularShape.Properties,
> extends Node<Properties> {}
export namespace AngularShape {
export type Primer =
| 'rect'
| 'circle'
| 'path'
| 'ellipse'
| 'polygon'
| 'polyline'
export interface Properties extends Node.Properties {
primer?: Primer
}
}
export namespace AngularShape {
function getMarkup(primer?: Primer) {
const markup: Markup.JSONMarkup[] = []
const content = Markup.getForeignObjectMarkup()
if (primer) {
markup.push(
...[
{
tagName: primer,
selector: 'body',
},
content,
],
)
} else {
markup.push(content)
}
return markup
}
AngularShape.config<Properties>({
view: 'angular-shape-view',
markup: getMarkup(),
attrs: {
body: {
fill: 'none',
stroke: 'none',
refWidth: '100%',
refHeight: '100%',
},
fo: {
refWidth: '100%',
refHeight: '100%',
},
},
propHooks(metadata: Properties) {
if (metadata.markup == null) {
const primer = metadata.primer
if (primer) {
metadata.markup = getMarkup(primer)
let attrs = {}
switch (primer) {
case 'circle':
attrs = {
refCx: '50%',
refCy: '50%',
refR: '50%',
}
break
case 'ellipse':
attrs = {
refCx: '50%',
refCy: '50%',
refRx: '50%',
refRy: '50%',
}
break
default:
break
}
metadata.attrs = ObjectExt.merge(
{},
{
body: {
refWidth: null,
refHeight: null,
...attrs,
},
},
metadata.attrs || {},
)
}
}
return metadata
},
})
Node.registry.register('angular-shape', AngularShape, true)
}

@ -0,0 +1,32 @@
import { Injector, TemplateRef, Type } from '@angular/core'
import { Graph, Node } from '@antv/x6'
export type Content = TemplateRef<any> | Type<any>
export type AngularShapeConfig = Node.Properties & {
shape: string
injector: Injector
content: Content
}
export const registerInfo: Map<
string,
{
injector: Injector
content: Content
}
> = new Map()
export function register(config: AngularShapeConfig) {
const { shape, injector, content, ...others } = config
registerInfo.set(shape, { injector, content })
Graph.registerNode(
shape,
{
inherit: 'angular-shape',
...others,
},
true,
)
}

@ -0,0 +1,124 @@
import {
ComponentRef,
EmbeddedViewRef,
TemplateRef,
ViewContainerRef,
} from '@angular/core'
import { Dom, NodeView } from '@antv/x6'
import { AngularShape } from './node'
import { Content, registerInfo } from './registry'
export class AngularShapeView extends NodeView<AngularShape> {
getNodeContainer(): HTMLDivElement {
return this.selectors && (this.selectors.foContent as HTMLDivElement)
}
override confirmUpdate(flag: number): number {
const ret = super.confirmUpdate(flag)
return this.handleAction(ret, AngularShapeView.action, () =>
this.renderAngularContent(),
)
}
private getNgArguments(): Record<string, any> {
const input = (this.cell.data?.ngArguments as Record<string, any>) || {}
return input
}
/** 当执行 node.setData() 时需要对实例设置新的输入值 */
private setInstanceInput(
content: Content,
ref: EmbeddedViewRef<any> | ComponentRef<any>,
): void {
const ngArguments = this.getNgArguments()
if (content instanceof TemplateRef) {
const embeddedViewRef = ref as EmbeddedViewRef<any>
embeddedViewRef.context = { ngArguments }
} else {
const componentRef = ref as ComponentRef<any>
Object.keys(ngArguments).forEach((v) =>
componentRef.setInput(v, ngArguments[v]),
)
componentRef.changeDetectorRef.detectChanges()
}
}
protected renderAngularContent(): void {
this.unmountAngularContent()
const container = this.getNodeContainer()
if (container) {
const node = this.cell
const { injector, content } = registerInfo.get(node.shape)!
const viewContainerRef = injector.get(ViewContainerRef)
if (content instanceof TemplateRef) {
const ngArguments = this.getNgArguments()
const embeddedViewRef = viewContainerRef.createEmbeddedView(content, {
ngArguments,
})
embeddedViewRef.rootNodes.forEach((node) => container.appendChild(node))
embeddedViewRef.detectChanges()
node.on('change:data', () =>
this.setInstanceInput(content, embeddedViewRef),
)
} else {
const componentRef = viewContainerRef.createComponent(content)
const insertNode = (componentRef.hostView as EmbeddedViewRef<any>)
.rootNodes[0] as HTMLElement
container.appendChild(insertNode)
this.setInstanceInput(content, componentRef)
node.on('change:data', () =>
this.setInstanceInput(content, componentRef),
)
}
}
}
protected unmountAngularContent(): HTMLDivElement {
const container = this.getNodeContainer()
container.innerHTML = ''
return container
}
override onMouseDown(e: Dom.MouseDownEvent, x: number, y: number) {
const target = e.target as Element
const tagName = target.tagName.toLowerCase()
if (tagName === 'input') {
const type = target.getAttribute('type')
if (
type == null ||
[
'text',
'password',
'number',
'email',
'search',
'tel',
'url',
].includes(type)
) {
return
}
}
super.onMouseDown(e, x, y)
}
override unmount(): this {
this.unmountAngularContent()
super.unmount()
return this
}
}
export namespace AngularShapeView {
export const action = 'angular' as any
AngularShapeView.config({
bootstrap: [action],
actions: {
component: action,
},
})
NodeView.registry.register('angular-shape-view', AngularShapeView, true)
}

@ -1 +1,43 @@
## @antv/x6-common [2.0.10](https://github.com/antvis/x6/compare/@antv/x6-common@2.0.9...@antv/x6-common@2.0.10) (2023-02-24)
### Bug Fixes
* add textLength & lengthAdjust to CASE_SENSITIVE_ATTR ([#3281](https://github.com/antvis/x6/issues/3281)) ([76fb1ac](https://github.com/antvis/x6/commit/76fb1acf74b0f1c308f7c824d02c12244b7ac8f3))
## @antv/x6-common [2.0.8](https://github.com/antvis/x6/compare/@antv/x6-common@2.0.7...@antv/x6-common@2.0.8) (2023-02-18)
### Bug Fixes
* fix typo for dom event handlers ([#3255](https://github.com/antvis/x6/issues/3255)) ([9b4fa86](https://github.com/antvis/x6/commit/9b4fa86daa587fe8818f3615bc1e40738a0f2319))
## @antv/x6-common [2.0.6](https://github.com/antvis/x6/compare/@antv/x6-common@2.0.5...@antv/x6-common@2.0.6) (2023-01-31)
### Bug Fixes
* fix index error for priorityQueue ([#3179](https://github.com/antvis/x6/issues/3179)) ([d64150b](https://github.com/antvis/x6/commit/d64150bfadf10fe21f44734a0267261260b8c53b))
## @antv/x6-common [2.0.5](https://github.com/antvis/x6/compare/@antv/x6-common@2.0.4...@antv/x6-common@2.0.5) (2023-01-18)
### Bug Fixes
* optimize css loader ([#3156](https://github.com/antvis/x6/issues/3156)) ([9c48ad8](https://github.com/antvis/x6/commit/9c48ad8dfc99e623a57855295d07c35be5483073))
## @antv/x6-common [2.0.4](https://github.com/antvis/x6/compare/@antv/x6-common@2.0.3...@antv/x6-common@2.0.4) (2022-12-20)
### Bug Fixes
* fix window incompatibility problem ([#3070](https://github.com/antvis/x6/issues/3070)) ([d8e1e63](https://github.com/antvis/x6/commit/d8e1e637d8027b9494cd26efc87815d74bd51366))
## @antv/x6-common [2.0.1](https://github.com/antvis/x6/compare/@antv/x6-common@2.0.0...@antv/x6-common@2.0.1) (2022-11-25)
### Bug Fixes
* npm version ([cb0cfde](https://github.com/antvis/x6/commit/cb0cfdeb4dbe8858569e6899db08ccb9ab8ba4e7))
## @antv/x6-common [2.0.1](https://github.com/antvis/x6/compare/@antv/x6-common@2.0.0...@antv/x6-common@2.0.1) (2022-11-24)

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021-2022 Alipay.inc
Copyright (c) 2021-2023 Alipay.inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

@ -1,6 +1,6 @@
{
"name": "@antv/x6-common",
"version": "2.0.1",
"version": "2.0.11",
"description": "Basic toolkit for X6",
"main": "lib/index.js",
"module": "es/index.js",
@ -10,7 +10,8 @@
"files": [
"dist",
"es",
"lib"
"lib",
"src"
],
"keywords": [
"util",
@ -54,7 +55,7 @@
},
"repository": {
"type": "git",
"url": "ssh://git@github.com/antvis/x6.git",
"url": "https://github.com/antvis/x6.git",
"directory": "packages/x6-common"
},
"publishConfig": {

@ -45,7 +45,7 @@ export class PriorityQueue<T> {
*/
insert(priority: number, value: T, id?: string) {
const item: PriorityQueue.DataItem<T> = { priority, value }
const index = this.data.length - 1
const index = this.data.length
if (id) {
item.id = id
this.index[id] = index
@ -96,7 +96,9 @@ export class PriorityQueue<T> {
const data = this.data
const peek = data[0]
const last = data.pop()!
delete this.index[data.length]
if (peek.id) {
delete this.index[peek.id]
}
if (data.length > 0) {
data[0] = last

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

@ -1,3 +1,5 @@
/* eslint-disable no-constructor-return */
import { NumberExt } from '../number'
export class Color {

@ -2,6 +2,7 @@ import { Platform } from '../platform'
interface CssModule {
name: string
loadTimes: number
styleElement: HTMLStyleElement | null
}
@ -10,7 +11,10 @@ const cssModules: CssModule[] = []
export function ensure(name: string, content: string) {
const cssModule = cssModules.find((m) => m.name === name)
if (cssModule) {
return
cssModule.loadTimes += 1
if (cssModule.loadTimes > 1) {
return
}
}
if (!Platform.isApplyingHMR()) {
@ -25,6 +29,7 @@ export function ensure(name: string, content: string) {
cssModules.push({
name,
loadTimes: 1,
styleElement,
})
}
@ -34,7 +39,13 @@ export function clean(name: string) {
const index = cssModules.findIndex((m) => m.name === name)
if (index > -1) {
let styleElement = cssModules[index].styleElement
const cssModule = cssModules[index]
cssModule.loadTimes -= 1
if (cssModule.loadTimes > 0) {
return
}
let styleElement = cssModule.styleElement
if (styleElement && styleElement.parentNode) {
styleElement.parentNode.removeChild(styleElement)
}

@ -6,6 +6,8 @@ export const CASE_SENSITIVE_ATTR = [
'attributeName',
'attributeType',
'repeatCount',
'textLength',
'lengthAdjust',
]
export type Attributes = { [key: string]: string | number | null | undefined }

@ -1,26 +1,25 @@
import { StringExt } from '../string'
export function getData(dataset: Record<string, any>, name: string) {
const value = dataset[name] || dataset[StringExt.camelCase(name)]
try {
return JSON.parse(value)
} catch {
return value
const dataset: WeakMap<Element, Record<string, any>> = new WeakMap()
export function getData(elem: Element, name: string) {
const key = StringExt.camelCase(name)
const cache = dataset.get(elem)
if (cache) {
return cache[key]
}
}
export function setData(
dataset: Record<string, any>,
name: string,
value: any,
) {
let val = value
try {
val = JSON.stringify(val)
} catch (e) {
// paas
export function setData(elem: Element, name: string, value: any) {
const key = StringExt.camelCase(name)
const cache = dataset.get(elem)
if (cache) {
cache[key] = value
} else {
dataset.set(elem, {
[key]: value,
})
}
dataset[StringExt.camelCase(name)] = val
}
export function data(elem: Element): Record<string, any> | undefined
@ -34,20 +33,17 @@ export function data(
) {
if (!name) {
const datas: Record<string, any> = {}
const dataset = (elem as any).dataset
// eslint-disable-next-line
for (const key in dataset) {
datas[key] = getData(dataset, key)
}
Object.keys(dataset).forEach((key) => {
datas[key] = getData(elem, key)
})
return datas
}
if (typeof name === 'string') {
const dataset = (elem as any).dataset
if (value === undefined) {
return getData(dataset, name)
return getData(elem, name)
}
setData(dataset, name, value)
setData(elem, name, value)
return
}

@ -729,7 +729,7 @@ type TypeEventHandlersBase<TDelegateTarget, TData, TCurrentTarget, TTarget> = {
TCurrentTarget,
TTarget
>]?:
| TypeEventHandler<TDelegateTarget, TData, TCurrentTarget, TTarget, TType>
| TypeEventHandler<TDelegateTarget, TData, TCurrentTarget, TTarget, string>
| false
| Record<string, unknown>
}

@ -198,7 +198,14 @@ export function text(
const autoLineHeight = defaultLineHeight === 'auto'
const lineHeight = autoLineHeight ? '1.5em' : defaultLineHeight || '1em'
empty(elem)
let needEmptyElem = true
const childs = elem.children
if (childs.length === 1 && childs[0].tagName.toUpperCase() === 'TITLE') {
needEmptyElem = false
}
if (needEmptyElem) {
empty(elem)
}
attr(elem, {
// Preserve spaces, do not consecutive spaces to get collapsed to one.

@ -1,4 +1,4 @@
export { debounce } from 'lodash-es'
export { debounce, throttle } from 'lodash-es'
type Fn = (...args: any[]) => any

@ -117,6 +117,7 @@ export function unsetByPath(
return obj
}
// eslint-disable-next-line default-param-last
export function flatten(obj: any, delim = '/', stop?: (val: any) => boolean) {
const ret: { [key: string]: any } = {}

@ -1,6 +1,10 @@
// compatible with NodeList.prototype.forEach() before chrome 51
// https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach
if (window.NodeList && !NodeList.prototype.forEach) {
if (
typeof window === 'object' &&
window.NodeList &&
!NodeList.prototype.forEach
) {
NodeList.prototype.forEach = Array.prototype.forEach as any
}

@ -1 +1,12 @@
## @antv/x6-geometry [2.0.4](https://github.com/antvis/x6/compare/@antv/x6-geometry@2.0.3...@antv/x6-geometry@2.0.4) (2022-11-29)
## @antv/x6-geometry [2.0.3](https://github.com/antvis/x6/compare/@antv/x6-geometry@2.0.2...@antv/x6-geometry@2.0.3) (2022-11-25)
### Bug Fixes
* npm version ([cb0cfde](https://github.com/antvis/x6/commit/cb0cfdeb4dbe8858569e6899db08ccb9ab8ba4e7))
## @antv/x6-geometry [2.0.2](https://github.com/antvis/x6/compare/@antv/x6-geometry@2.0.1...@antv/x6-geometry@2.0.2) (2022-11-25)
## @antv/x6-geometry [2.0.1](https://github.com/antvis/x6/compare/@antv/x6-geometry@2.0.0...@antv/x6-geometry@2.0.1) (2022-11-24)

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021-2022 Alipay.inc
Copyright (c) 2021-2023 Alipay.inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

@ -5,7 +5,7 @@
<a href="/LICENSE"><img src="https://img.shields.io/github/license/antvis/x6?style=flat-square" alt="MIT License"></a>
<a href="https://www.typescriptlang.org"><img alt="Language" src="https://img.shields.io/badge/language-TypeScript-blue.svg?style=flat-square"></a>
<a href="https://github.com/antvis/x6/pulls"><img alt="PRs Welcome" src="https://img.shields.io/badge/PRs-Welcome-brightgreen.svg?style=flat-square"></a>
<a href="https://x6.antv.vision"><img alt="website" src="https://img.shields.io/static/v1?label=&labelColor=505050&message=website&color=0076D6&style=flat-square&logo=google-chrome&logoColor=0076D6"></a>
<a href="https://x6.antv.antgroup.com"><img alt="website" src="https://img.shields.io/static/v1?label=&labelColor=505050&message=website&color=0076D6&style=flat-square&logo=google-chrome&logoColor=0076D6"></a>
<a href="https://github.com/antvis/X6/actions/workflows/ci.yml"><img alt="build" src="https://img.shields.io/github/workflow/status/antvis/x6/%F0%9F%91%B7%E3%80%80CI/master?logo=github&style=flat-square"></a>
<a href="https://app.codecov.io/gh/antvis/x6"><img alt="coverage" src="https://img.shields.io/codecov/c/gh/antvis/x6?logo=codecov&flag=x6-geometry&style=flat-square&token=15CO54WYUV"></a>
<a href="https://lgtm.com/projects/g/antvis/x6/context:javascript"><img alt="Language grade: JavaScript" src="https://img.shields.io/lgtm/grade/javascript/g/antvis/x6.svg?logo=lgtm&style=flat-square"></a>

@ -1,5 +1,5 @@
{
"version": "2.0.1",
"version": "2.0.4",
"name": "@antv/x6-geometry",
"description": "Geometry operations for X6",
"main": "lib/index.js",
@ -10,7 +10,8 @@
"files": [
"dist",
"es",
"lib"
"lib",
"src"
],
"keywords": [
"geometry",
@ -47,7 +48,7 @@
},
"repository": {
"type": "git",
"url": "ssh://git@github.com/antvis/x6.git",
"url": "https://github.com/antvis/x6.git",
"directory": "packages/x6-geometry"
},
"publishConfig": {

@ -1,6 +1,8 @@
/* eslint-disable default-param-last */
import { Point } from '../point'
const regexSupportedData = new RegExp(`^[\\s\\dLMCZz,.]*$`)
const regexSupportedData = new RegExp(`^[\\s\\dLMCZz,.]*$`) // eslint-disable-line prefer-regex-literals
export function isValid(data: any) {
if (typeof data !== 'string') {

@ -1,3 +1,5 @@
/* eslint-disable no-constructor-return */
import { Line } from './line'
import { Point } from './point'
import { Rectangle } from './rectangle'

@ -1,3 +1,19 @@
## @antv/x6-plugin-clipboard [2.1.3](https://github.com/antvis/x6/compare/@antv/x6-plugin-clipboard@2.1.2...@antv/x6-plugin-clipboard@2.1.3) (2022-11-25)
### Bug Fixes
* broken file ([d6df2d5](https://github.com/antvis/x6/commit/d6df2d59811dc18791208af36b452e11e6391f3b))
## @antv/x6-plugin-clipboard [2.1.2](https://github.com/antvis/x6/compare/@antv/x6-plugin-clipboard@2.1.1...@antv/x6-plugin-clipboard@2.1.2) (2022-11-25)
### Bug Fixes
* npm version ([cb0cfde](https://github.com/antvis/x6/commit/cb0cfdeb4dbe8858569e6899db08ccb9ab8ba4e7))
## @antv/x6-plugin-clipboard [2.1.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-clipboard@2.1.0...@antv/x6-plugin-clipboard@2.1.1) (2022-11-25)
# @antv/x6-plugin-clipboard [2.1.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-clipboard@2.0.0...@antv/x6-plugin-clipboard@2.1.0) (2022-11-24)

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021-2022 Alipay.inc
Copyright (c) 2021-2023 Alipay.inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-clipboard",
"version": "2.1.0",
"version": "2.1.3",
"description": "clipboard plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",
@ -10,7 +10,8 @@
"files": [
"dist",
"es",
"lib"
"lib",
"src"
],
"keywords": [
"plugin",
@ -53,7 +54,7 @@
},
"repository": {
"type": "git",
"url": "ssh://git@github.com/antvis/x6.git",
"url": "https://github.com/antvis/x6.git",
"directory": "packages/x6-plugin-clipboard"
},
"publishConfig": {

@ -7,7 +7,7 @@ declare module '@antv/x6/lib/graph/graph' {
enableClipboard: () => Graph
disableClipboard: () => Graph
toggleClipboard: (enabled?: boolean) => Graph
isClipboardEmpty: () => boolean
isClipboardEmpty: (options?: Clipboard.Options) => boolean
getCellsInClipboard: () => Cell[]
cleanClipboard: () => Graph
copy: (cells: Cell[], options?: Clipboard.CopyOptions) => Graph
@ -55,10 +55,10 @@ Graph.prototype.toggleClipboard = function (enabled?: boolean) {
return this
}
Graph.prototype.isClipboardEmpty = function () {
Graph.prototype.isClipboardEmpty = function (options?: Clipboard.Options) {
const clipboard = this.getPlugin('clipboard') as Clipboard
if (clipboard) {
return clipboard.isEmpty()
return clipboard.isEmpty(options)
}
return true
}

@ -89,7 +89,12 @@ export class ClipboardImpl {
}
}
isEmpty() {
isEmpty(options: ClipboardImpl.Options = {}) {
if (options.useLocalStorage) {
// With useLocalStorage turned on, no real cells can be obtained without deserialize first
// https://github.com/antvis/X6/issues/2573
this.deserialize(options)
}
return this.cells.length <= 0
}

@ -11,7 +11,7 @@ export class Clipboard
public options: Clipboard.Options
public name = 'clipboard'
constructor(options: Clipboard.Options) {
constructor(options: Clipboard.Options = { enabled: true }) {
super()
this.options = options
}
@ -32,14 +32,12 @@ export class Clipboard
if (this.disabled) {
this.options.enabled = true
}
return this
}
disable() {
if (!this.disabled) {
this.options.enabled = false
}
return this
}
toggleEnabled(enabled?: boolean) {
@ -60,8 +58,8 @@ export class Clipboard
return this
}
isEmpty() {
return this.clipboardImpl.isEmpty()
isEmpty(options: Clipboard.Options = {}) {
return this.clipboardImpl.isEmpty(options)
}
getCellsInClipboard() {

@ -1,3 +1,19 @@
## @antv/x6-plugin-dnd [2.0.4](https://github.com/antvis/x6/compare/@antv/x6-plugin-dnd@2.0.3...@antv/x6-plugin-dnd@2.0.4) (2023-01-13)
### Bug Fixes
* change dragging container options ([#3139](https://github.com/antvis/x6/issues/3139)) ([7b091f3](https://github.com/antvis/x6/commit/7b091f35dee147c5e7bf97577e14e11ceb7e8e3d))
## @antv/x6-plugin-dnd [2.0.3](https://github.com/antvis/x6/compare/@antv/x6-plugin-dnd@2.0.2...@antv/x6-plugin-dnd@2.0.3) (2022-11-25)
### Bug Fixes
* npm version ([cb0cfde](https://github.com/antvis/x6/commit/cb0cfdeb4dbe8858569e6899db08ccb9ab8ba4e7))
## @antv/x6-plugin-dnd [2.0.2](https://github.com/antvis/x6/compare/@antv/x6-plugin-dnd@2.0.1...@antv/x6-plugin-dnd@2.0.2) (2022-11-25)
## @antv/x6-plugin-dnd [2.0.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-dnd@2.0.0...@antv/x6-plugin-dnd@2.0.1) (2022-11-24)

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021-2022 Alipay.inc
Copyright (c) 2021-2023 Alipay.inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-dnd",
"version": "2.0.1",
"version": "2.0.4",
"description": "dnd plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",
@ -10,7 +10,8 @@
"files": [
"dist",
"es",
"lib"
"lib",
"src"
],
"keywords": [
"plugin",
@ -54,7 +55,7 @@
},
"repository": {
"type": "git",
"url": "ssh://git@github.com/antvis/x6.git",
"url": "https://github.com/antvis/x6.git",
"directory": "packages/x6-plugin-dnd"
},
"publishConfig": {

@ -81,7 +81,10 @@ export class Dnd extends View {
this.targetModel.startBatch('dnd')
Dom.addClass(this.container, 'dragging')
Dom.appendTo(this.container, this.options.containerParent || document.body)
Dom.appendTo(
this.container,
this.options.draggingContainer || document.body,
)
this.sourceNode = node
this.prepareDragging(node, e.clientX, e.clientY)
@ -481,7 +484,7 @@ export namespace Dnd {
// duration?: number
// easing?: string
// }
containerParent?: HTMLElement
draggingContainer?: HTMLElement
/**
* dnd tool box container.
*/

@ -1,3 +1,12 @@
## @antv/x6-plugin-export [2.1.2](https://github.com/antvis/x6/compare/@antv/x6-plugin-export@2.1.1...@antv/x6-plugin-export@2.1.2) (2022-11-25)
### Bug Fixes
* npm version ([cb0cfde](https://github.com/antvis/x6/commit/cb0cfdeb4dbe8858569e6899db08ccb9ab8ba4e7))
## @antv/x6-plugin-export [2.1.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-export@2.1.0...@antv/x6-plugin-export@2.1.1) (2022-11-25)
# @antv/x6-plugin-export [2.1.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-export@2.0.0...@antv/x6-plugin-export@2.1.0) (2022-11-24)

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021-2022 Alipay.inc
Copyright (c) 2021-2023 Alipay.inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-export",
"version": "2.1.0",
"version": "2.1.5",
"description": "export plugin for X6.",
"main": "lib/index.js",
"module": "es/index.js",
@ -10,7 +10,8 @@
"files": [
"dist",
"es",
"lib"
"lib",
"src"
],
"keywords": [
"plugin",
@ -52,7 +53,7 @@
},
"repository": {
"type": "git",
"url": "ssh://git@github.com/antvis/x6.git",
"url": "https://github.com/antvis/x6.git",
"directory": "packages/x6-plugin-export"
},
"publishConfig": {

@ -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,

@ -1,3 +1,19 @@
# @antv/x6-plugin-history [2.2.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-history@2.1.3...@antv/x6-plugin-history@2.2.0) (2023-02-17)
### Features
* history add max stack size ([#3253](https://github.com/antvis/x6/issues/3253)) ([fba5310](https://github.com/antvis/x6/commit/fba531064ad8027c451a81b60d5efd7f7314a0fa))
## @antv/x6-plugin-history [2.1.3](https://github.com/antvis/x6/compare/@antv/x6-plugin-history@2.1.2...@antv/x6-plugin-history@2.1.3) (2022-11-25)
### Bug Fixes
* npm version ([cb0cfde](https://github.com/antvis/x6/commit/cb0cfdeb4dbe8858569e6899db08ccb9ab8ba4e7))
## @antv/x6-plugin-history [2.1.2](https://github.com/antvis/x6/compare/@antv/x6-plugin-history@2.1.1...@antv/x6-plugin-history@2.1.2) (2022-11-25)
## @antv/x6-plugin-history [2.1.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-history@2.1.0...@antv/x6-plugin-history@2.1.1) (2022-11-24)

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021-2022 Alipay.inc
Copyright (c) 2021-2023 Alipay.inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-history",
"version": "2.1.1",
"version": "2.2.0",
"description": "history plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",
@ -10,7 +10,8 @@
"files": [
"dist",
"es",
"lib"
"lib",
"src"
],
"keywords": [
"plugin",
@ -53,7 +54,7 @@
},
"repository": {
"type": "git",
"url": "ssh://git@github.com/antvis/x6.git",
"url": "https://github.com/antvis/x6.git",
"directory": "packages/x6-plugin-history"
},
"publishConfig": {

@ -12,6 +12,10 @@ declare module '@antv/x6/lib/graph/graph' {
undoAndCancel: (options?: KeyValue) => Graph
canUndo: () => boolean
canRedo: () => boolean
getHistoryStackSize: () => number
getUndoStackSize: () => number
getRedoStackSize: () => number
getUndoRemainSize: () => number
cleanHistory: (options?: KeyValue) => Graph
}
}
@ -107,3 +111,23 @@ Graph.prototype.cleanHistory = function (options?: KeyValue) {
}
return this
}
Graph.prototype.getHistoryStackSize = function () {
const history = this.getPlugin('history') as History
return history.getSize()
}
Graph.prototype.getUndoStackSize = function () {
const history = this.getPlugin('history') as History
return history.getUndoSize()
}
Graph.prototype.getRedoStackSize = function () {
const history = this.getPlugin('history') as History
return history.getRedoSize()
}
Graph.prototype.getUndoRemainSize = function () {
const history = this.getPlugin('history') as History
return history.getUndoRemainSize()
}

@ -25,6 +25,7 @@ export class History
protected batchLevel = 0
protected lastBatchIndex = -1
protected freezed = false
protected stackSize = 0 // 0: not limit
protected readonly handlers: (<T extends History.ModelEvents>(
event: T,
@ -33,6 +34,8 @@ export class History
constructor(options: History.Options) {
super()
const { stackSize = 0 } = options
this.stackSize = stackSize
this.options = Util.getOptions(options)
this.validator = new History.Validator({
history: this,
@ -101,7 +104,7 @@ export class History
const cmd = this.redoStack.pop()
if (cmd) {
this.applyCommand(cmd, options)
this.undoStack.push(cmd)
this.undoStackPush(cmd)
this.notify('redo', cmd, options)
}
}
@ -124,6 +127,23 @@ export class History
return this
}
getSize() {
return this.stackSize
}
getUndoRemainSize() {
const ul = this.undoStack.length
return this.stackSize - ul
}
getUndoSize() {
return this.undoStack.length
}
getRedoSize() {
return this.redoStack.length
}
canUndo() {
return !this.disabled && this.undoStack.length > 0
}
@ -424,7 +444,7 @@ export class History
const cmds = this.filterBatchCommand(this.batchCommands)
if (cmds.length > 0) {
this.redoStack = []
this.undoStack.push(cmds)
this.undoStackPush(cmds)
this.consolidateCommands()
this.notify('add', cmds, options)
}
@ -498,7 +518,7 @@ export class History
this.lastBatchIndex = Math.max(this.lastBatchIndex, 0)
this.emit('batch', { cmd, options })
} else {
this.undoStack.push(cmd)
this.undoStackPush(cmd)
this.consolidateCommands()
this.notify('add', cmd, options)
}
@ -560,6 +580,17 @@ export class History
this.undoStack.pop()
}
protected undoStackPush(cmd: History.Commands) {
if (this.stackSize === 0) {
this.undoStack.push(cmd)
return
}
if (this.undoStack.length >= this.stackSize) {
this.undoStack.shift()
}
this.undoStack.push(cmd)
}
@Basecoat.dispose()
dispose() {
this.validator.dispose()
@ -614,7 +645,9 @@ export namespace History {
cancelInvalid?: boolean
}
export interface Options extends Partial<CommonOptions> {}
export interface Options extends Partial<CommonOptions> {
stackSize?: number
}
interface Data {
id?: string

@ -1,3 +1,26 @@
# @antv/x6-plugin-keyboard [2.2.0](https://github.com/antvis/x6/compare/@antv/x6-plugin-keyboard@2.1.4...@antv/x6-plugin-keyboard@2.2.0) (2023-02-06)
### Features
* keyboard support clear and custom trigger ([#3202](https://github.com/antvis/x6/issues/3202)) ([668c932](https://github.com/antvis/x6/commit/668c93242fbcebb987cccc3dcfd56982f7c66252))
## @antv/x6-plugin-keyboard [2.1.4](https://github.com/antvis/x6/compare/@antv/x6-plugin-keyboard@2.1.3...@antv/x6-plugin-keyboard@2.1.4) (2022-11-29)
### Bug Fixes
* not trigger keyboard event whith delete key in contenteditable elem ([#2965](https://github.com/antvis/x6/issues/2965)) ([4978110](https://github.com/antvis/x6/commit/4978110b4594aee801d39c74f5c190432846eba4))
## @antv/x6-plugin-keyboard [2.1.3](https://github.com/antvis/x6/compare/@antv/x6-plugin-keyboard@2.1.2...@antv/x6-plugin-keyboard@2.1.3) (2022-11-25)
### Bug Fixes
* npm version ([cb0cfde](https://github.com/antvis/x6/commit/cb0cfdeb4dbe8858569e6899db08ccb9ab8ba4e7))
## @antv/x6-plugin-keyboard [2.1.2](https://github.com/antvis/x6/compare/@antv/x6-plugin-keyboard@2.1.1...@antv/x6-plugin-keyboard@2.1.2) (2022-11-25)
## @antv/x6-plugin-keyboard [2.1.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-keyboard@2.1.0...@antv/x6-plugin-keyboard@2.1.1) (2022-11-25)

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021-2022 Alipay.inc
Copyright (c) 2021-2023 Alipay.inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-keyboard",
"version": "2.1.1",
"version": "2.2.0",
"description": "keyboard plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",
@ -10,7 +10,8 @@
"files": [
"dist",
"es",
"lib"
"lib",
"src"
],
"keywords": [
"plugin",
@ -57,7 +58,7 @@
},
"repository": {
"type": "git",
"url": "ssh://git@github.com/antvis/x6.git",
"url": "https://github.com/antvis/x6.git",
"directory": "packages/x6-plugin-keyboard"
},
"publishConfig": {

@ -14,6 +14,8 @@ declare module '@antv/x6/lib/graph/graph' {
action?: KeyboardImpl.Action,
) => Graph
unbindKey: (keys: string | string[], action?: KeyboardImpl.Action) => Graph
clearKeys: () => Graph
triggerKey: (key: string, action: KeyboardImpl.Action) => Graph
}
}
@ -71,3 +73,19 @@ Graph.prototype.unbindKey = function (
}
return this
}
Graph.prototype.clearKeys = function() {
const keyboard = this.getPlugin('keyboard') as Keyboard
if(keyboard) {
keyboard.clear()
}
return this
}
Graph.prototype.triggerKey = function(key: string, action: KeyboardImpl.Action) {
const keyboard = this.getPlugin('keyboard') as Keyboard
if(keyboard) {
keyboard.trigger(key, action)
}
return this
}

@ -7,7 +7,7 @@ export class Keyboard extends Disposable {
public name = 'keyboard'
public options: KeyboardImpl.Options
constructor(options: KeyboardImpl.Options) {
constructor(options: KeyboardImpl.Options = { enabled: true }) {
super()
this.options = options
}
@ -27,12 +27,10 @@ export class Keyboard extends Disposable {
enable() {
this.keyboardImpl.enable()
return this
}
disable() {
this.keyboardImpl.disable()
return this
}
toggleEnabled(enabled?: boolean) {
@ -61,6 +59,16 @@ export class Keyboard extends Disposable {
return this
}
trigger(key: string, action?: KeyboardImpl.Action) {
this.keyboardImpl.trigger(key, action)
return this
}
clear() {
this.keyboardImpl.clear()
return this
}
unbindKey(keys: string | string[], action?: KeyboardImpl.Action) {
this.keyboardImpl.off(keys, action)
return this

@ -21,7 +21,6 @@ export class KeyboardImpl extends Disposable implements IDisablable {
private readonly options: KeyboardImpl.Options & { graph: Graph },
) {
super()
const scroller = this.graph.getPlugin('scroller') as any
this.container = scroller ? scroller.container : this.graph.container
@ -76,6 +75,14 @@ export class KeyboardImpl extends Disposable implements IDisablable {
this.mousetrap.unbind(this.getKeys(keys), action)
}
clear() {
this.mousetrap.reset()
}
trigger(key: string, action?: KeyboardImpl.Action) {
this.mousetrap.trigger(key, action)
}
private focus(e: EventArgs['node:mouseup']) {
const isInputEvent = this.isInputEvent(e.e)
if (isInputEvent) {
@ -95,7 +102,7 @@ export class KeyboardImpl extends Disposable implements IDisablable {
protected formatkey(key: string) {
const formated = key
.toLowerCase()
.toLocaleLowerCase()
.replace(/\s/g, '')
.replace('delete', 'del')
.replace('cmd', 'command')
@ -129,15 +136,18 @@ export class KeyboardImpl extends Disposable implements IDisablable {
isInputEvent(e: KeyboardEvent | Dom.MouseUpEvent) {
const target = e.target as Element
const tagName = target?.tagName?.toLowerCase()
return ['input', 'textarea'].includes(tagName)
let isInput = ['input', 'textarea'].includes(tagName)
if (Dom.attr(target, 'contenteditable') === 'true') {
isInput = true
}
return isInput
}
isEnabledForEvent(e: KeyboardEvent) {
const allowed = !this.disabled && this.isGraphEvent(e)
const isInputEvent = this.isInputEvent(e)
if (allowed) {
const code = e.keyCode || e.which
if (isInputEvent && (code === 8 || code === 46)) {
if (isInputEvent && (e.key === 'Backspace' || e.key === 'Delete')) {
return false
}
if (this.options.guard) {

@ -1,3 +1,12 @@
## @antv/x6-plugin-minimap [2.0.3](https://github.com/antvis/x6/compare/@antv/x6-plugin-minimap@2.0.2...@antv/x6-plugin-minimap@2.0.3) (2022-11-25)
### Bug Fixes
* npm version ([cb0cfde](https://github.com/antvis/x6/commit/cb0cfdeb4dbe8858569e6899db08ccb9ab8ba4e7))
## @antv/x6-plugin-minimap [2.0.2](https://github.com/antvis/x6/compare/@antv/x6-plugin-minimap@2.0.1...@antv/x6-plugin-minimap@2.0.2) (2022-11-25)
## @antv/x6-plugin-minimap [2.0.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-minimap@2.0.0...@antv/x6-plugin-minimap@2.0.1) (2022-11-24)

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021-2022 Alipay.inc
Copyright (c) 2021-2023 Alipay.inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-minimap",
"version": "2.0.1",
"version": "2.0.3",
"description": "minimap plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",
@ -10,7 +10,8 @@
"files": [
"dist",
"es",
"lib"
"lib",
"src"
],
"keywords": [
"plugin",
@ -54,7 +55,7 @@
},
"repository": {
"type": "git",
"url": "ssh://git@github.com/antvis/x6.git",
"url": "https://github.com/antvis/x6.git",
"directory": "packages/x6-plugin-minimap"
},
"publishConfig": {

@ -17,7 +17,7 @@
> svg {
pointer-events: none;
shape-rendering: optimizeSpeed;
shape-rendering: optimizespeed;
}
.x6-node * {

@ -1,3 +1,12 @@
## @antv/x6-plugin-scroller [2.0.3](https://github.com/antvis/x6/compare/@antv/x6-plugin-scroller@2.0.2...@antv/x6-plugin-scroller@2.0.3) (2022-11-25)
### Bug Fixes
* npm version ([cb0cfde](https://github.com/antvis/x6/commit/cb0cfdeb4dbe8858569e6899db08ccb9ab8ba4e7))
## @antv/x6-plugin-scroller [2.0.2](https://github.com/antvis/x6/compare/@antv/x6-plugin-scroller@2.0.1...@antv/x6-plugin-scroller@2.0.2) (2022-11-25)
## @antv/x6-plugin-scroller [2.0.1](https://github.com/antvis/x6/compare/@antv/x6-plugin-scroller@2.0.0...@antv/x6-plugin-scroller@2.0.1) (2022-11-24)

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021-2022 Alipay.inc
Copyright (c) 2021-2023 Alipay.inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-scroller",
"version": "2.0.1",
"version": "2.0.8",
"description": "scroller plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",
@ -10,7 +10,8 @@
"files": [
"dist",
"es",
"lib"
"lib",
"src"
],
"keywords": [
"plugin",
@ -54,7 +55,7 @@
},
"repository": {
"type": "git",
"url": "ssh://git@github.com/antvis/x6.git",
"url": "https://github.com/antvis/x6.git",
"directory": "packages/x6-plugin-scroller"
},
"publishConfig": {

@ -37,14 +37,10 @@
&&-pannable[data-panning='false'] {
cursor: grab;
cursor: -moz-grab;
cursor: -webkit-grab;
}
&&-pannable[data-panning='true'] {
cursor: grabbing;
cursor: -moz-grabbing;
cursor: -webkit-grabbing;
user-select: none;
}
}

@ -35,17 +35,16 @@ export class Scroller extends Basecoat<Scroller.EventArgs> {
return this.scrollerImpl.container
}
constructor(public readonly options: Scroller.Options) {
constructor(public options: Scroller.Options) {
super()
CssLoader.ensure(this.name, content)
}
public init(graph: Graph) {
this.graph = graph
this.scrollerImpl = new ScrollerImpl({
...this.options,
graph,
})
const options = ScrollerImpl.getOptions({ ...this.options, graph })
this.options = options
this.scrollerImpl = new ScrollerImpl(options)
this.setup()
this.startListening()
this.updateClassName()
@ -401,8 +400,10 @@ export namespace Scroller {
export interface EventArgs extends ScrollerImpl.EventArgs {}
type EventType = 'leftMouseDown' | 'rightMouseDown'
export interface Options extends ScrollerImpl.CommonOptions {
interface ScrollerOptions extends ScrollerImpl.Options {
pannable?: boolean | { enabled: boolean; eventTypes: EventType[] }
modifiers?: string | ModifierKey[] | null // alt, ctrl, shift, meta
}
export type Options = Omit<ScrollerOptions, 'graph'>
}

@ -1128,7 +1128,8 @@ export namespace ScrollerImpl {
panning: { e: Dom.MouseMoveEvent }
'pan:stop': { e: Dom.MouseUpEvent }
}
export interface CommonOptions {
export interface Options {
graph: Graph
enabled?: boolean
className?: string
width?: number
@ -1151,10 +1152,6 @@ export namespace ScrollerImpl {
scroller: ScrollerImpl,
) => TransformManager.FitToContentFullOptions)
}
export interface Options extends CommonOptions {
graph: Graph
}
export interface CenterOptions {
padding?: NumberExt.SideOptions
}
@ -1266,7 +1263,7 @@ export namespace ScrollerImpl {
result.background == null
) {
result.background = graphOptions.background
delete graphOptions.background
options.graph.background.clear()
}
return result as ScrollerImpl.Options

@ -1,3 +1,12 @@
## @antv/x6-plugin-selection [2.1.4](https://github.com/antvis/x6/compare/@antv/x6-plugin-selection@2.1.3...@antv/x6-plugin-selection@2.1.4) (2022-11-25)
### Bug Fixes
* npm version ([cb0cfde](https://github.com/antvis/x6/commit/cb0cfdeb4dbe8858569e6899db08ccb9ab8ba4e7))
## @antv/x6-plugin-selection [2.1.3](https://github.com/antvis/x6/compare/@antv/x6-plugin-selection@2.1.2...@antv/x6-plugin-selection@2.1.3) (2022-11-25)
## @antv/x6-plugin-selection [2.1.2](https://github.com/antvis/x6/compare/@antv/x6-plugin-selection@2.1.1...@antv/x6-plugin-selection@2.1.2) (2022-11-24)

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021-2022 Alipay.inc
Copyright (c) 2021-2023 Alipay.inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

@ -1,6 +1,6 @@
{
"name": "@antv/x6-plugin-selection",
"version": "2.1.2",
"version": "2.1.5",
"description": "selection plugin for X6",
"main": "lib/index.js",
"module": "es/index.js",
@ -10,7 +10,8 @@
"files": [
"dist",
"es",
"lib"
"lib",
"src"
],
"keywords": [
"plugin",
@ -54,7 +55,7 @@
},
"repository": {
"type": "git",
"url": "ssh://git@github.com/antvis/x6.git",
"url": "https://github.com/antvis/x6.git",
"directory": "packages/x6-plugin-selection"
},
"publishConfig": {

Some files were not shown because too many files have changed in this diff Show More