Compare commits
133 Commits
@antv/x6@2
...
@antv/x6@2
Author | SHA1 | Date | |
---|---|---|---|
ed999c630c | |||
34bcd12038 | |||
9138978918 | |||
46f4c8ac2a | |||
7519b11e66 | |||
5882b6a599 | |||
9781fb48f5 | |||
c8a03ed2ba | |||
b944419572 | |||
bebc5652d1 | |||
8daa2c9b98 | |||
c510756fe4 | |||
9b4fa86daa | |||
7e86ba90d6 | |||
f27bec6bb8 | |||
c38006a358 | |||
5f2783aade | |||
fba531064a | |||
04656f33f4 | |||
441dd564b4 | |||
9ccda3e96f | |||
979b2556e9 | |||
153013a606 | |||
2c7b966f45 | |||
b199153f3b | |||
608ce9ac6c | |||
eb921f7018 | |||
68e7132213 | |||
62aa5323ce | |||
e380cba7d9 | |||
8fada570e4 | |||
1096bf171b | |||
1834cd2143 | |||
1cf9cb654f | |||
b392d78856 | |||
58c0fe459c | |||
8a510fa8f8 | |||
668c93242f | |||
c122b2122c | |||
3b9957efbb | |||
1f83a2b8a8 | |||
6699c2bd00 | |||
7192209a5c | |||
5da5575451 | |||
3377049a49 | |||
4e76734cee | |||
3a59703f1c | |||
45218c36f6 | |||
17b36e21c7 | |||
1682a1d953 | |||
bcf3380d2b | |||
24368d4f86 | |||
3265fe5b98 | |||
5599286473 | |||
d64150bfad | |||
cae8625feb | |||
d8f1729f09 | |||
20c170b44a | |||
0e8769642a | |||
bd30f7f61d | |||
e3e7cfc66f | |||
c86ed1a031 | |||
ae179eb2cd | |||
2a3e523b1b | |||
b5af7844af | |||
9c48ad8dfc | |||
1a5f1655df | |||
90dad14d7e | |||
323e01559d | |||
bfc8d7f17a | |||
df24392728 | |||
fc940fa53c | |||
604c848c2a | |||
7b091f35de | |||
95c72c3033 | |||
0c91218b64 | |||
61c030a162 | |||
5c5f3e5319 | |||
06a8f28c2d | |||
ece198265b | |||
6abd0683ea | |||
fff95806c8 | |||
a069449782 | |||
3b25683529 | |||
45337e4a62 | |||
91fc97791b | |||
cdd0913eee | |||
a696009ede | |||
c808ca6d2b | |||
d3301d33d5 | |||
0029555458 | |||
cc18463c53 | |||
fb8098c1c0 | |||
c250caba6a | |||
019333d79d | |||
33c2e59207 | |||
844ee5fa04 | |||
96010e3b52 | |||
a98e97db11 | |||
30c2ed2655 | |||
3a020d17c3 | |||
d8e1e637d8 | |||
2d04848d52 | |||
e2bb71d954 | |||
8b145941ec | |||
2c7a04a6f4 | |||
dfa8c492da | |||
3b668feb4e | |||
07f4739979 | |||
824560ddda | |||
9e37ea9f78 | |||
610349d924 | |||
2f92e33d0e | |||
df540d9b79 | |||
3bc37971f8 | |||
50284c2d51 | |||
15284e778a | |||
1a0e8cf969 | |||
1089109b08 | |||
faf294a5ec | |||
25461fd985 | |||
35f2966219 | |||
26df790b8c | |||
bc7efe8db9 | |||
abeb009d0a | |||
ad08cf87ef | |||
16c2ef35e0 | |||
187e318aee | |||
f07abff980 | |||
4a6a634a8a | |||
627368e0dd | |||
604c0244cd | |||
80898ada1c |
2
.github/workflows/config/codeql.yml
vendored
2
.github/workflows/config/codeql.yml
vendored
@ -1,5 +1,5 @@
|
||||
paths-ignore:
|
||||
- sites/x6-sites/static
|
||||
- sites/public
|
||||
query-filters:
|
||||
- exclude:
|
||||
id: js/use-before-declaration
|
||||
|
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
@ -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:
|
||||
|
2
.github/workflows/welcome.yml
vendored
2
.github/workflows/welcome.yml
vendored
@ -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: |
|
||||
|
@ -12,5 +12,5 @@ es/
|
||||
lib/
|
||||
dist/
|
||||
coverage/
|
||||
sites/x6-sites/static/demos
|
||||
sites/public
|
||||
csstype.ts
|
||||
|
38
CONTRIBUTORS
38
CONTRIBUTORS
@ -1,21 +1,23 @@
|
||||
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>
|
||||
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,17 +27,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>
|
||||
Simon <>
|
||||
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>
|
||||
@ -51,6 +58,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>
|
||||
@ -66,10 +75,11 @@ 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>
|
||||
wtzeng1 <wtzeng1@gmail.com>
|
||||
x6-bot <x6-bot@users.noreply.github.com>
|
||||
@ -79,10 +89,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>
|
||||
|
234
CONTRIBUTORS.svg
234
CONTRIBUTORS.svg
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 12 MiB After Width: | Height: | Size: 14 MiB |
2
LICENSE
2
LICENSE
@ -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
README.md
17
README.md
@ -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.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="/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>
|
||||
|
||||
## 特性
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
104
examples/x6-example-features/src/pages/history/index.tsx
Normal file
104
examples/x6-example-features/src/pages/history/index.tsx
Normal file
@ -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>
|
||||
)
|
||||
}
|
||||
}
|
@ -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>
|
||||
)
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ export default class Example extends React.Component {
|
||||
strict: true,
|
||||
showNodeSelectionBox: true,
|
||||
selectCellOnMoved: false,
|
||||
useCellGeometry: true,
|
||||
filter(cell) {
|
||||
return cell !== a
|
||||
},
|
||||
|
39
package.json
39
package.json
@ -2,7 +2,7 @@
|
||||
"name": "x6",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"preinstall": "node ./scripts/preinstall",
|
||||
"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",
|
||||
@ -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": {
|
||||
@ -93,35 +92,35 @@
|
||||
"@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.3",
|
||||
"@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",
|
||||
"@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.10",
|
||||
"@types/jest": "^29.2.4",
|
||||
"@types/node": "^18.11.15",
|
||||
"@types/sinon": "^10.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
||||
"@typescript-eslint/parser": "^5.45.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.1",
|
||||
"eslint-plugin-unicorn": "^45.0.2",
|
||||
"fs-extra": "^11.1.0",
|
||||
"husky": "^8.0.1",
|
||||
"is-ci": "^3.0.0",
|
||||
@ -131,26 +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.5.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": "^15.0.0",
|
||||
"sinon": "^15.0.1",
|
||||
"stylelint": "^14.15.0",
|
||||
"stylelint-config-prettier": "^9.0.4",
|
||||
"stylelint-config-rational-order": "^0.1.2",
|
||||
@ -162,5 +160,8 @@
|
||||
"tslib": "^2.4.1",
|
||||
"turbo": "^1.6.3",
|
||||
"typescript": "^4.9.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-terser": "^0.2.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,31 @@
|
||||
## @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)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-common",
|
||||
"version": "2.0.3",
|
||||
"version": "2.0.8",
|
||||
"description": "Basic toolkit for X6",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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,10 @@
|
||||
## @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)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-plugin-dnd",
|
||||
"version": "2.0.3",
|
||||
"version": "2.0.4",
|
||||
"description": "dnd plugin for X6",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -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,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-plugin-export",
|
||||
"version": "2.1.4",
|
||||
"version": "2.1.5",
|
||||
"description": "export plugin for X6.",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -5,15 +5,15 @@ declare module '@antv/x6/lib/graph/graph' {
|
||||
interface Graph {
|
||||
toSVG: (
|
||||
callback: Export.ToSVGCallback,
|
||||
options: Export.ToSVGOptions,
|
||||
options?: Export.ToSVGOptions,
|
||||
) => void
|
||||
toPNG: (
|
||||
callback: Export.ToSVGCallback,
|
||||
options: Export.ToImageOptions,
|
||||
options?: Export.ToImageOptions,
|
||||
) => void
|
||||
toJPEG: (
|
||||
callback: Export.ToSVGCallback,
|
||||
options: Export.ToImageOptions,
|
||||
options?: Export.ToImageOptions,
|
||||
) => void
|
||||
exportPNG: (fileName?: string, options?: Export.ToImageOptions) => void
|
||||
exportJPEG: (fileName?: string, options?: Export.ToImageOptions) => void
|
||||
@ -23,7 +23,7 @@ declare module '@antv/x6/lib/graph/graph' {
|
||||
|
||||
Graph.prototype.toSVG = function (
|
||||
callback: Export.ToSVGCallback,
|
||||
options: Export.ToSVGOptions,
|
||||
options?: Export.ToSVGOptions,
|
||||
) {
|
||||
const instance = this.getPlugin('export') as Export
|
||||
if (instance) {
|
||||
@ -33,7 +33,7 @@ Graph.prototype.toSVG = function (
|
||||
|
||||
Graph.prototype.toPNG = function (
|
||||
callback: Export.ToSVGCallback,
|
||||
options: Export.ToImageOptions,
|
||||
options?: Export.ToImageOptions,
|
||||
) {
|
||||
const instance = this.getPlugin('export') as Export
|
||||
if (instance) {
|
||||
@ -43,7 +43,7 @@ Graph.prototype.toPNG = function (
|
||||
|
||||
Graph.prototype.toJPEG = function (
|
||||
callback: Export.ToSVGCallback,
|
||||
options: Export.ToImageOptions,
|
||||
options?: Export.ToImageOptions,
|
||||
) {
|
||||
const instance = this.getPlugin('export') as Export
|
||||
if (instance) {
|
||||
|
@ -1,3 +1,10 @@
|
||||
# @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)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-plugin-history",
|
||||
"version": "2.1.3",
|
||||
"version": "2.2.0",
|
||||
"description": "history plugin for X6",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
@ -424,7 +427,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 +501,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 +563,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 +628,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,10 @@
|
||||
# @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)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-plugin-keyboard",
|
||||
"version": "2.1.4",
|
||||
"version": "2.2.0",
|
||||
"description": "keyboard plugin for X6",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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,17 @@ 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')
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-plugin-scroller",
|
||||
"version": "2.0.3",
|
||||
"version": "2.0.8",
|
||||
"description": "scroller plugin for X6",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -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
|
||||
|
@ -62,14 +62,12 @@ export class Selection extends Basecoat<SelectionImpl.EventArgs> {
|
||||
if (this.disabled) {
|
||||
this.options.enabled = true
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
disable() {
|
||||
if (!this.disabled) {
|
||||
this.options.enabled = false
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
toggleEnabled(enabled?: boolean) {
|
||||
|
@ -29,12 +29,10 @@ export class Snapline extends Disposable {
|
||||
|
||||
enable() {
|
||||
this.snaplineImpl.enable()
|
||||
return this
|
||||
}
|
||||
|
||||
disable() {
|
||||
this.snaplineImpl.disable()
|
||||
return this
|
||||
}
|
||||
|
||||
toggleEnabled(enabled?: boolean) {
|
||||
|
@ -1,3 +1,17 @@
|
||||
## @antv/x6-plugin-transform [2.1.5](https://github.com/antvis/x6/compare/@antv/x6-plugin-transform@2.1.4...@antv/x6-plugin-transform@2.1.5) (2022-12-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add defense for view in transform plugin ([#3092](https://github.com/antvis/x6/issues/3092)) ([fb8098c](https://github.com/antvis/x6/commit/fb8098c1c06440dd69f4e93881fd36f7e6de2a56))
|
||||
|
||||
## @antv/x6-plugin-transform [2.1.4](https://github.com/antvis/x6/compare/@antv/x6-plugin-transform@2.1.3...@antv/x6-plugin-transform@2.1.4) (2022-12-07)
|
||||
|
||||
|
||||
### 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-plugin-transform [2.1.2](https://github.com/antvis/x6/compare/@antv/x6-plugin-transform@2.1.1...@antv/x6-plugin-transform@2.1.2) (2022-11-25)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-plugin-transform",
|
||||
"version": "2.0.3",
|
||||
"version": "2.1.5",
|
||||
"description": "transform plugin for X6",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -7,6 +7,7 @@ export class Transform extends Basecoat<Transform.EventArgs> {
|
||||
private graph: Graph
|
||||
protected widgets: Map<Node, TransformImpl> = new Map()
|
||||
public name = 'transform'
|
||||
private disabled = false
|
||||
|
||||
constructor(public readonly options: Transform.Options) {
|
||||
super()
|
||||
@ -15,6 +16,9 @@ export class Transform extends Basecoat<Transform.EventArgs> {
|
||||
|
||||
init(graph: Graph) {
|
||||
this.graph = graph
|
||||
if (this.disabled) {
|
||||
return
|
||||
}
|
||||
this.startListening()
|
||||
}
|
||||
|
||||
@ -28,6 +32,24 @@ export class Transform extends Basecoat<Transform.EventArgs> {
|
||||
this.graph.off('blank:mousedown', this.onBlankMouseDown, this)
|
||||
}
|
||||
|
||||
enable() {
|
||||
if (this.disabled) {
|
||||
this.disabled = false
|
||||
this.startListening()
|
||||
}
|
||||
}
|
||||
|
||||
disable() {
|
||||
if (!this.disabled) {
|
||||
this.disabled = true
|
||||
this.stopListening()
|
||||
}
|
||||
}
|
||||
|
||||
isEnabled() {
|
||||
return !this.disabled
|
||||
}
|
||||
|
||||
protected onNodeClick({ node }: EventArgs['node:click']) {
|
||||
this.clearWidgets()
|
||||
const widget = this.createTransform(node)
|
||||
@ -90,18 +112,23 @@ export class Transform extends Basecoat<Transform.EventArgs> {
|
||||
)
|
||||
|
||||
const options: TransformImpl.Options = {
|
||||
resizable: resizing.enabled,
|
||||
resizable: !!resizing.enabled,
|
||||
minWidth: resizing.minWidth || 0,
|
||||
maxWidth: resizing.maxWidth || Number.MAX_SAFE_INTEGER,
|
||||
minHeight: resizing.minHeight || 0,
|
||||
maxHeight: resizing.maxHeight || Number.MAX_SAFE_INTEGER,
|
||||
orthogonalResizing: resizing.orthogonal || true,
|
||||
restrictedResizing: resizing.restrict || false,
|
||||
autoScrollOnResizing: resizing.autoScroll || true,
|
||||
preserveAspectRatio: resizing.preserveAspectRatio || false,
|
||||
allowReverse: resizing.allowReverse || true,
|
||||
orthogonalResizing:
|
||||
typeof resizing.orthogonal === 'boolean' ? resizing.orthogonal : true,
|
||||
restrictedResizing: !!resizing.restrict,
|
||||
autoScrollOnResizing:
|
||||
typeof resizing.autoScroll === 'boolean' ? resizing.autoScroll : true,
|
||||
preserveAspectRatio: !!resizing.preserveAspectRatio,
|
||||
allowReverse:
|
||||
typeof resizing.allowReverse === 'boolean'
|
||||
? resizing.allowReverse
|
||||
: true,
|
||||
|
||||
rotatable: rotating.enabled || false,
|
||||
rotatable: !!rotating.enabled,
|
||||
rotateGrid: rotating.grid || 15,
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,11 @@ export class TransformImpl extends View<TransformImpl.EventArgs> {
|
||||
|
||||
render() {
|
||||
this.renderHandles()
|
||||
this.view.addClass(Private.NODE_CLS)
|
||||
|
||||
if (this.view) {
|
||||
this.view.addClass(Private.NODE_CLS)
|
||||
}
|
||||
|
||||
Dom.addClass(this.container, this.containerClassName)
|
||||
Dom.toggleClass(
|
||||
this.container,
|
||||
@ -153,7 +157,9 @@ export class TransformImpl extends View<TransformImpl.EventArgs> {
|
||||
}
|
||||
|
||||
remove() {
|
||||
this.view.removeClass(Private.NODE_CLS)
|
||||
if (this.view) {
|
||||
this.view.removeClass(Private.NODE_CLS)
|
||||
}
|
||||
return super.remove()
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,17 @@
|
||||
## @antv/x6-react-components [2.0.7](https://github.com/antvis/x6/compare/@antv/x6-react-components@2.0.6...@antv/x6-react-components@2.0.7) (2023-01-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* don't hide when click on color picker ([#3172](https://github.com/antvis/x6/issues/3172)) ([cae8625](https://github.com/antvis/x6/commit/cae8625feb20fd93cc8002fa6ed00d345d3cf33c))
|
||||
|
||||
## @antv/x6-react-components [2.0.6](https://github.com/antvis/x6/compare/@antv/x6-react-components@2.0.5...@antv/x6-react-components@2.0.6) (2023-01-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* stop propagation when click menu item ([#3147](https://github.com/antvis/x6/issues/3147)) ([90dad14](https://github.com/antvis/x6/commit/90dad14d7e1ad8639b80b215596c8f4bad7b00ed))
|
||||
|
||||
## @antv/x6-react-components [2.0.5](https://github.com/antvis/x6/compare/@antv/x6-react-components@2.0.4...@antv/x6-react-components@2.0.5) (2022-11-25)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-react-components",
|
||||
"version": "2.0.5",
|
||||
"version": "2.0.7",
|
||||
"description": "React components for building x6 editors",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -37,7 +37,9 @@ export class ColorPicker extends React.Component<
|
||||
|
||||
onDocumentClick = (e: React.MouseEvent) => {
|
||||
const target = e.target as HTMLDivElement
|
||||
if (target === this.container || this.container.contains(target)) {
|
||||
const picker = this.container.querySelector('.sketch-picker')!
|
||||
|
||||
if (target === picker || picker.contains(target)) {
|
||||
return
|
||||
}
|
||||
|
||||
@ -59,12 +61,9 @@ export class ColorPicker extends React.Component<
|
||||
if (this.props.onChange) {
|
||||
this.props.onChange(value, event)
|
||||
}
|
||||
|
||||
this.setState({
|
||||
active: false,
|
||||
color: value.rgb,
|
||||
})
|
||||
this.unbindDocEvent()
|
||||
}
|
||||
|
||||
handleClick = (e: React.MouseEvent) => {
|
||||
@ -84,8 +83,10 @@ export class ColorPicker extends React.Component<
|
||||
}
|
||||
}
|
||||
|
||||
refContainer = (container: HTMLDivElement) => {
|
||||
this.container = container
|
||||
refContainer = (popoverRef: { getContainer: () => HTMLDivElement }) => {
|
||||
if (popoverRef) {
|
||||
this.container = popoverRef.getContainer()
|
||||
}
|
||||
}
|
||||
|
||||
renderPicker() {
|
||||
@ -123,10 +124,12 @@ export class ColorPicker extends React.Component<
|
||||
{...popoverProps}
|
||||
content={this.renderPicker()}
|
||||
overlayClassName={`${baseCls}-overlay`}
|
||||
destroyTooltipOnHide
|
||||
ref={this.refContainer}
|
||||
trigger={[]}
|
||||
>
|
||||
<div
|
||||
style={style}
|
||||
ref={this.refContainer}
|
||||
onClick={this.handleClick}
|
||||
className={classNames(baseCls, {
|
||||
[`${baseCls}-disabled`]: disabled,
|
||||
|
@ -26,6 +26,7 @@ class MenubarItemInner extends React.PureComponent<
|
||||
}
|
||||
|
||||
onClick = (e: React.MouseEvent) => {
|
||||
e.stopPropagation()
|
||||
this.props.context.activeMenubar()
|
||||
this.removeDeactive(e.currentTarget.parentElement)
|
||||
this.active()
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-react-shape",
|
||||
"version": "2.0.7",
|
||||
"version": "2.1.0",
|
||||
"description": "X6 shape for rendering react components.",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -39,8 +39,8 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@antv/x6": "^2.x",
|
||||
"react": ">=16.8.6 || >=17.0.0 || >=18.0.0",
|
||||
"react-dom": ">=16.8.6 || >=17.0.0 || >= 18.0.0"
|
||||
"react": ">=18.0.0",
|
||||
"react-dom": ">= 18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antv/x6": "^2.x",
|
||||
|
@ -1,14 +1,11 @@
|
||||
import React, { ReactPortal, version as reactVersion } from 'react'
|
||||
import ReactDOM, { createPortal } from 'react-dom'
|
||||
import type { Root, createRoot as CreateRoot } from 'react-dom/client'
|
||||
import React, { ReactPortal } from 'react'
|
||||
import { createPortal } from 'react-dom'
|
||||
import { createRoot, Root } from 'react-dom/client'
|
||||
import { Dom, NodeView } from '@antv/x6'
|
||||
import { ReactShape } from './node'
|
||||
import { Portal } from './portal'
|
||||
import { Wrap } from './wrap'
|
||||
|
||||
const [, major] = /^(\d+)\.\d+\.\d+$/.exec(reactVersion)!
|
||||
const reactMajor = Number(major)
|
||||
const isPreEighteen = reactMajor < 18
|
||||
export class ReactShapeView extends NodeView<ReactShape> {
|
||||
root?: Root
|
||||
|
||||
@ -29,36 +26,22 @@ export class ReactShapeView extends NodeView<ReactShape> {
|
||||
const node = this.cell
|
||||
|
||||
if (container) {
|
||||
const graph = node.model ? node.model.graph : null
|
||||
// Actually in the dnd plugin, this graph is empty,
|
||||
// in order to make the external perception type of graph is a graph, rather than graph | null, so hack this.
|
||||
const elem = React.createElement(Wrap, { node, graph: graph! })
|
||||
const elem = React.createElement(Wrap, { node, graph: this.graph })
|
||||
if (Portal.isActive()) {
|
||||
const portal = createPortal(elem, container) as ReactPortal
|
||||
Portal.connect(this.cell.id, portal)
|
||||
} else {
|
||||
if (isPreEighteen) {
|
||||
ReactDOM.render(elem, container)
|
||||
} else {
|
||||
// eslint-disable-next-line
|
||||
const createRoot = require('react-dom/client')
|
||||
.createRoot as typeof CreateRoot
|
||||
this.root = createRoot(container)
|
||||
this.root.render(elem)
|
||||
}
|
||||
this.root = createRoot(container)
|
||||
this.root.render(elem)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected unmountReactComponent() {
|
||||
const container = this.getComponentContainer()
|
||||
if (container) {
|
||||
if (isPreEighteen) {
|
||||
ReactDOM.unmountComponentAtNode(container)
|
||||
} else if (this.root) {
|
||||
this.root.unmount()
|
||||
this.root = undefined
|
||||
}
|
||||
if (container && this.root) {
|
||||
this.root.unmount()
|
||||
this.root = undefined
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,17 @@
|
||||
## @antv/x6-vue-shape [2.0.9](https://github.com/antvis/x6/compare/@antv/x6-vue-shape@2.0.8...@antv/x6-vue-shape@2.0.9) (2022-12-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* get graph from right place ([#3078](https://github.com/antvis/x6/issues/3078)) ([844ee5f](https://github.com/antvis/x6/commit/844ee5fa043cbcd788ec1693f88576e797426228))
|
||||
|
||||
## @antv/x6-vue-shape [2.0.7](https://github.com/antvis/x6/compare/@antv/x6-vue-shape@2.0.6...@antv/x6-vue-shape@2.0.7) (2022-12-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* cannot read properties of undefined when unmount vue component ([#3024](https://github.com/antvis/x6/issues/3024)) ([187e318](https://github.com/antvis/x6/commit/187e318aee8622591781d3b8fc45d72a4d54a989))
|
||||
|
||||
## @antv/x6-vue-shape [2.0.4](https://github.com/antvis/x6/compare/@antv/x6-vue-shape@2.0.3...@antv/x6-vue-shape@2.0.4) (2022-11-25)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6-vue-shape",
|
||||
"version": "2.0.4",
|
||||
"version": "2.0.9",
|
||||
"description": "X6 shape for rendering vue components.",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { defineComponent, h, reactive, isVue3, Vue } from 'vue-demi'
|
||||
import { Graph } from '@antv/x6'
|
||||
import { VueShape } from './node'
|
||||
|
||||
let active = false
|
||||
@ -9,6 +10,7 @@ export function connect(
|
||||
component: any,
|
||||
container: HTMLDivElement,
|
||||
node: VueShape,
|
||||
graph: Graph,
|
||||
) {
|
||||
if (active) {
|
||||
const { Teleport, markRaw } = Vue as any
|
||||
@ -17,6 +19,7 @@ export function connect(
|
||||
render: () => h(Teleport, { to: container } as any, [h(component)]),
|
||||
provide: () => ({
|
||||
getNode: () => node,
|
||||
getGraph: () => graph,
|
||||
}),
|
||||
}),
|
||||
)
|
||||
|
@ -8,7 +8,7 @@ export class VueShapeView extends NodeView<VueShape> {
|
||||
private vm: any
|
||||
|
||||
getComponentContainer() {
|
||||
return this.selectors.foContent as HTMLDivElement
|
||||
return this.selectors && (this.selectors.foContent as HTMLDivElement)
|
||||
}
|
||||
|
||||
confirmUpdate(flag: number) {
|
||||
@ -26,6 +26,7 @@ export class VueShapeView extends NodeView<VueShape> {
|
||||
this.unmountVueComponent()
|
||||
const root = this.getComponentContainer()
|
||||
const node = this.cell
|
||||
const graph = this.graph
|
||||
|
||||
if (root) {
|
||||
const { component } = shapeMaps[node.shape]
|
||||
@ -40,12 +41,13 @@ export class VueShapeView extends NodeView<VueShape> {
|
||||
provide() {
|
||||
return {
|
||||
getNode: () => node,
|
||||
getGraph: () => graph,
|
||||
}
|
||||
},
|
||||
})
|
||||
} else if (isVue3) {
|
||||
if (isActive()) {
|
||||
connect(this.targetId(), component, root, node)
|
||||
connect(this.targetId(), component, root, node, graph)
|
||||
} else {
|
||||
this.vm = createApp({
|
||||
render() {
|
||||
@ -54,6 +56,7 @@ export class VueShapeView extends NodeView<VueShape> {
|
||||
provide() {
|
||||
return {
|
||||
getNode: () => node,
|
||||
getGraph: () => graph,
|
||||
}
|
||||
},
|
||||
})
|
||||
@ -71,7 +74,9 @@ export class VueShapeView extends NodeView<VueShape> {
|
||||
isVue3 && this.vm.unmount()
|
||||
this.vm = null
|
||||
}
|
||||
root.innerHTML = ''
|
||||
if (root) {
|
||||
root.innerHTML = ''
|
||||
}
|
||||
return root
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,88 @@
|
||||
# @antv/x6 [2.3.0](https://github.com/antvis/x6/compare/@antv/x6@2.2.1...@antv/x6@2.3.0) (2023-02-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **scheduler:** remove spammy console.log ([#3200](https://github.com/antvis/x6/issues/3200)) ([1f83a2b](https://github.com/antvis/x6/commit/1f83a2b8a84b53303293e724e7f9d0ee49182efc))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add options for positionCell api ([#3208](https://github.com/antvis/x6/issues/3208)) ([58c0fe4](https://github.com/antvis/x6/commit/58c0fe459c0314997440b4af7dc0443abe199924))
|
||||
|
||||
## @antv/x6 [2.2.1](https://github.com/antvis/x6/compare/@antv/x6@2.2.0...@antv/x6@2.2.1) (2023-02-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* ensure the container in html view ([#3196](https://github.com/antvis/x6/issues/3196)) ([3a59703](https://github.com/antvis/x6/commit/3a59703f1c2da3ac8c8471eb9b864ac4cf468f97))
|
||||
|
||||
# @antv/x6 [2.2.0](https://github.com/antvis/x6/compare/@antv/x6@2.1.7...@antv/x6@2.2.0) (2023-01-31)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add port events ([#3185](https://github.com/antvis/x6/issues/3185)) ([3265fe5](https://github.com/antvis/x6/commit/3265fe5b983f22e34d60c647212824961ecfdab5))
|
||||
|
||||
## @antv/x6 [2.1.6](https://github.com/antvis/x6/compare/@antv/x6@2.1.5...@antv/x6@2.1.6) (2023-01-19)
|
||||
|
||||
## @antv/x6 [2.1.5](https://github.com/antvis/x6/compare/@antv/x6@2.1.4...@antv/x6@2.1.5) (2023-01-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* update group even group is empty ([#3117](https://github.com/antvis/x6/issues/3117)) ([6abd068](https://github.com/antvis/x6/commit/6abd0683eab22eb0fa1a4702642ab76b91320694))
|
||||
|
||||
## @antv/x6 [2.1.4](https://github.com/antvis/x6/compare/@antv/x6@2.1.3...@antv/x6@2.1.4) (2023-01-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* optimize rendering logic to prevent loops ([#3108](https://github.com/antvis/x6/issues/3108)) ([45337e4](https://github.com/antvis/x6/commit/45337e4a62224aaffd60fc8b2670a071c5560796))
|
||||
|
||||
## @antv/x6 [2.1.3](https://github.com/antvis/x6/compare/@antv/x6@2.1.2...@antv/x6@2.1.3) (2022-12-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* schedule edge when source and target is not ready ([#3090](https://github.com/antvis/x6/issues/3090)) ([019333d](https://github.com/antvis/x6/commit/019333d79d7f22c44c400f29d501497f4323af1a))
|
||||
|
||||
## @antv/x6 [2.1.1](https://github.com/antvis/x6/compare/@antv/x6@2.1.0...@antv/x6@2.1.1) (2022-12-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* arrowhead not get options bug ([#3065](https://github.com/antvis/x6/issues/3065)) ([3b668fe](https://github.com/antvis/x6/commit/3b668feb4eac47994f52d0cc977d22a8a2c06acd))
|
||||
* set snapToGrid to false by default ([#3066](https://github.com/antvis/x6/issues/3066)) ([e2bb71d](https://github.com/antvis/x6/commit/e2bb71d95484b29187fafca97f1a386e9b984095))
|
||||
|
||||
# @antv/x6 [2.1.0](https://github.com/antvis/x6/compare/@antv/x6@2.0.9...@antv/x6@2.1.0) (2022-12-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add snapToGrid options for manhattan router ([#3062](https://github.com/antvis/x6/issues/3062)) ([824560d](https://github.com/antvis/x6/commit/824560ddda7016158cce3166773e1af009bfe498))
|
||||
|
||||
## @antv/x6 [2.0.9](https://github.com/antvis/x6/compare/@antv/x6@2.0.8...@antv/x6@2.0.9) (2022-12-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* :bug: char ghosting when edit text ([#2560](https://github.com/antvis/x6/issues/2560)) ([#3043](https://github.com/antvis/x6/issues/3043)) ([15284e7](https://github.com/antvis/x6/commit/15284e778a09f4f2e5a8f777330744b0cfe88e9e))
|
||||
|
||||
## @antv/x6 [2.0.8](https://github.com/antvis/x6/compare/@antv/x6@2.0.7...@antv/x6@2.0.8) (2022-12-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* trigger preventDefault by origin event ([#3017](https://github.com/antvis/x6/issues/3017)) ([4a6a634](https://github.com/antvis/x6/commit/4a6a634a8acfad5c1a7bb93ac17fb3b97239e853))
|
||||
|
||||
## @antv/x6 [2.0.7](https://github.com/antvis/x6/compare/@antv/x6@2.0.6...@antv/x6@2.0.7) (2022-12-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* hide elems when visible is false ([#3007](https://github.com/antvis/x6/issues/3007)) ([057d520](https://github.com/antvis/x6/commit/057d5209ff827d0231ecc6562e768907f75aff2d))
|
||||
|
||||
## @antv/x6 [2.0.4](https://github.com/antvis/x6/compare/@antv/x6@2.0.3...@antv/x6@2.0.4) (2022-11-25)
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@antv/x6",
|
||||
"version": "2.0.6",
|
||||
"version": "2.3.0",
|
||||
"description": "JavaScript diagramming library that uses SVG and HTML for rendering",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
|
@ -58,8 +58,12 @@ export class Graph extends Basecoat<EventArgs> {
|
||||
this.grid = new Grid(this)
|
||||
this.background = new Background(this)
|
||||
|
||||
this.model = this.options.model ? this.options.model : new Model()
|
||||
this.model.graph = this
|
||||
if (this.options.model) {
|
||||
this.model = this.options.model
|
||||
} else {
|
||||
this.model = new Model()
|
||||
this.model.graph = this
|
||||
}
|
||||
|
||||
this.renderer = new ViewRenderer(this)
|
||||
this.panning = new Panning(this)
|
||||
@ -698,8 +702,8 @@ export class Graph extends Basecoat<EventArgs> {
|
||||
/**
|
||||
* Position the center of graph to the center of the viewport.
|
||||
*/
|
||||
center() {
|
||||
return this.centerPoint()
|
||||
center(options?: Transform.CenterOptions) {
|
||||
return this.centerPoint(options)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -708,13 +712,25 @@ export class Graph extends Basecoat<EventArgs> {
|
||||
* only center along the specified dimension and keep the other coordinate
|
||||
* unchanged.
|
||||
*/
|
||||
centerPoint(x: number, y: null | number): this
|
||||
centerPoint(x: null | number, y: number): this
|
||||
centerPoint(): this
|
||||
centerPoint(x?: number | null, y?: number | null) {
|
||||
centerPoint(
|
||||
x: number,
|
||||
y: null | number,
|
||||
options?: Transform.CenterOptions,
|
||||
): this
|
||||
centerPoint(
|
||||
x: null | number,
|
||||
y: number,
|
||||
options?: Transform.CenterOptions,
|
||||
): this
|
||||
centerPoint(optons?: Transform.CenterOptions): this
|
||||
centerPoint(
|
||||
x?: number | null | Transform.CenterOptions,
|
||||
y?: number | null,
|
||||
options?: Transform.CenterOptions,
|
||||
) {
|
||||
const scroller = this.getPlugin<any>('scroller')
|
||||
if (scroller) {
|
||||
scroller.centerPoint(x as number, y as number)
|
||||
scroller.centerPoint(x as number, y as number, options)
|
||||
} else {
|
||||
this.transform.centerPoint(x as number, y as number)
|
||||
}
|
||||
@ -733,10 +749,10 @@ export class Graph extends Basecoat<EventArgs> {
|
||||
return this
|
||||
}
|
||||
|
||||
centerCell(cell: Cell) {
|
||||
centerCell(cell: Cell, options?: Transform.PositionContentOptions) {
|
||||
const scroller = this.getPlugin<any>('scroller')
|
||||
if (scroller) {
|
||||
scroller.centerCell(cell)
|
||||
scroller.centerCell(cell, options)
|
||||
} else {
|
||||
this.transform.centerCell(cell)
|
||||
}
|
||||
@ -748,10 +764,11 @@ export class Graph extends Basecoat<EventArgs> {
|
||||
point: Point.PointLike,
|
||||
x: number | string,
|
||||
y: number | string,
|
||||
options: Transform.CenterOptions = {},
|
||||
) {
|
||||
const scroller = this.getPlugin<any>('scroller')
|
||||
if (scroller) {
|
||||
scroller.positionPoint(point, x, y)
|
||||
scroller.positionPoint(point, x, y, options)
|
||||
} else {
|
||||
this.transform.positionPoint(point, x, y)
|
||||
}
|
||||
@ -759,10 +776,14 @@ export class Graph extends Basecoat<EventArgs> {
|
||||
return this
|
||||
}
|
||||
|
||||
positionRect(rect: Rectangle.RectangleLike, direction: Transform.Direction) {
|
||||
positionRect(
|
||||
rect: Rectangle.RectangleLike,
|
||||
direction: Transform.Direction,
|
||||
options?: Transform.CenterOptions,
|
||||
) {
|
||||
const scroller = this.getPlugin<any>('scroller')
|
||||
if (scroller) {
|
||||
scroller.positionRect(rect, direction)
|
||||
scroller.positionRect(rect, direction, options)
|
||||
} else {
|
||||
this.transform.positionRect(rect, direction)
|
||||
}
|
||||
@ -770,10 +791,14 @@ export class Graph extends Basecoat<EventArgs> {
|
||||
return this
|
||||
}
|
||||
|
||||
positionCell(cell: Cell, direction: Transform.Direction) {
|
||||
positionCell(
|
||||
cell: Cell,
|
||||
direction: Transform.Direction,
|
||||
options?: Transform.CenterOptions,
|
||||
) {
|
||||
const scroller = this.getPlugin<any>('scroller')
|
||||
if (scroller) {
|
||||
scroller.positionCell(cell, direction)
|
||||
scroller.positionCell(cell, direction, options)
|
||||
} else {
|
||||
this.transform.positionCell(cell, direction)
|
||||
}
|
||||
@ -1189,15 +1214,56 @@ export class Graph extends Basecoat<EventArgs> {
|
||||
}
|
||||
|
||||
getPlugin<T extends Graph.Plugin>(pluginName: string): T | undefined {
|
||||
let result: Graph.Plugin | undefined
|
||||
return Array.from(this.installedPlugins).find(
|
||||
(plugin) => plugin.name === pluginName,
|
||||
) as T
|
||||
}
|
||||
|
||||
this.installedPlugins.forEach((plugin) => {
|
||||
if (plugin.name === pluginName) {
|
||||
result = plugin
|
||||
}
|
||||
getPlugins<T extends Graph.Plugin[]>(pluginName: string[]): T | undefined {
|
||||
return Array.from(this.installedPlugins).filter((plugin) =>
|
||||
pluginName.includes(plugin.name),
|
||||
) as T
|
||||
}
|
||||
|
||||
disablePlugins(plugins: string[] | string) {
|
||||
let postPlugins = plugins
|
||||
if (!Array.isArray(postPlugins)) {
|
||||
postPlugins = [postPlugins]
|
||||
}
|
||||
const aboutToChangePlugins = this.getPlugins(postPlugins)
|
||||
aboutToChangePlugins?.forEach((plugin) => {
|
||||
plugin?.disable?.()
|
||||
})
|
||||
return this
|
||||
}
|
||||
|
||||
return result as T
|
||||
enablePlugins(plugins: string[] | string) {
|
||||
let postPlugins = plugins
|
||||
if (!Array.isArray(postPlugins)) {
|
||||
postPlugins = [postPlugins]
|
||||
}
|
||||
const aboutToChangePlugins = this.getPlugins(postPlugins)
|
||||
aboutToChangePlugins?.forEach((plugin) => {
|
||||
plugin?.enable?.()
|
||||
})
|
||||
return this
|
||||
}
|
||||
|
||||
disposePlugins(plugins: string[] | string) {
|
||||
let postPlugins = plugins
|
||||
if (!Array.isArray(postPlugins)) {
|
||||
postPlugins = [postPlugins]
|
||||
}
|
||||
const aboutToChangePlugins = this.getPlugins(postPlugins)
|
||||
aboutToChangePlugins?.forEach((plugin) => {
|
||||
plugin.dispose()
|
||||
})
|
||||
return this
|
||||
}
|
||||
|
||||
isPluginEnabled(pluginName: string) {
|
||||
const pluginIns = this.getPlugin(pluginName)
|
||||
return pluginIns?.isEnabled?.()
|
||||
}
|
||||
|
||||
// #endregion
|
||||
@ -1345,5 +1411,8 @@ export namespace Graph {
|
||||
name: string
|
||||
init: (graph: Graph, ...options: any[]) => any
|
||||
dispose: () => void
|
||||
disable?: () => void
|
||||
enable?: () => void
|
||||
isEnabled?: () => boolean
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,8 @@ export namespace Options {
|
||||
|
||||
onPortRendered?: (args: OnPortRenderedArgs) => void
|
||||
onEdgeLabelRendered?: (args: OnEdgeLabelRenderedArgs) => void
|
||||
|
||||
createCellView?: (this: Graph, cell: Cell) => CellView | null | undefined
|
||||
}
|
||||
|
||||
export interface ManualBooleans {
|
||||
|
@ -201,7 +201,7 @@ export class GraphView extends View {
|
||||
}
|
||||
|
||||
if (this.options.preventDefaultMouseDown) {
|
||||
e.preventDefault()
|
||||
evt.preventDefault()
|
||||
}
|
||||
|
||||
const localPoint = this.graph.snapToGrid(e.clientX, e.clientY)
|
||||
@ -213,7 +213,7 @@ export class GraphView extends View {
|
||||
this.options.preventDefaultBlankAction &&
|
||||
['touchstart'].includes(e.type)
|
||||
) {
|
||||
e.preventDefault()
|
||||
evt.preventDefault()
|
||||
}
|
||||
|
||||
this.graph.trigger('blank:mousedown', {
|
||||
|
@ -3,7 +3,9 @@ import { Base } from './base'
|
||||
|
||||
export class VirtualRenderManager extends Base {
|
||||
protected init() {
|
||||
this.resetRenderArea = FunctionExt.debounce(this.resetRenderArea, 200)
|
||||
this.resetRenderArea = FunctionExt.throttle(this.resetRenderArea, 200, {
|
||||
leading: true,
|
||||
})
|
||||
this.resetRenderArea()
|
||||
this.startListening()
|
||||
}
|
||||
|
@ -244,6 +244,13 @@ export class Model extends Basecoat<Model.EventArgs> {
|
||||
return node
|
||||
}
|
||||
|
||||
updateNode(metadata: Node.Metadata, options: Model.SetOptions = {}) {
|
||||
const node = this.createNode(metadata)
|
||||
const prop = node.getProp()
|
||||
node.dispose()
|
||||
return this.updateCell(prop, options)
|
||||
}
|
||||
|
||||
createNode(metadata: Node.Metadata) {
|
||||
return Node.create(metadata)
|
||||
}
|
||||
@ -258,6 +265,13 @@ export class Model extends Basecoat<Model.EventArgs> {
|
||||
return Edge.create(metadata)
|
||||
}
|
||||
|
||||
updateEdge(metadata: Edge.Metadata, options: Model.SetOptions = {}) {
|
||||
const edge = this.createEdge(metadata)
|
||||
const prop = edge.getProp()
|
||||
edge.dispose()
|
||||
return this.updateCell(prop, options)
|
||||
}
|
||||
|
||||
addCell(cell: Cell | Cell[], options: Model.AddOptions = {}) {
|
||||
if (Array.isArray(cell)) {
|
||||
return this.addCells(cell, options)
|
||||
@ -295,6 +309,23 @@ export class Model extends Basecoat<Model.EventArgs> {
|
||||
return this
|
||||
}
|
||||
|
||||
updateCell(prop: Cell.Properties, options: Model.SetOptions = {}): boolean {
|
||||
const existing = prop.id && this.getCell(prop.id)
|
||||
if (existing) {
|
||||
return this.batchUpdate(
|
||||
'update',
|
||||
() => {
|
||||
Object.keys(prop).forEach((key) =>
|
||||
existing.setProp(key, prop[key], options),
|
||||
)
|
||||
return true
|
||||
},
|
||||
prop,
|
||||
)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
removeCell(cellId: string, options?: Collection.RemoveOptions): Cell | null
|
||||
removeCell(cell: Cell, options?: Collection.RemoveOptions): Cell | null
|
||||
removeCell(
|
||||
|
@ -12,3 +12,5 @@ export * from './edge-anchor'
|
||||
export * from './connection-point'
|
||||
export * from './router'
|
||||
export * from './connector'
|
||||
|
||||
export * from './registry'
|
||||
|
@ -71,15 +71,17 @@ export class ObstacleMap {
|
||||
const mapGridSize = this.mapGridSize
|
||||
|
||||
model.getNodes().reduce((map, node) => {
|
||||
const shape = node.shape
|
||||
const excludeShapes = options.excludeShapes
|
||||
const excType = shape ? excludeShapes.includes(shape) : false
|
||||
const excTerminal = excludedTerminals.some((cell) => cell.id === node.id)
|
||||
const excNode = options.excludeNodes.includes(node)
|
||||
const excAncestor = excludedAncestors.includes(node.id)
|
||||
const excHidden = options.excludeHiddenNodes && !node.isVisible()
|
||||
const excluded =
|
||||
excType || excTerminal || excNode || excAncestor || excHidden
|
||||
const excludedTerminal = excludedTerminals.some(
|
||||
(cell) => cell.id === node.id,
|
||||
)
|
||||
const excludedNode = options.excludeNodes.some((item) => {
|
||||
if (typeof item === 'string') {
|
||||
return node.id === item
|
||||
}
|
||||
return item === node
|
||||
})
|
||||
const excludedAncestor = excludedAncestors.includes(node.id)
|
||||
const excluded = excludedTerminal || excludedNode || excludedAncestor
|
||||
|
||||
if (!excluded) {
|
||||
const bbox = node.getBBox().moveAndExpand(options.paddingBox)
|
||||
|
@ -41,20 +41,10 @@ export interface ResolvedOptions {
|
||||
*/
|
||||
excludeTerminals: Edge.TerminalType[]
|
||||
|
||||
/**
|
||||
* Should certain types of nodes not be considered as obstacles?
|
||||
*/
|
||||
excludeShapes: string[]
|
||||
|
||||
/**
|
||||
* Should certain hidden nodes not be considered as obstacles?
|
||||
*/
|
||||
excludeHiddenNodes: boolean
|
||||
|
||||
/**
|
||||
* Should certain nodes not be considered as obstacles?
|
||||
*/
|
||||
excludeNodes: Node[]
|
||||
excludeNodes: (Node | string)[]
|
||||
|
||||
/**
|
||||
* Possible starting directions from a node.
|
||||
@ -132,6 +122,9 @@ export interface ResolvedOptions {
|
||||
) => Point[] | null
|
||||
|
||||
previousDirectionAngle?: number | null
|
||||
|
||||
// Whether the calculation results are aligned with the grid
|
||||
snapToGrid?: boolean
|
||||
}
|
||||
|
||||
export type ManhattanRouterOptions = {
|
||||
@ -145,9 +138,7 @@ export const defaults: ManhattanRouterOptions = {
|
||||
maxDirectionChange: 90,
|
||||
perpendicular: true,
|
||||
excludeTerminals: [],
|
||||
excludeShapes: [], // ['text']
|
||||
excludeNodes: [],
|
||||
excludeHiddenNodes: false,
|
||||
startDirections: ['top', 'right', 'bottom', 'left'],
|
||||
endDirections: ['top', 'right', 'bottom', 'left'],
|
||||
directionMap: {
|
||||
@ -195,6 +186,7 @@ export const defaults: ManhattanRouterOptions = {
|
||||
|
||||
fallbackRouter: orth,
|
||||
draggingRouter: null,
|
||||
snapToGrid: true,
|
||||
}
|
||||
|
||||
export function resolve<T>(
|
||||
|
@ -265,6 +265,32 @@ function findRoute(
|
||||
return null
|
||||
}
|
||||
|
||||
function snap(vertices: Point[], gridSize = 10) {
|
||||
if (vertices.length <= 1) {
|
||||
return vertices
|
||||
}
|
||||
|
||||
for (let i = 0, len = vertices.length; i < len - 1; i += 1) {
|
||||
const first = vertices[i]
|
||||
const second = vertices[i + 1]
|
||||
if (first.x === second.x) {
|
||||
const x = gridSize * Math.round(first.x / gridSize)
|
||||
if (first.x !== x) {
|
||||
first.x = x
|
||||
second.x = x
|
||||
}
|
||||
} else if (first.y === second.y) {
|
||||
const y = gridSize * Math.round(first.y / gridSize)
|
||||
if (first.y !== y) {
|
||||
first.y = y
|
||||
second.y = y
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return vertices
|
||||
}
|
||||
|
||||
export const router: Router.Definition<ManhattanRouterOptions> = function (
|
||||
vertices,
|
||||
optionsRaw,
|
||||
@ -350,5 +376,9 @@ export const router: Router.Definition<ManhattanRouterOptions> = function (
|
||||
newVertices.push(...partialRoute)
|
||||
}
|
||||
|
||||
if (options.snapToGrid) {
|
||||
return snap(newVertices, edgeView.graph.grid.getGridSize())
|
||||
}
|
||||
|
||||
return newVertices
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ class Arrowhead extends ToolsView.ToolItem<EdgeView, Arrowhead.Options> {
|
||||
x: coords.x,
|
||||
y: coords.y,
|
||||
options: {
|
||||
...this.options,
|
||||
toolId: this.cid,
|
||||
},
|
||||
})
|
||||
|
@ -94,6 +94,9 @@ export class CellEditor extends ToolsView.ToolItem<
|
||||
}
|
||||
editor.innerText = text || ''
|
||||
|
||||
// clear display value when edit status because char ghosting.
|
||||
this.setCellText('')
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
@ -102,15 +105,7 @@ export class CellEditor extends ToolsView.ToolItem<
|
||||
const cell = this.cell
|
||||
const value = this.editor.innerText.replace(/\n$/, '') || ''
|
||||
// set value
|
||||
const setText = this.options.setText
|
||||
if (typeof setText === 'function') {
|
||||
FunctionExt.call(setText, this.cellView, {
|
||||
cell: this.cell,
|
||||
value,
|
||||
index: this.labelIndex,
|
||||
distance: this.distance,
|
||||
})
|
||||
}
|
||||
this.setCellText(value)
|
||||
// remove tool
|
||||
cell.removeTool(cell.isEdge() ? 'edge-editor' : 'node-editor')
|
||||
this.undelegateDocumentEvents()
|
||||
@ -141,6 +136,18 @@ export class CellEditor extends ToolsView.ToolItem<
|
||||
selection.addRange(range)
|
||||
}
|
||||
}
|
||||
|
||||
setCellText(value: string) {
|
||||
const setText = this.options.setText
|
||||
if (typeof setText === 'function') {
|
||||
FunctionExt.call(setText, this.cellView, {
|
||||
cell: this.cell,
|
||||
value,
|
||||
index: this.labelIndex,
|
||||
distance: this.distance,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export namespace CellEditor {
|
||||
|
@ -7,7 +7,7 @@ export class JobQueue {
|
||||
private initialTime = Date.now()
|
||||
|
||||
queueJob(job: Job) {
|
||||
if (job.priority === JOB_PRIORITY.PRIOR) {
|
||||
if (job.priority & JOB_PRIORITY.PRIOR) {
|
||||
job.cb()
|
||||
} else {
|
||||
const index = this.findInsertionIndex(job)
|
||||
@ -81,11 +81,20 @@ export class JobQueue {
|
||||
}
|
||||
|
||||
private findInsertionIndex(job: Job) {
|
||||
let start = 0
|
||||
while (this.queue[start] && this.queue[start].priority >= job.priority) {
|
||||
start += 1
|
||||
let left = 0
|
||||
let ins = this.queue.length
|
||||
let right = ins - 1
|
||||
const priority = job.priority
|
||||
while (left <= right) {
|
||||
const mid = ((right - left) >> 1) + left
|
||||
if (priority <= this.queue[mid].priority) {
|
||||
left = mid + 1
|
||||
} else {
|
||||
ins = mid
|
||||
right = mid - 1
|
||||
}
|
||||
}
|
||||
return start
|
||||
return ins
|
||||
}
|
||||
|
||||
private scheduleJob() {
|
||||
@ -135,10 +144,10 @@ export interface Job {
|
||||
}
|
||||
|
||||
export enum JOB_PRIORITY {
|
||||
RenderEdge = 1,
|
||||
RenderNode = 2,
|
||||
Update = 3,
|
||||
PRIOR = 100,
|
||||
RenderEdge = /**/ 1 << 1,
|
||||
RenderNode = /**/ 1 << 2,
|
||||
Update = /* */ 1 << 3,
|
||||
PRIOR = /* */ 1 << 20,
|
||||
}
|
||||
|
||||
// function findInsertionIndex(job: Job) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { KeyValue, Dom, Disposable } from '@antv/x6-common'
|
||||
import { KeyValue, Dom, Disposable, FunctionExt } from '@antv/x6-common'
|
||||
import { Rectangle } from '@antv/x6-geometry'
|
||||
import { Model, Cell } from '../model'
|
||||
import { View, CellView, NodeView, EdgeView } from '../view'
|
||||
@ -8,6 +8,7 @@ import { Graph } from '../graph'
|
||||
|
||||
export class Scheduler extends Disposable {
|
||||
public views: KeyValue<Scheduler.View> = {}
|
||||
public willRemoveViews: KeyValue<Scheduler.View> = {}
|
||||
protected zPivots: KeyValue<Comment>
|
||||
private graph: Graph
|
||||
private renderArea?: Rectangle
|
||||
@ -51,7 +52,7 @@ export class Scheduler extends Disposable {
|
||||
protected onModelReseted({ options }: Model.EventArgs['reseted']) {
|
||||
this.queue.clearJobs()
|
||||
this.removeZPivots()
|
||||
this.removeViews()
|
||||
this.resetViews()
|
||||
this.renderViews(this.model.getCells(), options)
|
||||
}
|
||||
|
||||
@ -59,12 +60,8 @@ export class Scheduler extends Disposable {
|
||||
this.renderViews([cell], options)
|
||||
}
|
||||
|
||||
protected onCellRemoved({ cell, options }: Model.EventArgs['cell:removed']) {
|
||||
const viewItem = this.views[cell.id]
|
||||
if (viewItem) {
|
||||
const view = viewItem.view
|
||||
this.requestViewUpdate(view, Scheduler.FLAG_REMOVE, options)
|
||||
}
|
||||
protected onCellRemoved({ cell }: Model.EventArgs['cell:removed']) {
|
||||
this.removeViews([cell])
|
||||
}
|
||||
|
||||
protected onCellZIndexChanged({
|
||||
@ -181,13 +178,15 @@ export class Scheduler extends Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
this.requestViewUpdate(
|
||||
viewItem.view,
|
||||
flag,
|
||||
options,
|
||||
cell.isNode() ? JOB_PRIORITY.RenderNode : JOB_PRIORITY.RenderEdge,
|
||||
false,
|
||||
)
|
||||
if (viewItem) {
|
||||
this.requestViewUpdate(
|
||||
viewItem.view,
|
||||
flag,
|
||||
options,
|
||||
this.getRenderPriority(viewItem.view),
|
||||
false,
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
this.flush()
|
||||
@ -216,10 +215,43 @@ export class Scheduler extends Disposable {
|
||||
}
|
||||
|
||||
if (result) {
|
||||
console.log('left flag', result) // eslint-disable-line
|
||||
if (
|
||||
cell.isEdge() &&
|
||||
(result & view.getFlag(['source', 'target'])) === 0
|
||||
) {
|
||||
this.queue.queueJob({
|
||||
id,
|
||||
priority: JOB_PRIORITY.RenderEdge,
|
||||
cb: () => {
|
||||
this.updateView(view, flag, options)
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected removeViews(cells: Cell[]) {
|
||||
cells.forEach((cell) => {
|
||||
const id = cell.id
|
||||
const viewItem = this.views[id]
|
||||
|
||||
if (viewItem) {
|
||||
this.willRemoveViews[id] = viewItem
|
||||
delete this.views[id]
|
||||
|
||||
this.queue.queueJob({
|
||||
id,
|
||||
priority: this.getRenderPriority(viewItem.view),
|
||||
cb: () => {
|
||||
this.removeView(viewItem.view)
|
||||
},
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
this.flush()
|
||||
}
|
||||
|
||||
protected flush() {
|
||||
this.graph.options.async
|
||||
? this.queue.queueFlush()
|
||||
@ -232,10 +264,13 @@ export class Scheduler extends Disposable {
|
||||
const viewItem = this.views[ids[i]]
|
||||
if (viewItem && viewItem.state === Scheduler.ViewState.WAITTING) {
|
||||
const { view, flag, options } = viewItem
|
||||
const priority = view.cell.isNode()
|
||||
? JOB_PRIORITY.RenderNode
|
||||
: JOB_PRIORITY.RenderEdge
|
||||
this.requestViewUpdate(view, flag, options, priority, false)
|
||||
this.requestViewUpdate(
|
||||
view,
|
||||
flag,
|
||||
options,
|
||||
this.getRenderPriority(view),
|
||||
false,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -281,23 +316,25 @@ export class Scheduler extends Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
protected removeViews() {
|
||||
Object.keys(this.views).forEach((id) => {
|
||||
const viewItem = this.views[id]
|
||||
protected resetViews() {
|
||||
this.willRemoveViews = { ...this.views }
|
||||
Object.keys(this.willRemoveViews).forEach((id) => {
|
||||
const viewItem = this.willRemoveViews[id]
|
||||
if (viewItem) {
|
||||
this.removeView(viewItem.view.cell)
|
||||
this.removeView(viewItem.view)
|
||||
}
|
||||
})
|
||||
this.views = {}
|
||||
this.willRemoveViews = {}
|
||||
}
|
||||
|
||||
protected removeView(cell: Cell) {
|
||||
const viewItem = this.views[cell.id]
|
||||
if (viewItem) {
|
||||
protected removeView(view: CellView) {
|
||||
const cell = view.cell
|
||||
const viewItem = this.willRemoveViews[cell.id]
|
||||
if (view) {
|
||||
viewItem.view.remove()
|
||||
delete this.views[cell.id]
|
||||
delete this.willRemoveViews[cell.id]
|
||||
}
|
||||
return viewItem.view
|
||||
}
|
||||
|
||||
protected toggleVisible(cell: Cell, visible: boolean) {
|
||||
@ -375,15 +412,22 @@ export class Scheduler extends Disposable {
|
||||
}
|
||||
|
||||
protected createCellView(cell: Cell) {
|
||||
const options = { graph: this.graph }
|
||||
const createViewHook = this.graph.options.createCellView
|
||||
if (createViewHook) {
|
||||
const ret = FunctionExt.call(createViewHook, this.graph, cell)
|
||||
if (ret || ret === null) {
|
||||
return ret
|
||||
}
|
||||
}
|
||||
|
||||
const view = cell.view
|
||||
const options = { graph: this.graph }
|
||||
|
||||
if (view != null && typeof view === 'string') {
|
||||
const def = CellView.registry.get(view)
|
||||
if (def) {
|
||||
return new def(cell, options) // eslint-disable-line new-cap
|
||||
}
|
||||
|
||||
return CellView.registry.onNotFound(view)
|
||||
}
|
||||
|
||||
@ -406,10 +450,12 @@ export class Scheduler extends Disposable {
|
||||
for (let i = 0, n = edges.length; i < n; i += 1) {
|
||||
const edge = edges[i]
|
||||
const viewItem = this.views[edge.id]
|
||||
if (!viewItem) {
|
||||
const edgeView = viewItem.view
|
||||
|
||||
if (!viewItem || !this.isViewMounted(edgeView)) {
|
||||
continue
|
||||
}
|
||||
const edgeView = viewItem.view
|
||||
|
||||
const flagLabels: FlagManager.Action[] = ['update']
|
||||
if (edge.getTargetCell() === cell) {
|
||||
flagLabels.push('target')
|
||||
@ -428,10 +474,39 @@ export class Scheduler extends Disposable {
|
||||
}
|
||||
|
||||
protected isInRenderArea(view: CellView) {
|
||||
return (
|
||||
!this.renderArea ||
|
||||
this.renderArea.isIntersectWithRect(view.cell.getBBox())
|
||||
)
|
||||
if (!this.renderArea) {
|
||||
return true
|
||||
}
|
||||
if (view.isNodeView()) {
|
||||
const node = view.cell
|
||||
return this.renderArea.isIntersectWithRect(node.getBBox())
|
||||
}
|
||||
if (view.isEdgeView()) {
|
||||
const edge = view.cell
|
||||
const sourceCell = edge.getSourceCell()
|
||||
const targetCell = edge.getTargetCell()
|
||||
if (sourceCell) {
|
||||
const sourceViewItem = this.views[sourceCell.id]
|
||||
if (sourceViewItem && !this.isViewMounted(sourceViewItem.view)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if (targetCell) {
|
||||
const targetViewItem = this.views[targetCell.id]
|
||||
if (targetViewItem && !this.isViewMounted(targetViewItem.view)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
protected getRenderPriority(view: CellView) {
|
||||
return view.cell.isNode()
|
||||
? JOB_PRIORITY.RenderNode
|
||||
: JOB_PRIORITY.RenderEdge
|
||||
}
|
||||
|
||||
@Disposable.dispose()
|
||||
|
@ -36,7 +36,8 @@ export namespace HTML {
|
||||
}
|
||||
|
||||
protected renderHTMLComponent() {
|
||||
const container = this.selectors.foContent as Element
|
||||
const container =
|
||||
this.selectors && (this.selectors.foContent as HTMLDivElement)
|
||||
if (container) {
|
||||
Dom.empty(container)
|
||||
const content = shapeMaps[this.cell.shape]
|
||||
|
@ -1398,6 +1398,7 @@ export class EdgeView<
|
||||
}
|
||||
|
||||
onMouseDown(e: Dom.MouseDownEvent, x: number, y: number) {
|
||||
this.notifyMouseDown(e, x, y)
|
||||
this.startEdgeDragging(e, x, y)
|
||||
}
|
||||
|
||||
@ -2191,7 +2192,9 @@ export class EdgeView<
|
||||
for (let i = 0, ii = cells.length; i < ii; i += 1) {
|
||||
const view = graph.findViewByCell(cells[i])
|
||||
|
||||
if (!view) {
|
||||
// Prevent highlighting new edge
|
||||
// Close https://github.com/antvis/X6/issues/2853
|
||||
if (!view || view.cell.id === this.cell.id) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -357,7 +357,12 @@ export class NodeView<
|
||||
|
||||
protected updatePorts() {
|
||||
const groups = this.cell.getParsedGroups()
|
||||
Object.keys(groups).forEach((groupName) => this.updatePortGroup(groupName))
|
||||
const groupList = Object.keys(groups)
|
||||
if (groupList.length === 0) {
|
||||
this.updatePortGroup()
|
||||
} else {
|
||||
groupList.forEach((groupName) => this.updatePortGroup(groupName))
|
||||
}
|
||||
}
|
||||
|
||||
protected updatePortGroup(groupName?: string) {
|
||||
@ -452,6 +457,28 @@ export class NodeView<
|
||||
return { e, x, y, view, node, cell } as NodeView.PositionEventArgs<E>
|
||||
}
|
||||
|
||||
protected getPortEventArgs<E>(
|
||||
e: E,
|
||||
port: string,
|
||||
pos?: { x: number; y: number },
|
||||
) {
|
||||
const view = this // eslint-disable-line
|
||||
const node = view.cell
|
||||
const cell = node
|
||||
if (pos) {
|
||||
return {
|
||||
e,
|
||||
x: pos.x,
|
||||
y: pos.y,
|
||||
view,
|
||||
node,
|
||||
cell,
|
||||
port,
|
||||
} as NodeView.PositionEventArgs<E>
|
||||
}
|
||||
return { e, view, node, cell, port } as NodeView.MouseEventArgs<E>
|
||||
}
|
||||
|
||||
notifyMouseDown(e: Dom.MouseDownEvent, x: number, y: number) {
|
||||
super.onMouseDown(e, x, y)
|
||||
this.notify('node:mousedown', this.getEventArgs(e, x, y))
|
||||
@ -467,19 +494,33 @@ export class NodeView<
|
||||
this.notify('node:mouseup', this.getEventArgs(e, x, y))
|
||||
}
|
||||
|
||||
notifyPortEvent(
|
||||
name: string,
|
||||
e: Dom.EventObject,
|
||||
pos?: { x: number; y: number },
|
||||
) {
|
||||
const port = this.findAttr('port', e.target)
|
||||
if (port) {
|
||||
this.notify(name, this.getPortEventArgs(e, port, pos))
|
||||
}
|
||||
}
|
||||
|
||||
onClick(e: Dom.ClickEvent, x: number, y: number) {
|
||||
super.onClick(e, x, y)
|
||||
this.notify('node:click', this.getEventArgs(e, x, y))
|
||||
this.notifyPortEvent('node:port:click', e, { x, y })
|
||||
}
|
||||
|
||||
onDblClick(e: Dom.DoubleClickEvent, x: number, y: number) {
|
||||
super.onDblClick(e, x, y)
|
||||
this.notify('node:dblclick', this.getEventArgs(e, x, y))
|
||||
this.notifyPortEvent('node:port:dblclick', e, { x, y })
|
||||
}
|
||||
|
||||
onContextMenu(e: Dom.ContextMenuEvent, x: number, y: number) {
|
||||
super.onContextMenu(e, x, y)
|
||||
this.notify('node:contextmenu', this.getEventArgs(e, x, y))
|
||||
this.notifyPortEvent('node:port:contextmenu', e, { x, y })
|
||||
}
|
||||
|
||||
onMouseDown(e: Dom.MouseDownEvent, x: number, y: number) {
|
||||
@ -487,6 +528,7 @@ export class NodeView<
|
||||
return
|
||||
}
|
||||
this.notifyMouseDown(e, x, y)
|
||||
this.notifyPortEvent('node:port:mousedown', e, { x, y })
|
||||
this.startNodeDragging(e, x, y)
|
||||
}
|
||||
|
||||
@ -510,6 +552,7 @@ export class NodeView<
|
||||
})
|
||||
}
|
||||
this.notifyMouseMove(e, x, y)
|
||||
this.notifyPortEvent('node:port:mousemove', e, { x, y })
|
||||
}
|
||||
|
||||
this.setEventData<EventData.Mousemove>(e, data)
|
||||
@ -522,6 +565,7 @@ export class NodeView<
|
||||
this.stopMagnetDragging(e, x, y)
|
||||
} else {
|
||||
this.notifyMouseUp(e, x, y)
|
||||
this.notifyPortEvent('node:port:mouseup', e, { x, y })
|
||||
if (action === 'move') {
|
||||
const meta = data as EventData.Moving
|
||||
const view = meta.targetView || this
|
||||
@ -540,22 +584,26 @@ export class NodeView<
|
||||
onMouseOver(e: Dom.MouseOverEvent) {
|
||||
super.onMouseOver(e)
|
||||
this.notify('node:mouseover', this.getEventArgs(e))
|
||||
this.notifyPortEvent('node:port:mouseover', e)
|
||||
}
|
||||
|
||||
onMouseOut(e: Dom.MouseOutEvent) {
|
||||
super.onMouseOut(e)
|
||||
this.notify('node:mouseout', this.getEventArgs(e))
|
||||
this.notifyPortEvent('node:port:mouseout', e)
|
||||
}
|
||||
|
||||
onMouseEnter(e: Dom.MouseEnterEvent) {
|
||||
this.updateClassName(e)
|
||||
super.onMouseEnter(e)
|
||||
this.notify('node:mouseenter', this.getEventArgs(e))
|
||||
this.notifyPortEvent('node:port:mouseenter', e)
|
||||
}
|
||||
|
||||
onMouseLeave(e: Dom.MouseLeaveEvent) {
|
||||
super.onMouseLeave(e)
|
||||
this.notify('node:mouseleave', this.getEventArgs(e))
|
||||
this.notifyPortEvent('node:port:mouseleave', e)
|
||||
}
|
||||
|
||||
onMouseWheel(e: Dom.EventObject, x: number, y: number, delta: number) {
|
||||
@ -847,7 +895,6 @@ export class NodeView<
|
||||
) {
|
||||
this.graph.model.startBatch('add-edge')
|
||||
const edgeView = this.createEdgeFromMagnet(magnet, x, y)
|
||||
edgeView.notifyMouseDown(e, x, y) // backwards compatibility events
|
||||
edgeView.setEventData(
|
||||
e,
|
||||
edgeView.prepareArrowheadDragging('target', {
|
||||
@ -858,6 +905,7 @@ export class NodeView<
|
||||
}),
|
||||
)
|
||||
this.setEventData<Partial<EventData.Magnet>>(e, { edgeView })
|
||||
edgeView.notifyMouseDown(e, x, y)
|
||||
}
|
||||
|
||||
protected getDefaultEdge(sourceView: CellView, sourceMagnet: Element) {
|
||||
@ -1087,14 +1135,13 @@ export namespace NodeView {
|
||||
interface MagnetEventArgs {
|
||||
magnet: Element
|
||||
}
|
||||
|
||||
export interface MouseEventArgs<E> {
|
||||
e: E
|
||||
node: Node
|
||||
cell: Node
|
||||
view: NodeView
|
||||
port?: string
|
||||
}
|
||||
|
||||
export interface PositionEventArgs<E>
|
||||
extends MouseEventArgs<E>,
|
||||
CellView.PositionEventArgs {}
|
||||
@ -1119,6 +1166,17 @@ export namespace NodeView {
|
||||
'node:mousewheel': PositionEventArgs<Dom.EventObject> &
|
||||
CellView.MouseDeltaEventArgs
|
||||
|
||||
'node:port:click': PositionEventArgs<Dom.ClickEvent>
|
||||
'node:port:dblclick': PositionEventArgs<Dom.DoubleClickEvent>
|
||||
'node:port:contextmenu': PositionEventArgs<Dom.ContextMenuEvent>
|
||||
'node:port:mousedown': PositionEventArgs<Dom.MouseDownEvent>
|
||||
'node:port:mousemove': PositionEventArgs<Dom.MouseMoveEvent>
|
||||
'node:port:mouseup': PositionEventArgs<Dom.MouseUpEvent>
|
||||
'node:port:mouseover': MouseEventArgs<Dom.MouseOverEvent>
|
||||
'node:port:mouseout': MouseEventArgs<Dom.MouseOutEvent>
|
||||
'node:port:mouseenter': MouseEventArgs<Dom.MouseEnterEvent>
|
||||
'node:port:mouseleave': MouseEventArgs<Dom.MouseLeaveEvent>
|
||||
|
||||
'node:customevent': PositionEventArgs<Dom.MouseDownEvent> & {
|
||||
name: string
|
||||
}
|
||||
|
30164
pnpm-lock.yaml
generated
30164
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
packages:
|
||||
- packages/*
|
||||
# - examples/*
|
||||
# - 'sites/*'
|
||||
- examples/*
|
||||
- 'sites/*'
|
||||
|
@ -2,7 +2,7 @@ import fs from 'fs'
|
||||
import path from 'path'
|
||||
import _ from 'lodash'
|
||||
import colors from 'colors/safe.js'
|
||||
import { terser } from 'rollup-plugin-terser'
|
||||
import terser from '@rollup/plugin-terser'
|
||||
import replace from '@rollup/plugin-replace'
|
||||
import resolve from '@rollup/plugin-node-resolve'
|
||||
import commonjs from '@rollup/plugin-commonjs'
|
||||
@ -37,8 +37,8 @@ function makeOutput() {
|
||||
return output
|
||||
}
|
||||
|
||||
export function config(config) {
|
||||
let { plugins = [], output, external = [], ...others } = config || {}
|
||||
export function config(config = {}) {
|
||||
let { plugins = [], output, external = [], ...others } = config
|
||||
if (output == null) {
|
||||
output = makeOutput()
|
||||
}
|
||||
@ -74,10 +74,10 @@ export function config(config) {
|
||||
preventAssignment: true,
|
||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||
}),
|
||||
terser(),
|
||||
terser({ sourceMap: true }),
|
||||
filesize({
|
||||
reporter: [
|
||||
function (options, bundle, result) {
|
||||
async (options, bundle, result) => {
|
||||
return import('boxen').then((mod) => {
|
||||
const boxen = mod.default
|
||||
const primaryColor = options.theme === 'dark' ? 'green' : 'black'
|
||||
|
@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
(cd sites/x6-sites && yarn build)
|
@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
if (!/pnpm/.test(process.env.npm_execpath || '')) {
|
||||
console.warn(
|
||||
`This repository requires using pnpm as the package manager for scripts to work properly.`,
|
||||
)
|
||||
process.exit(1)
|
||||
}
|
@ -1,728 +0,0 @@
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-11-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([31f8960](https://github.com/antvis/x6/commit/31f8960e72b0567bb13683e51db8b97207604c0b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-11-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-11-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-11-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-11-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-11-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-11-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-10-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-09-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.3](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.2...@antv/x6-sites-demos-helper@1.2.3) (2021-09-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 change home path in speedup js ([#1369](https://github.com/antvis/x6/issues/1369)) ([a234833](https://github.com/antvis/x6/commit/a234833240bad1f7d51f0fadf8b9db9392c44064))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-09-22)
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.2](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.1...@antv/x6-sites-demos-helper@1.2.2) (2021-09-13)
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
* update dependencies and fix type errors ([#1103](https://github.com/antvis/x6/issues/1103)) ([056b862](https://github.com/antvis/x6/commit/056b862b4efe7dbdc559cac7194c2453996acc07))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
* update dependencies and fix type errors ([#1103](https://github.com/antvis/x6/issues/1103)) ([056b862](https://github.com/antvis/x6/commit/056b862b4efe7dbdc559cac7194c2453996acc07))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-06-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-05-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix lack of deps in demo ([a6232fc](https://github.com/antvis/x6/commit/a6232fc35934cb6b31e735af040fb8115813bb12))
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-04-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
## @antv/x6-sites-demos-helper [1.2.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.2.0...@antv/x6-sites-demos-helper@1.2.1) (2021-03-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 temporarily disable stackblitz ([d454ba2](https://github.com/antvis/x6/commit/d454ba2d4ae3e45ad2fabc8074c79121abd5de6b))
|
||||
|
||||
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-03-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
|
||||
|
||||
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
|
||||
|
||||
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
|
||||
|
||||
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-22)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
|
||||
|
||||
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-20)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
|
||||
|
||||
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-09)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
|
||||
|
||||
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
|
||||
|
||||
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
|
||||
|
||||
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-05)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
|
||||
|
||||
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-05)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
|
||||
|
||||
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
|
||||
|
||||
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-03)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
|
||||
|
||||
# @antv/x6-sites-demos-helper [1.2.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@1.1.2...@antv/x6-sites-demos-helper@1.2.0) (2021-02-03)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add favicon for demos ([424662a](https://github.com/antvis/x6/commit/424662a9ccbbb21142b217bc256b9cc8242fb101))
|
||||
|
||||
## @antv/x6-sites-demos-helper [0.11.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@0.11.0...@antv/x6-sites-demos-helper@0.11.1) (2021-01-13)
|
||||
|
||||
# @antv/x6-sites-demos-helper [0.11.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@0.10.80...@antv/x6-sites-demos-helper@0.11.0) (2021-01-12)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ auto update dependencies in workspace ([c255b41](https://github.com/antvis/x6/commit/c255b410099c607f535fa359d66f61b4ddaf59d9))
|
||||
|
||||
# @antv/x6-sites-demos-helper [0.11.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@0.10.80...@antv/x6-sites-demos-helper@0.11.0) (2021-01-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ auto update dependencies in workspace ([c255b41](https://github.com/antvis/x6/commit/c255b410099c607f535fa359d66f61b4ddaf59d9))
|
||||
|
||||
## @antv/x6-sites-demos-helper [0.11.1](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@0.11.0...@antv/x6-sites-demos-helper@0.11.1) (2021-01-11)
|
||||
|
||||
# @antv/x6-sites-demos-helper [0.11.0](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@0.10.82...@antv/x6-sites-demos-helper@0.11.0) (2020-12-25)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ auto update dependencies in workspace ([c255b41](https://github.com/antvis/x6/commit/c255b410099c607f535fa359d66f61b4ddaf59d9))
|
||||
|
||||
## @antv/x6-sites-demos-helper [0.10.82](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@0.10.81...@antv/x6-sites-demos-helper@0.10.82) (2020-12-21)
|
||||
|
||||
## @antv/x6-sites-demos-helper [0.10.81](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@0.10.80...@antv/x6-sites-demos-helper@0.10.81) (2020-12-07)
|
||||
|
||||
## @antv/x6-sites-demos-helper [0.10.80](https://github.com/antvis/x6/compare/@antv/x6-sites-demos-helper@0.10.79...@antv/x6-sites-demos-helper@0.10.80) (2020-11-20)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* 🛠️ init changelog ([6c38b3c](https://github.com/antvis/x6/commit/6c38b3c74c0d603b4e8a50c7ad32e38292d2639b))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* force release 1.0
|
@ -1,128 +0,0 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const fse = require('fs-extra')
|
||||
|
||||
module.exports = () => {
|
||||
if (this.cacheable) {
|
||||
this.cacheable()
|
||||
}
|
||||
|
||||
const repo = fs.realpathSync(process.cwd())
|
||||
const parts = repo.split('/')
|
||||
const index = parts.indexOf('sites')
|
||||
const dirname = parts.slice(index).join('/')
|
||||
const host = `https://github.com/antvis/X6/tree/master/${dirname}`
|
||||
|
||||
const pkg = fse.readJsonSync(path.join(repo, 'package.json'))
|
||||
|
||||
const excluedDeps = ['codesandbox', '@antv/x6-sites-demos-helper']
|
||||
const excludeDirs = ['node_modules']
|
||||
const excludeFiles = [
|
||||
'.env',
|
||||
'.DS_Store',
|
||||
'package.json',
|
||||
'yarn-error.log',
|
||||
'src/react-app-env.d.ts',
|
||||
'src/data.ts',
|
||||
'src/toolbar.css',
|
||||
'src/toolbar.tsx',
|
||||
]
|
||||
|
||||
const result = { files: {} }
|
||||
|
||||
function updatePackageJson() {
|
||||
delete pkg.name
|
||||
delete pkg.version
|
||||
delete pkg.private
|
||||
|
||||
excluedDeps.forEach((dep) => {
|
||||
delete pkg.dependencies[dep]
|
||||
delete pkg.devDependencies[dep]
|
||||
})
|
||||
|
||||
pkg.scripts = {
|
||||
start: 'react-scripts start',
|
||||
build: 'react-scripts build',
|
||||
test: 'react-scripts test',
|
||||
eject: 'react-scripts eject',
|
||||
}
|
||||
|
||||
result.files['package.json'] = {
|
||||
isBinary: false,
|
||||
content: JSON.stringify(pkg, null, 2),
|
||||
}
|
||||
}
|
||||
|
||||
function getEntry() {
|
||||
return `import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import App from './app'
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById('root'))`
|
||||
}
|
||||
|
||||
function readFiles(dir, parent) {
|
||||
const files = fs.readdirSync(dir)
|
||||
if (files) {
|
||||
files.forEach((filename) => {
|
||||
const filepath = path.join(dir, filename)
|
||||
const child = path.join(parent || '', filename)
|
||||
|
||||
const stats = fs.statSync(filepath)
|
||||
if (stats) {
|
||||
if (stats.isDirectory() && !excludeDirs.includes(child)) {
|
||||
readFiles(filepath, child)
|
||||
} else if (stats.isFile() && !excludeFiles.includes(child)) {
|
||||
const key = path.relative(repo, filepath)
|
||||
let content = fs.readFileSync(filepath, { encoding: 'utf8' })
|
||||
if (child === 'src/index.tsx') {
|
||||
content = getEntry()
|
||||
}
|
||||
|
||||
result.files[key] = { content, isBinary: false }
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// stackblitz
|
||||
// ----------
|
||||
|
||||
function getStackblitzPrefillConfig() {
|
||||
const idx = parts.indexOf('packages')
|
||||
const title = parts.slice(idx + 1).join('/')
|
||||
const config = {
|
||||
title: title || '',
|
||||
description: '',
|
||||
template: 'create-react-app',
|
||||
dependencies: pkg.dependencies,
|
||||
files: {},
|
||||
}
|
||||
|
||||
Object.keys(result.files).forEach((name) => {
|
||||
const item = result.files[name]
|
||||
config.files[name] = item.content
|
||||
})
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
// return
|
||||
// ------
|
||||
|
||||
updatePackageJson()
|
||||
readFiles(repo)
|
||||
|
||||
return `
|
||||
export const host = '${host}'
|
||||
|
||||
export function getCodeSandboxParams () {
|
||||
return ${JSON.stringify(result)}
|
||||
}
|
||||
|
||||
export function getStackblitzPrefillConfig () {
|
||||
return ${JSON.stringify(getStackblitzPrefillConfig())}
|
||||
}
|
||||
`
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@antv/x6-sites-demos-helper",
|
||||
"version": "2.0.0",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
"bin": {
|
||||
"config": "./scripts/config.js",
|
||||
"static": "./scripts/static.js",
|
||||
"prepare": "./scripts/prepare.js",
|
||||
"speedup": "./scripts/speedup.js"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf es lib",
|
||||
"lint": "run-s lint:ts lint:style",
|
||||
"lint:ts": "eslint 'src/**/*.{js,ts}?(x)' --fix",
|
||||
"lint:style": "stylelint 'src/**/*.less' --syntax less --fix",
|
||||
"build:esm": "tsc --module esnext --target es2015 --outDir ./es",
|
||||
"build:cjs": "tsc --module commonjs --target es5 --outDir ./lib",
|
||||
"build:less": "node ./scripts/style",
|
||||
"build:watch": "run-s 'build:esm --w'",
|
||||
"build:watch:esm": "run-s 'build:esm --w'",
|
||||
"build:watch:cjs": "run-s 'build:cjs --w'",
|
||||
"build:dev": "run-p build:cjs build:esm build:less",
|
||||
"build": "run-p build:cjs build:esm build:less",
|
||||
"prebuild": "run-s lint clean"
|
||||
},
|
||||
"lint-staged": {
|
||||
"src/**/*.ts": [
|
||||
"eslint --fix"
|
||||
],
|
||||
"src/**/*.less": [
|
||||
"stylelint --syntax less --fix"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^4.2.1",
|
||||
"@stackblitz/sdk": "^1.4.0",
|
||||
"antd": "^5.0.0",
|
||||
"chalk": "^4.1.0",
|
||||
"codesandbox": "^2.2.1",
|
||||
"folder-hash": "^3.3.2",
|
||||
"ora": "^5.0.0",
|
||||
"react-helmet": "^6.0.0",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.0.0",
|
||||
"@types/react-dom": "^18.0.0",
|
||||
"@types/react-helmet": "^6.0.0",
|
||||
"@types/node": "^16.9.1",
|
||||
"fs-extra": "^10.0.0",
|
||||
"less": "^4.1.1",
|
||||
"lint-staged": "^11.1.2",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.4.0",
|
||||
"pretty-quick": "^3.1.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"ts-node": "^10.2.1",
|
||||
"typescript": "^4.4.3"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
@ -1,288 +0,0 @@
|
||||
<div
|
||||
id="loading"
|
||||
style="
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 9999;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #fff;
|
||||
border: 1px solid #f0f0f0;
|
||||
"
|
||||
>
|
||||
<style>
|
||||
.loader {
|
||||
--duration: 3s;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
margin: 0 16px;
|
||||
}
|
||||
.loader:before {
|
||||
content: ' ';
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
display: block;
|
||||
background: #ff700a;
|
||||
top: 37px;
|
||||
left: 19px;
|
||||
-webkit-transform: translate(-18px, -18px);
|
||||
transform: translate(-18px, -18px);
|
||||
-webkit-animation: dotRect var(--duration)
|
||||
cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
||||
animation: dotRect var(--duration) cubic-bezier(0.785, 0.135, 0.15, 0.86)
|
||||
infinite;
|
||||
}
|
||||
.loader svg {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.loader svg rect,
|
||||
.loader svg polygon,
|
||||
.loader svg circle {
|
||||
fill: none;
|
||||
stroke-width: 10px;
|
||||
stroke-linejoin: round;
|
||||
stroke-linecap: round;
|
||||
}
|
||||
.loader svg polygon {
|
||||
stroke-dasharray: 145 76 145 76;
|
||||
stroke-dashoffset: 0;
|
||||
-webkit-animation: pathTriangle var(--duration)
|
||||
cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
||||
animation: pathTriangle var(--duration)
|
||||
cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
||||
}
|
||||
.loader svg rect {
|
||||
stroke-dasharray: 192 64 192 64;
|
||||
stroke-dashoffset: 0;
|
||||
-webkit-animation: pathRect 3s cubic-bezier(0.785, 0.135, 0.15, 0.86)
|
||||
infinite;
|
||||
animation: pathRect 3s cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
||||
}
|
||||
.loader svg circle {
|
||||
stroke-dasharray: 150 50 150 50;
|
||||
stroke-dashoffset: 75;
|
||||
-webkit-animation: pathCircle var(--duration)
|
||||
cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
||||
animation: pathCircle var(--duration)
|
||||
cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
||||
}
|
||||
.loader.triangle {
|
||||
width: 48px;
|
||||
}
|
||||
.loader.triangle:before {
|
||||
left: 21px;
|
||||
-webkit-transform: translate(-10px, -18px);
|
||||
transform: translate(-10px, -18px);
|
||||
-webkit-animation: dotTriangle var(--duration)
|
||||
cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
||||
animation: dotTriangle var(--duration)
|
||||
cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite;
|
||||
}
|
||||
@-webkit-keyframes pathTriangle {
|
||||
33% {
|
||||
stroke-dashoffset: 74;
|
||||
}
|
||||
66% {
|
||||
stroke-dashoffset: 147;
|
||||
}
|
||||
100% {
|
||||
stroke-dashoffset: 221;
|
||||
}
|
||||
}
|
||||
@keyframes pathTriangle {
|
||||
33% {
|
||||
stroke-dashoffset: 74;
|
||||
}
|
||||
66% {
|
||||
stroke-dashoffset: 147;
|
||||
}
|
||||
100% {
|
||||
stroke-dashoffset: 221;
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes dotTriangle {
|
||||
33% {
|
||||
-webkit-transform: translate(0, 0);
|
||||
transform: translate(0, 0);
|
||||
}
|
||||
66% {
|
||||
-webkit-transform: translate(10px, -18px);
|
||||
transform: translate(10px, -18px);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: translate(-10px, -18px);
|
||||
transform: translate(-10px, -18px);
|
||||
}
|
||||
}
|
||||
@keyframes dotTriangle {
|
||||
33% {
|
||||
-webkit-transform: translate(0, 0);
|
||||
transform: translate(0, 0);
|
||||
}
|
||||
66% {
|
||||
-webkit-transform: translate(10px, -18px);
|
||||
transform: translate(10px, -18px);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: translate(-10px, -18px);
|
||||
transform: translate(-10px, -18px);
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes pathRect {
|
||||
25% {
|
||||
stroke-dashoffset: 64;
|
||||
}
|
||||
50% {
|
||||
stroke-dashoffset: 128;
|
||||
}
|
||||
75% {
|
||||
stroke-dashoffset: 192;
|
||||
}
|
||||
100% {
|
||||
stroke-dashoffset: 256;
|
||||
}
|
||||
}
|
||||
@keyframes pathRect {
|
||||
25% {
|
||||
stroke-dashoffset: 64;
|
||||
}
|
||||
50% {
|
||||
stroke-dashoffset: 128;
|
||||
}
|
||||
75% {
|
||||
stroke-dashoffset: 192;
|
||||
}
|
||||
100% {
|
||||
stroke-dashoffset: 256;
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes dotRect {
|
||||
25% {
|
||||
-webkit-transform: translate(0, 0);
|
||||
transform: translate(0, 0);
|
||||
}
|
||||
50% {
|
||||
-webkit-transform: translate(18px, -18px);
|
||||
transform: translate(18px, -18px);
|
||||
}
|
||||
75% {
|
||||
-webkit-transform: translate(0, -36px);
|
||||
transform: translate(0, -36px);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: translate(-18px, -18px);
|
||||
transform: translate(-18px, -18px);
|
||||
}
|
||||
}
|
||||
@keyframes dotRect {
|
||||
25% {
|
||||
-webkit-transform: translate(0, 0);
|
||||
transform: translate(0, 0);
|
||||
}
|
||||
50% {
|
||||
-webkit-transform: translate(18px, -18px);
|
||||
transform: translate(18px, -18px);
|
||||
}
|
||||
75% {
|
||||
-webkit-transform: translate(0, -36px);
|
||||
transform: translate(0, -36px);
|
||||
}
|
||||
100% {
|
||||
-webkit-transform: translate(-18px, -18px);
|
||||
transform: translate(-18px, -18px);
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes pathCircle {
|
||||
25% {
|
||||
stroke-dashoffset: 125;
|
||||
}
|
||||
50% {
|
||||
stroke-dashoffset: 175;
|
||||
}
|
||||
75% {
|
||||
stroke-dashoffset: 225;
|
||||
}
|
||||
100% {
|
||||
stroke-dashoffset: 275;
|
||||
}
|
||||
}
|
||||
@keyframes pathCircle {
|
||||
25% {
|
||||
stroke-dashoffset: 125;
|
||||
}
|
||||
50% {
|
||||
stroke-dashoffset: 175;
|
||||
}
|
||||
75% {
|
||||
stroke-dashoffset: 225;
|
||||
}
|
||||
100% {
|
||||
stroke-dashoffset: 275;
|
||||
}
|
||||
}
|
||||
.loading-text {
|
||||
text-align: center;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
font-size: 12px;
|
||||
letter-spacing: 0.1em;
|
||||
color: #666;
|
||||
}
|
||||
</style>
|
||||
<div
|
||||
style="
|
||||
display: inline-block;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin: -50px 0 0 -120px;
|
||||
"
|
||||
>
|
||||
<div class="loader">
|
||||
<svg viewBox="0 0 80 80">
|
||||
<defs>
|
||||
<linearGradient
|
||||
id="gradient"
|
||||
x1=".004%"
|
||||
x2="100.131%"
|
||||
y1="49.993%"
|
||||
y2="49.993%"
|
||||
>
|
||||
<stop offset="0%" stop-color="#6500FF"></stop>
|
||||
<stop offset="16%" stop-color="#6A09FF"></stop>
|
||||
<stop offset="43%" stop-color="#7623FF"></stop>
|
||||
<stop offset="77%" stop-color="#8A4CFF"></stop>
|
||||
<stop offset="99%" stop-color="#996BFF"></stop>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<circle
|
||||
id="test"
|
||||
cx="40"
|
||||
cy="40"
|
||||
r="32"
|
||||
stroke="url(#gradient)"
|
||||
></circle>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="loader triangle">
|
||||
<svg viewBox="0 0 86 80">
|
||||
<polygon points="43 8 79 72 7 72" stroke="url(#gradient)"></polygon>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="loader">
|
||||
<svg viewBox="0 0 80 80">
|
||||
<rect x="8" y="8" width="64" height="64" stroke="url(#gradient)"></rect>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="loading-text">
|
||||
<p>Loading...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -1,49 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const path = require('path')
|
||||
const fse = require('fs-extra')
|
||||
|
||||
const cwd = process.cwd()
|
||||
const parts = cwd.split('/')
|
||||
const index = parts.indexOf('packages')
|
||||
if (index > 0) {
|
||||
// rename
|
||||
const name = parts.slice(index + 1).join('.')
|
||||
const pkgpath = path.join(cwd, 'package.json')
|
||||
const pkg = fse.readJsonSync(pkgpath)
|
||||
if (pkg) {
|
||||
pkg.name = `@antv/x6-sites-demos-${name}`
|
||||
}
|
||||
fse.writeJsonSync(pkgpath, pkg, { spaces: 2 })
|
||||
|
||||
// add dependencies to root package.json
|
||||
const root = parts.slice(0, index).join('/')
|
||||
const wspath = path.join(root, 'package.json')
|
||||
const workspace = fse.readJsonSync(wspath)
|
||||
const dependencies = workspace.dependencies || {}
|
||||
let updated = false
|
||||
|
||||
function updateWorkspace(deps) {
|
||||
if (deps != null) {
|
||||
Object.keys(deps).forEach((name) => {
|
||||
if (!dependencies[name]) {
|
||||
dependencies[name] = deps[name]
|
||||
updated = true
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
updateWorkspace(pkg.dependencies)
|
||||
updateWorkspace(pkg.devDependencies)
|
||||
updateWorkspace(pkg.peerDependencies)
|
||||
updateWorkspace(pkg.optionalDependencies)
|
||||
|
||||
if (updated) {
|
||||
workspace.dependencies = {}
|
||||
Object.keys(dependencies)
|
||||
.sort()
|
||||
.forEach((name) => (workspace.dependencies[name] = dependencies[name]))
|
||||
fse.writeJsonSync(wspath, workspace, { spaces: 2 })
|
||||
}
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const repo = fs.realpathSync(process.cwd())
|
||||
const parts = repo.split('/')
|
||||
const index = parts.indexOf('packages')
|
||||
const root = index >= 0 ? parts.slice(0, index).join('/') : repo
|
||||
const configDir = 'node_modules/react-scripts/config'
|
||||
const configFile = path.join(root, configDir, 'webpack.config.js')
|
||||
let content = fs.readFileSync(configFile, { encoding: 'utf8' })
|
||||
const esbuild = `const ESBuildPlugin = require('esbuild-webpack-plugin').default;`
|
||||
|
||||
// 修改 node_modules 下 react-scripts 的配置文件来提升 DEMO 的构建速度
|
||||
if (content.indexOf(esbuild) === -1) {
|
||||
content =
|
||||
esbuild +
|
||||
content
|
||||
// optimization
|
||||
.replace(
|
||||
/(new\s+TerserPlugin[\s\S]*)(new\s+OptimizeCSSAssetsPlugin)/gm,
|
||||
`new ESBuildPlugin(),\n $2`,
|
||||
)
|
||||
// 禁止生成 manifest
|
||||
.replace('new ManifestPlugin({', 'false && new ManifestPlugin({')
|
||||
// 禁止生成 worker
|
||||
.replace(
|
||||
'new WorkboxWebpackPlugin.GenerateSW({',
|
||||
`false && new WorkboxWebpackPlugin.GenerateSW({`,
|
||||
)
|
||||
|
||||
if (process.env.CI !== 'true') {
|
||||
// 本地构建时,将 node_modules/.cache 缓存文件保存为全局缓存。
|
||||
content = content
|
||||
.replace(
|
||||
'module.exports =',
|
||||
`
|
||||
const appName = paths.appPath.replace(/\\//g, '.');
|
||||
const webpackCacheDir = path.join(process.env['HOME'], '.webpack/cache', appName);
|
||||
module.exports =`,
|
||||
)
|
||||
.replace(
|
||||
/cacheDirectory:\s*true,/g,
|
||||
`cacheDirectory: path.join(webpackCacheDir, 'babel-loader'),`,
|
||||
)
|
||||
.replace(
|
||||
'eslintPath: ',
|
||||
`cache: path.join(webpackCacheDir, 'eslint-loader'),
|
||||
eslintPath: `,
|
||||
)
|
||||
}
|
||||
|
||||
fs.writeFileSync(configFile, content, { encoding: 'utf8' })
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const fse = require('fs-extra')
|
||||
const ora = require('ora')
|
||||
const cp = require('child_process')
|
||||
const chalk = require('chalk')
|
||||
const { hashElement } = require('folder-hash')
|
||||
|
||||
const repo = fs.realpathSync(process.cwd())
|
||||
const parts = repo.split('/')
|
||||
const index = parts.indexOf('packages')
|
||||
const dir = parts.slice(index + 1).join('/')
|
||||
const name = parts.slice(index + 1).join('.')
|
||||
const root = parts.slice(0, index).join('/')
|
||||
const home = path.resolve(root, '../../')
|
||||
const staticDir = path.join(root, '../../sites/x6-sites/static/demos')
|
||||
const sourceDir = path.join(repo, 'build')
|
||||
const targetDir = path.join(staticDir, dir)
|
||||
const indexFile = path.join(targetDir, 'index.html')
|
||||
const regex = /<meta\s+name="hash"\s+content="(.*?)"\s*\/>/
|
||||
const readfile = (file) => fs.readFileSync(file, { encoding: 'utf8' })
|
||||
const writefile = (file, content) =>
|
||||
fs.writeFileSync(file, content, { encoding: 'utf8' })
|
||||
const loading = readfile(path.join(__dirname, './loading.html'))
|
||||
|
||||
function getHash() {
|
||||
return Promise.all([
|
||||
hashElement(repo, {
|
||||
folders: {
|
||||
include: ['src'],
|
||||
exclude: ['.*', 'node_modules', 'build'],
|
||||
},
|
||||
}),
|
||||
hashElement(path.join(home, 'sites/x6-sites-demos-helper'), {
|
||||
folders: {
|
||||
include: ['src', 'loaders'],
|
||||
exclude: ['.*', 'node_modules', 'es', 'lib', 'scripts'],
|
||||
},
|
||||
}),
|
||||
hashElement(path.join(home, 'packages/x6/package.json')),
|
||||
])
|
||||
.then((arr) => arr.map((item) => item.hash).join(' '))
|
||||
.then((hash) => Buffer.from(hash).toString('base64'))
|
||||
}
|
||||
|
||||
function exec(hashcode) {
|
||||
let changed = true
|
||||
if (fs.existsSync(indexFile)) {
|
||||
const content = readfile(indexFile)
|
||||
const match = content.match(regex)
|
||||
const previous = match && match[1]
|
||||
changed = previous !== hashcode
|
||||
}
|
||||
|
||||
const pkg = `@antv/x6-sites-demos-${name}`
|
||||
const msg = `${chalk.green('✔')} Deployed "${pkg}"`
|
||||
|
||||
if (changed) {
|
||||
const spinner = ora(`Deploying "${pkg}"`).start()
|
||||
cp.exec('yarn build', { cwd: repo }, (err, stdout) => {
|
||||
if (err) {
|
||||
spinner.stop()
|
||||
console.error(stdout)
|
||||
} else {
|
||||
fse.emptyDirSync(targetDir)
|
||||
fse.moveSync(sourceDir, targetDir, { overwrite: true })
|
||||
|
||||
const raw = readfile(indexFile)
|
||||
const title = `<meta name="hash" content="${hashcode}"/><title>${dir}</title>`
|
||||
const wrap = '<div id="root"></div>'
|
||||
const html = raw
|
||||
.replace(/<title>(.*)<\/title>/, title)
|
||||
.replace(wrap, `${wrap}\n${loading}`)
|
||||
|
||||
writefile(indexFile, html)
|
||||
spinner.stop()
|
||||
console.log(msg)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log(msg)
|
||||
}
|
||||
}
|
||||
|
||||
getHash().then(exec)
|
@ -1,59 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const fse = require('fs-extra')
|
||||
const cp = require('child_process')
|
||||
const os = require('os')
|
||||
|
||||
function compile(source, target) {
|
||||
let cmd = './node_modules/.bin/lessc'
|
||||
if (os.type() === 'Windows_NT') {
|
||||
const cwd = process.cwd()
|
||||
cmd = path.join(cwd, './node_modules/.bin/lessc.cmd')
|
||||
}
|
||||
cp.execFileSync(cmd, [source, target])
|
||||
}
|
||||
|
||||
const cwd = process.cwd()
|
||||
const es = path.join(cwd, 'es')
|
||||
const lib = path.join(cwd, 'lib')
|
||||
const src = path.join(cwd, 'src')
|
||||
|
||||
function toCSSPath(source) {
|
||||
const dir = path.dirname(source)
|
||||
const file = path.basename(source, '.less') + '.css'
|
||||
return path.join(dir, file)
|
||||
}
|
||||
|
||||
// Copy less files
|
||||
function readdir(dir) {
|
||||
const stat = fs.statSync(dir)
|
||||
if (stat) {
|
||||
if (stat.isDirectory()) {
|
||||
fs.readdir(dir, (err, files) => {
|
||||
files.forEach((file) => {
|
||||
readdir(path.join(dir, file))
|
||||
})
|
||||
})
|
||||
} else {
|
||||
const ext = path.extname(dir)
|
||||
if (ext === '.less' || ext === '.css') {
|
||||
fse.copySync(dir, path.join(es, path.relative(src, dir)))
|
||||
fse.copySync(dir, path.join(lib, path.relative(src, dir)))
|
||||
}
|
||||
|
||||
if (ext === '.less') {
|
||||
let source = path.join(es, path.relative(src, dir))
|
||||
let target = toCSSPath(source)
|
||||
compile(dir, target)
|
||||
|
||||
source = path.join(lib, path.relative(src, dir))
|
||||
target = toCSSPath(source)
|
||||
compile(dir, target)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
readdir(src)
|
@ -1,2 +0,0 @@
|
||||
export * from './toolbar'
|
||||
export * from './wrap'
|
@ -1,47 +0,0 @@
|
||||
.demo-toolbar {
|
||||
display: block;
|
||||
padding: 12px 8px;
|
||||
border-bottom: 1px dashed #f0f0f0;
|
||||
opacity: 0.7;
|
||||
transition: opacity 0.3s;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
& > * {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
a {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
form {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
form:active,
|
||||
form:focus,
|
||||
button:active,
|
||||
button:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 0;
|
||||
background: none;
|
||||
border: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.anticon {
|
||||
margin: 0 8px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.anticon:hover {
|
||||
transform: scale(1.25);
|
||||
}
|
||||
}
|
@ -1,117 +0,0 @@
|
||||
import React from 'react'
|
||||
import Icon, {
|
||||
ReloadOutlined,
|
||||
GithubOutlined,
|
||||
CodeSandboxOutlined,
|
||||
} from '@ant-design/icons'
|
||||
import { Tooltip } from 'antd'
|
||||
// import stackblitzSdk from '@stackblitz/sdk'
|
||||
import { getParameters } from 'codesandbox/lib/api/define'
|
||||
import './index.css'
|
||||
|
||||
// eslint-disable-next-line
|
||||
const repo = require('../../loaders/repo.js!./data.js')
|
||||
|
||||
const iconOpenInNewWindow: React.FC = () => (
|
||||
<svg
|
||||
width="15"
|
||||
height="12"
|
||||
viewBox="0 0 15 12"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M14.4545 0H10.5C10.1988 0 10 0.198754 10 0.5C10 0.801246 10.1988 1 10.5 1H13L9.5 4.5L10.5 5.5L14 2V4.5C14 4.80125 14.1988 5 14.5 5C14.8012 5 15 4.80125 15 4.5V0.545455C15 0.244208 14.7558 0 14.4545 0ZM1.73333 1H8.00001V1.86667H1.73333C1.25469 1.86667 0.866667 2.25469 0.866667 2.73333V9.32003C0.866667 9.79868 1.25469 10.1867 1.73333 10.1867H12.1333C12.612 10.1867 13 9.79868 13 9.32004V7.00003H13.8667V9.32004C13.8667 10.2773 13.0906 11.0534 12.1333 11.0534H1.73333C0.776041 11.0534 0 10.2773 0 9.32003V2.73333C0 1.77604 0.77604 1 1.73333 1Z"
|
||||
fill="currentcolor"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
|
||||
// eslint-disable-next-line react/prefer-stateless-function
|
||||
export class Toolbar extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div className="demo-toolbar">
|
||||
<Tooltip
|
||||
placement="bottomLeft"
|
||||
arrowPointAtCenter
|
||||
title="重新加载"
|
||||
mouseEnterDelay={0.5}
|
||||
>
|
||||
<ReloadOutlined
|
||||
onClick={() => {
|
||||
window.location.reload()
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
|
||||
{window.frameElement && (
|
||||
<Tooltip
|
||||
placement="bottomLeft"
|
||||
arrowPointAtCenter
|
||||
title="在新窗口打开"
|
||||
mouseEnterDelay={0.5}
|
||||
>
|
||||
<a
|
||||
href={`${window.location.href}`}
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
<Icon component={iconOpenInNewWindow} />
|
||||
</a>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
<Tooltip
|
||||
placement="bottomLeft"
|
||||
arrowPointAtCenter
|
||||
title="在 Github 中查看"
|
||||
mouseEnterDelay={0.5}
|
||||
>
|
||||
<a href={`${repo.host}`} rel="noopener noreferrer" target="_blank">
|
||||
<GithubOutlined />
|
||||
</a>
|
||||
</Tooltip>
|
||||
|
||||
<Tooltip
|
||||
arrowPointAtCenter
|
||||
placement="bottomLeft"
|
||||
title="在 CodeSandbox 中打开"
|
||||
mouseEnterDelay={0.5}
|
||||
>
|
||||
<form
|
||||
action="https://codesandbox.io/api/v1/sandboxes/define"
|
||||
method="POST"
|
||||
target="_blank"
|
||||
>
|
||||
<input
|
||||
type="hidden"
|
||||
name="parameters"
|
||||
value={getParameters(repo.getCodeSandboxParams())}
|
||||
/>
|
||||
<button type="submit">
|
||||
<CodeSandboxOutlined />
|
||||
</button>
|
||||
</form>
|
||||
</Tooltip>
|
||||
|
||||
{/* <Tooltip
|
||||
placement="bottomLeft"
|
||||
arrowPointAtCenter
|
||||
title="在 StackBlitz 中打开"
|
||||
mouseEnterDelay={0.5}
|
||||
>
|
||||
<ThunderboltOutlined
|
||||
onClick={() => {
|
||||
stackblitzSdk.openProject(repo.getStackblitzPrefillConfig(), {
|
||||
openFile: 'src/app.tsx',
|
||||
})
|
||||
}}
|
||||
/>
|
||||
</Tooltip> */}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
interface Window {
|
||||
ResizeObserver: any
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
.demo-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: 1px solid #f0f0f0;
|
||||
}
|
@ -1,109 +0,0 @@
|
||||
import React, { PropsWithChildren } from 'react'
|
||||
import { Toolbar } from '../toolbar'
|
||||
import './content.css'
|
||||
|
||||
export class Content extends React.Component<
|
||||
PropsWithChildren<Content.Props>,
|
||||
Content.State
|
||||
> {
|
||||
private container: HTMLDivElement
|
||||
|
||||
constructor(props: Content.Props) {
|
||||
super(props)
|
||||
Content.restoreIframeSize()
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.updateIframeSize()
|
||||
|
||||
if (window.ResizeObserver) {
|
||||
const ro = new window.ResizeObserver(() => {
|
||||
this.updateIframeSize()
|
||||
})
|
||||
ro.observe(this.container)
|
||||
} else {
|
||||
window.addEventListener('resize', () => this.updateIframeSize())
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
const loading = document.getElementById('loading')
|
||||
if (loading && loading.parentNode) {
|
||||
loading.parentNode.removeChild(loading)
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
updateIframeSize() {
|
||||
const iframe = window.frameElement as HTMLIFrameElement
|
||||
if (iframe) {
|
||||
const height = this.container.scrollHeight || this.container.clientHeight
|
||||
|
||||
iframe.style.width = '100%'
|
||||
iframe.style.height = `${height + 16}px`
|
||||
iframe.style.border = '0'
|
||||
iframe.style.overflow = 'hidden'
|
||||
Content.saveIframeSize()
|
||||
}
|
||||
}
|
||||
|
||||
refContainer = (container: HTMLDivElement) => {
|
||||
this.container = container
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="demo-wrap" ref={this.refContainer}>
|
||||
<Toolbar />
|
||||
{this.props.children}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export namespace Content {
|
||||
export interface Props {}
|
||||
export interface State {}
|
||||
}
|
||||
|
||||
export namespace Content {
|
||||
const STORE_KEY = window.location.pathname
|
||||
const STORE_ROOT = 'x6-iframe-size'
|
||||
|
||||
function getData() {
|
||||
const raw = localStorage.getItem(STORE_ROOT)
|
||||
let data
|
||||
if (raw) {
|
||||
try {
|
||||
data = JSON.parse(raw)
|
||||
} catch (error) {
|
||||
// pass
|
||||
}
|
||||
} else {
|
||||
data = {}
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
export function saveIframeSize() {
|
||||
const iframe = window.frameElement as HTMLIFrameElement
|
||||
if (iframe) {
|
||||
const style = iframe.style
|
||||
const size = { width: style.width, height: style.height }
|
||||
const data = getData()
|
||||
data[STORE_KEY] = size
|
||||
localStorage.setItem(STORE_ROOT, JSON.stringify(data))
|
||||
}
|
||||
}
|
||||
|
||||
export function restoreIframeSize() {
|
||||
const iframe = window.frameElement as HTMLIFrameElement
|
||||
if (iframe) {
|
||||
const data = getData()
|
||||
const size = data[STORE_KEY]
|
||||
if (size) {
|
||||
iframe.style.width = size.width || '100%'
|
||||
iframe.style.height = size.height || 'auto'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
import React, { PropsWithChildren } from 'react'
|
||||
import { Alert } from 'antd'
|
||||
import { Helmet } from 'react-helmet'
|
||||
import { Content } from './content'
|
||||
|
||||
export const Wrap: React.FC<PropsWithChildren> = ({ children }) => (
|
||||
<Alert.ErrorBoundary>
|
||||
{process.env.NODE_ENV !== 'development' && (
|
||||
<Helmet>
|
||||
<link rel="icon" href="/favicon-32x32.png" type="image/png" />
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="48x48"
|
||||
href="/icons/icon-48x48.png"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="72x72"
|
||||
href="/icons/icon-72x72.png"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="96x96"
|
||||
href="/icons/icon-96x96.png"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="144x144"
|
||||
href="/icons/icon-144x144.png"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="192x192"
|
||||
href="/icons/icon-192x192.png"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="256x256"
|
||||
href="/icons/icon-256x256.png"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="384x384"
|
||||
href="/icons/icon-384x384.png"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="512x512"
|
||||
href="/icons/icon-512x512.png"
|
||||
/>
|
||||
<link rel="manifest" href="/manifest.webmanifest" />
|
||||
<link rel="sitemap" type="application/xml" href="/sitemap.xml" />
|
||||
</Helmet>
|
||||
)}
|
||||
|
||||
<Content>{children}</Content>
|
||||
</Alert.ErrorBoundary>
|
||||
)
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json"
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user