Compare commits
422 Commits
v1
...
@antv/x6-r
Author | SHA1 | Date | |
---|---|---|---|
b903dc0539 | |||
4c61c7f74d | |||
6f591418d2 | |||
b1ec2def7b | |||
8f57a63206 | |||
23120ffc65 | |||
daac3e5fdc | |||
cbb415fc19 | |||
75ef37b761 | |||
99e2bea2d8 | |||
bd72005ee2 | |||
0cc1d89eec | |||
1ebf0912d1 | |||
da41870afd | |||
db0c31deb0 | |||
a7720251ff | |||
1d64eb7673 | |||
4ebad79e25 | |||
322128bd8f | |||
0ce74d2df1 | |||
ab5d1c7c81 | |||
186e530480 | |||
a486446015 | |||
77d8a88878 | |||
4a89c2b82e | |||
f6d936e4a2 | |||
dfde26b305 | |||
750242ce92 | |||
b884b795a9 | |||
fad7bec85c | |||
7392a48585 | |||
7772e7ffe3 | |||
97e5adf6e9 | |||
04cd9de505 | |||
d3f6f24d92 | |||
cc13d80d76 | |||
d2e53e9b2f | |||
df246b4045 | |||
2f7ed18c4e | |||
2f10b355f0 | |||
76717b5c86 | |||
54844d84e5 | |||
e3514ebe78 | |||
49ecc06fc6 | |||
3d10f1f87d | |||
e5a3753e71 | |||
4873dce11d | |||
db5422cbed | |||
d004701772 | |||
ace4886693 | |||
fac321d103 | |||
80c8fc57b2 | |||
ee1653aecd | |||
3c4d5b837c | |||
c54f9c36c7 | |||
5138562515 | |||
fe09bdd869 | |||
4e8fb533fb | |||
c456b3fc6a | |||
d242751115 | |||
d37d24f08a | |||
94af7fa7ec | |||
ecffe1a2a8 | |||
ada97b98a2 | |||
e05aa85948 | |||
267d986764 | |||
5550fae095 | |||
9535b5abdb | |||
40300a2b00 | |||
880026af6e | |||
f52182038b | |||
506d8c82f1 | |||
c80b178a08 | |||
105657d7c8 | |||
1ffafcea22 | |||
90e41ea109 | |||
93e281e96b | |||
9377ddc0fc | |||
ccfc843405 | |||
225322c8fa | |||
e5a1df27c5 | |||
d3e178fa9c | |||
9f0f7824c9 | |||
5d5b7f872c | |||
95d3b5d5a8 | |||
8638d4310b | |||
3d8f005696 | |||
7c012f7360 | |||
b27dbc0597 | |||
f8ade0388a | |||
abfc46e9a1 | |||
081be08d38 | |||
9a916545a6 | |||
27d6e629d8 | |||
f679f61f0a | |||
59ae500b7a | |||
deaebb5865 | |||
e83f276c50 | |||
ff04337c74 | |||
c3aa0a0d09 | |||
0e09c7902e | |||
09a4ac8b12 | |||
c7150828e2 | |||
ae7ad05d9c | |||
809f12248a | |||
6f317b29ac | |||
3bf8ecb0d9 | |||
7f2af29994 | |||
f12dd86c1d | |||
660bc38c8a | |||
27ceef23c8 | |||
59ae960f5f | |||
f6475d1500 | |||
35760aa08c | |||
431795c953 | |||
94f90f0441 | |||
cbd069a546 | |||
9662b6ea6a | |||
59f685d130 | |||
0741f1545d | |||
a9edde0791 | |||
264b1f3be2 | |||
0e258d0704 | |||
7a7f9b7657 | |||
afe6793ebb | |||
b138432b1f | |||
a35d771ba6 | |||
0b67719e98 | |||
051baa64da | |||
4715334c75 | |||
6bf76575df | |||
8dc4b38520 | |||
f772026b30 | |||
73fc920fa2 | |||
07379c7c18 | |||
32a6db25e8 | |||
70cbc9f4da | |||
3979a2bd13 | |||
8efe4f4347 | |||
5b5f5aa7ea | |||
c9e192f6ed | |||
a58facbeab | |||
f865ca0fea | |||
2d50028394 | |||
882f5dfb89 | |||
f4cd70e75a | |||
4d4d99efd6 | |||
b4c8d917be | |||
c8d7035c25 | |||
c092688eca | |||
8b5f334fee | |||
500d80f505 | |||
3a717260ad | |||
e4d8fe8b9c | |||
17800acd02 | |||
6b96f12f20 | |||
8852666236 | |||
0cab334e4b | |||
530d0961a8 | |||
36a3706145 | |||
69b371268f | |||
273c392ecf | |||
a6712373fc | |||
70b4f292b2 | |||
4485759a31 | |||
e95acaec0d | |||
6b864128fb | |||
b3f484756c | |||
cc080bede2 | |||
a3c2c77202 | |||
c6aee77d01 | |||
61ec648afe | |||
d2d1af4441 | |||
915d6e1af3 | |||
95b529dbb4 | |||
359df181cf | |||
dca56222a4 | |||
f160a692a4 | |||
e1521224ec | |||
5b13832d0d | |||
3244778000 | |||
41ba28ede7 | |||
f4123517e2 | |||
a58cb3d2a4 | |||
c4920f6d4b | |||
a0045ca739 | |||
13c44ebb1f | |||
ffb79054b0 | |||
609a234501 | |||
3287738bc8 | |||
c9559f2f30 | |||
543b5840db | |||
6bae04fb68 | |||
80728ac28f | |||
036a5ff42c | |||
69c4b185c6 | |||
d38f906411 | |||
55a2de96ca | |||
1ed217476f | |||
5bb1d25745 | |||
fe4f7bc4ed | |||
e84c5f76d4 | |||
fbd3241db0 | |||
793363510b | |||
00de968951 | |||
017335a09d | |||
7e98813096 | |||
0de1828a70 | |||
3b06106a16 | |||
56bec163aa | |||
a1bdb18b1d | |||
e6905f29f4 | |||
4f4d437006 | |||
53bcd2b018 | |||
af8c5887b3 | |||
4cee52ee4c | |||
76c86be5aa | |||
cb0b25b8bc | |||
4887763215 | |||
b5d9f5cbc5 | |||
874404088b | |||
e76f9f232c | |||
0e80212d39 | |||
696954cd6a | |||
c8b22bff71 | |||
c5268623d3 | |||
068ead793f | |||
71cffe34c9 | |||
10bb62e414 | |||
dd22dfee1f | |||
1dc3460a6e | |||
a2c5f9e943 | |||
9c1989ad6f | |||
abc29b5e03 | |||
f021b7780e | |||
e502ca2515 | |||
2fa7b6dd10 | |||
ffbaec396c | |||
d087457f9c | |||
6987d9ce64 | |||
fc117fed4c | |||
e5444aeb79 | |||
747374aedc | |||
9b13cb5592 | |||
e18db6403e | |||
ddb695c32e | |||
d7bd568f83 | |||
2710f29204 | |||
82161cee4f | |||
1da55bfda7 | |||
da18f126ea | |||
7824925555 | |||
564d528612 | |||
8cd46c71ae | |||
92ff8df774 | |||
d35dce7550 | |||
814e0dd137 | |||
0187a3ef99 | |||
b5f3cfa204 | |||
9555852298 | |||
5aab87437e | |||
6a3e441829 | |||
2aff4b4cd0 | |||
daa608d283 | |||
6346949636 | |||
5247a13d9b | |||
42eac09b82 | |||
949ebe165f | |||
58c387643e | |||
dbce0166b8 | |||
ee354b5dcd | |||
b1ae57399a | |||
51f86184b0 | |||
0b2048b12c | |||
9cf5d5ef27 | |||
efce3909f0 | |||
bd6b99453d | |||
ffb7ab0a58 | |||
a9ae861096 | |||
45b19dffdb | |||
33ff359afc | |||
1981f02f2e | |||
cbfed9be92 | |||
4a45fa7d38 | |||
db36ec72ad | |||
6e75619d63 | |||
49853bb50f | |||
a02b2fb73b | |||
e223210d49 | |||
ebe723ff0a | |||
7abfe3f30b | |||
f6a3808c9a | |||
5256e41c6f | |||
65764bed3b | |||
e91609877f | |||
f42158cdb5 | |||
f5cc06d69c | |||
4b2f52aa9a | |||
f35dd5d156 | |||
63e600c05b | |||
848c3dc298 | |||
27cc9d8711 | |||
b00cba9b4d | |||
427165a9c8 | |||
df282000cc | |||
fd8d384a29 | |||
660e2d7689 | |||
4e1fb7bef8 | |||
1f8c80265f | |||
6cdecbbba9 | |||
b041423f06 | |||
39279072c3 | |||
8d7550413f | |||
0e39d9447b | |||
223a634b83 | |||
269fae9e5e | |||
8107f6df5d | |||
8a226bbf5d | |||
5ae78077e2 | |||
c9494e7f79 | |||
1e7f132bed | |||
9a1834e808 | |||
6e1bd9b530 | |||
12e4ac55d7 | |||
294672b306 | |||
68c2346e0c | |||
24de1254a1 | |||
88918f7611 | |||
5e102a39c5 | |||
2f310fcceb | |||
40d53355ce | |||
1dcb3d92fd | |||
9fe7cd51a3 | |||
34481de1db | |||
9d597a92da | |||
40f278f064 | |||
f3edbbc95d | |||
50a5dc7cd8 | |||
5aeae976cd | |||
9200e03f52 | |||
6f089f57a8 | |||
48def793ed | |||
bc67848207 | |||
12173bf500 | |||
8d645f980a | |||
1701150042 | |||
6b8d7a4ef2 | |||
8a17bfac81 | |||
14ba132592 | |||
f43e0a5417 | |||
25b238fd0b | |||
bf536778ca | |||
693e351957 | |||
9a95594a72 | |||
b7cef9edd2 | |||
f4c977759f | |||
1f653d27d4 | |||
27f27f1e75 | |||
cff8c126de | |||
346c6a268a | |||
f53f819043 | |||
f351284809 | |||
12c67255ae | |||
7e179844dc | |||
bc5284c6fe | |||
ad63046e89 | |||
12f0345555 | |||
5e0e2acde7 | |||
a10dcdb29f | |||
394c945fa2 | |||
ecfd4263b1 | |||
6ce3980f86 | |||
a09deaadd0 | |||
b8576ce96a | |||
aafdab63ba | |||
41f6b252ac | |||
3700fa683b | |||
f1c80a8cd7 | |||
5a3caed2a4 | |||
a6a2d12b07 | |||
ee7ae2fca9 | |||
425a540f23 | |||
7617efbe40 | |||
55d36e4680 | |||
0aced58056 | |||
9496d1a720 | |||
fcba5e1480 | |||
1436586f85 | |||
825190ee82 | |||
c42c1b21f3 | |||
7a96008010 | |||
237869f496 | |||
7a9f0908d7 | |||
5ae7271a25 | |||
d16066a734 | |||
c32fdfd7f8 | |||
57a50a9dec | |||
23fcea2e8a | |||
c68140504b | |||
ca48de2d7e | |||
690718c18e | |||
aee3666da2 | |||
38c6fd6992 | |||
d1eb01c491 | |||
023b81301e | |||
e8fbcd83fd | |||
10ab981274 | |||
d7cfb6af19 | |||
5ba9b1d2dc | |||
075db14981 | |||
5913369bc5 | |||
445eaf3475 | |||
f07a2eb386 | |||
c1d0fc188e | |||
68c143babf | |||
df11dfbce2 | |||
223cb4330f | |||
9e19ab98b6 | |||
d060d3405f | |||
299b0f7d3d | |||
4e8ef5f5ff | |||
6415927413 |
.codecov.yml.eslintrc.gitignorekarma.conf.jslerna.jsonpackage.jsonpnpm-lock.yamlpnpm-workspace.yamlrollup.config.jsturbo.jsonyarn.lock
.github/workflows
backup
ci.ymlconfig
create-issue-branch.ymldelete-stale-releases.ymldeploy-sites.ymlpr-label-patch-size.ymlpreview.ymlrelease.ymlsync-labels.ymlupdate-authors.ymlupdate-cache.yamlupdate-contributors.ymlupdate-license.yml.husky
.prettierrc.releaserc.stylelintrc.travis.ymlCONTRIBUTING.mdCONTRIBUTING.zh-CN.mdCONTRIBUTORSCONTRIBUTORS.svgREADME.en-us.mdREADME.mdSECURITY.mdconfigs
eslint-config
husky-config
package-json
CHANGELOG.mdangular.jsonantd.json
rollup-config.jsbin
cli.jsoneslint.jsonjest.jsonkarma.jsonkarma.mdless.jsonpackage.jsonreact.jsonrollup.jsonsrc
vue.jsonstylelint-config
examples
x6-app-dag
.editorconfig.eslintrc.gitignore.prettierignore.prettierrc.umirc.tsCHANGELOG.mdREADME.mdtsconfig.jsontypings.d.ts
mock
package.jsonsrc
common
component
constants
layout/header
mock
models
pages
common
canvas-handler
graph-common
hooks
style
utils
component-config-panel
component-tree-panel
component-source-tree
index.lessindex.tsxdag-canvas
bottom-toolbar.lessbottom-toolbar.tsxcanvas-content.lesscanvas-content.tsxcanvas-toolbar.lesscanvas-toolbar.tsxfloating-context-menu.lessfloating-context-menu.tsxgraph-running-status.tsxnode-element.lessnode-element.tsxnode-group.lessnode-group.tsxindex.lessindex.tsx
index.lessindex.tsxelements
context-menu
edge-context-menu
graph-context-menu
node-context-menu
rx-models
x6-app-draw
.editorconfig.env.eslintrc.gitignore.umirc.tsCHANGELOG.mdpackage.json
src
tsconfig.jsontypings.d.tsx6-app-er
.editorconfig.eslintrc.gitignore.prettierignore.prettierrc.umirc.tsCHANGELOG.mdREADME.md
mock
package.jsonsrc/pages
tsconfig.jsontypings.d.tsx6-example-features
CHANGELOG.mdpackage.jsontsconfig.json
src/pages
animation
auto-resize
basic
bus
case
clipboard
connector
dnd
edge
custom-connector.tsxcustom-edge.tsxcustom-marker.tsx
data-mapping
edge-connected.tsxindex.tsxjump-over.tsxloop.tsxloop2.tsxnative-marker.tsxtool
tools.tsxtooltip.tsxvalidate-connection-count.tsxvalidate-connection.tsxembed
expand
fta
graph
group
halo
html
hull
index.lessindex.tsxissues
keyboard
measurement
org
path
performance
ports
position
react
router
scroller
selection
shape
snapline
stencil
table
token
tools
transform
transitions
undo
v2
vector
packages
x6-angular-shape
x6-common
CHANGELOG.mdLICENSEREADME.mdkarma.conf.jspackage.jsontsconfig.json
src
__tests__
color
common
datauri
dom
af.test.tsattr.test.tsclass.test.tscss.test.tsdata.test.tselem.test.tsevent.test.tsmatrix.test.tspath.test.tsprefix.test.tsselection.test.tsstyle.test.tstext.test.tstransform.test.ts
event
function
json
number
object
string
text
unit
vector
algorithm
animation
array
color
common
css-loader
datauri
dictionary
dom
af.tsattr.tsclass.tscss.tsdata.tselem.ts
event
index.tsmain.tsmatrix.tsmousewheel.tspath.tsposition.tsprefix.tsprop.tsselection.tsstyle.tstext.tstransform.tsevent
function
index.tsjson
modifier
number
object
platform
polyfill
size-sensor
string
text
types.tsunit
vector
x6-geometry
x6-plugin-clipboard
x6-plugin-dnd
x6-plugin-export
x6-plugin-history
x6-plugin-keyboard
x6-plugin-minimap
x6-plugin-scroller
x6-plugin-selection
x6-plugin-snapline
x6-plugin-stencil
x6-plugin-transform
x6-react-components
CHANGELOG.mdLICENSEpackage.jsonrollup.config.js
scripts
src
auto-scroll-box
context-menu
dropdown
menu
menubar
scroll-box
split-box
toolbar
x6-react-shape
x6-react
x6-vector
CHANGELOG.mdREADME.mdkarma.conf.jspackage.jsonrollup.config.js
scripts
src
dom
attributes
common
dom.test.tsdom.tsevents
index.tsprimer
affix.test.tsaffix.tsclassname.test.tsclassname.tsdata.test.tsdata.tsindex.tsmemory.test.tsmemory.tsprimer.test.tsprimer.ts
style
transform
types
global
index.tsstruct
box.test.tsbox.tscolor-util.tscolor.test.tscolor.tsmatrix-util.tsmatrix.test.tsmatrix.tsnumber-array.test.tsnumber-array.tspath-array.test.tspath-array.tspoint-array.test.tspoint-array.tspoint.test.tspoint.tstype-array.tsunit-number.test.tsunit-number.tsutil.ts
types
util
vector
a
animate-motion
animate-transform
animate
circle
clippath
common
container
container-mixins.tscontainer.test.tscontainer.tsgeometry.test.tsgeometry.tsreferent.tsvessel-mixins.tsvessel.tsviewbox.test.tsviewbox.tswrapper.ts
defs
desc
ellipse
fe-base
fe-blend
fe-color-matrix
fe-component-transfer
fe-composite
fe-convolve-matrix
fe-diffuse-lighting
fe-displacement-map
fe-distant-light
fe-flood
fe-func-a
fe-func-b
fe-func-g
fe-func-r
fe-gaussian-blur
fe-image
fe-merge-node
fe-merge
fe-morphology
fe-offset
fe-point-light
fe-specular-lighting
fe-spot-light
fe-tile
fe-turbulence
filter
foreignobject
fragment
g
gradient
exts.tsgradient.tslinear-exts.tslinear.test.tslinear.tsoverride.tsradial-exts.tsradial.test.tsradial.tsstop.tstypes.ts
image
index.tsline
marker
mask
metadata
path
pattern
poly
polygon
polyline
rect
script
style
svg
switch
symbol
text
textpath
title
tspan
types
use
vector
bbox.test.tsbbox.tsfillstroke.test.tsfillstroke.tsfont.test.tsfont.tsmixins.tsoverrides.tstransform.test.tstransform.tsvector.test.tsvector.ts
view
x6-vue-shape
x6
CHANGELOG.mdLICENSEREADME.mdkarma.conf.jspackage.jsonrollup.config.js
scripts
src
__tests__/util
addon
common
config
geometry
angle.tscurve.tsellipse.test.tsellipse.tsgeometry.tsindex.tsline.ts
path
point.test.tspoint.tspolyline.tsrectangle.test.tsrectangle.tsutil.tsglobal
graph
background.tsbase.tsclipboard.tscoord.tscss.tsdecorator.tsdefs.tsevents.tsgraph.tsgrid.tshighlight.tshook.tsindex.tsknob.tsminimap.tsmousewheel.tsoptions.tspanning.tsprint.lessprint.tsrenderer.tsscroller.tsselection.tssize.tssnapline.tstransform.tsview.tsvirtual-render.ts
index.lessindex.tslayout
model
registry
attr
background
connection-point
connection-strategy
connector
edge-anchor
filter
grid
highlighter
index.tsmarker
node-anchor
port-label-layout
port-layout
registry.tsrouter
tool
renderer
shape
base.ts
basic
circle.tscylinder.tsellipse.tsimage.tsindex.tspath.tspolygon.tspolyline.tsrect.tsrhombus.tstext-block.tstext.ts
circle.tsedge.tsellipse.tshtml.tsimage.tsindex.tspath.tspoly.tspolygon.tspolyline.tsrect.tsstandard
cylinder.tsedge-doubled.tsedge-shadow.tsempty.tshtml.tsimage-bordered.tsimage-embedded.tsimage-inscribed.tsindex.tsrect-headered.tsutil.ts
text-block.tsutil.tsstyle
types
util
view
scripts
build-appsbuild-demosbuild-devfinalize-release.js
monorepo-semantic-release
package.json
preinstall.jsreleasesync-giteeversion.jssrc
blork.tscommits.tsconfig.tsindex.tslogger.tsmanifest.tsplugin.tsrelease.tsrunner.tsstream.tssynchronizer.tstypes.tstyping.d.tsutil.tsworkspace.ts
tsconfig.jsonyarn.lockx6-build-tools
sites
x6-sites-demos-helper
x6-sites-demos/packages
api
graph
registry
attr
background
connection-point/playground
connector
edge-anchor/playground
edge-tool
anchor
arrowhead
boundary
button-remove
button
custom-arrowhead
custom-vertices
segments
vertices
filter
blur
brightness
contrast
drop-shadow
gray-scale
highlight
hue-rotate
invert
outline
saturate
sepia
grid
node-anchor/playground
node-tool
port-label-layout
port-layout
absolute
ellipse-spread
ellipse
line
side
sin
router
er
manhattan
metro
oneside
orth
random
ui
auto-scrollbox/basic
color-picker/basic
contextmenu/basic
dropdown/basic
menu/basic
menubar/basic
scrollbox/basic
splitbox/basic
toolbar/basic
scene/sankey
tutorial
advanced
animation
along-path
animate-transform
animate
football
signal
ufo
yellow-ball
layout
react
html-shape
react-label-base
react-label-markup
react-port
react-shape
basic
background/playground
clipboard/playground
dnd
edge
connector
custom-marker
labels
native-marker
router
style
vertices
grid/playground
group
collapsable
embed-edge
embedding
expand-shrink
inside
outside
restrict
history/playground
keyboard/playground
minimap/playground
mousewheel/playground
node/style
port
best-practice
connect-to-port
default-port-label
default-port-style
default-port
port-label-layout
port-layout
scroller/playground
selection/playground
snapline/playground
getting-started
background
edge-shape
edge-style
helloworld
node-shape
node-style
transform
intermediate
attrs
edge-relative-position
edge-subelement-labels
ref-elem
ref-node
custom-edge/custom-edge
custom-node/custom-node
edge-labels
append-label
label-attrs
label-markup
label-offset
label-position
label-rotate
events
interacting
marker
custom
image
native
normalize-path
path
tagname
serialization
tools
x6-sites
x6-svg-to-shape
@ -11,11 +11,10 @@ coverage:
|
||||
threshold: 1%
|
||||
flags:
|
||||
- x6
|
||||
x6-vector:
|
||||
x6-common:
|
||||
threshold: 1%
|
||||
target: 80% # will fail a Pull Request if coverage is less than 80%
|
||||
flags:
|
||||
- x6-vector
|
||||
- x6-common
|
||||
x6-geometry:
|
||||
threshold: 1%
|
||||
flags:
|
||||
@ -26,9 +25,9 @@ flags:
|
||||
paths:
|
||||
# filter the folder(s) you wish to measure by that flag
|
||||
- packages/x6
|
||||
x6-vector:
|
||||
x6-common:
|
||||
paths:
|
||||
- packages/x6-vector
|
||||
- packages/x6-common
|
||||
x6-geometry:
|
||||
paths:
|
||||
- packages/x6-geometry
|
||||
|
155
.eslintrc
155
.eslintrc
@ -1,3 +1,156 @@
|
||||
{
|
||||
"extends": "@antv/eslint-config"
|
||||
"root": true,
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"plugins": [
|
||||
"@typescript-eslint",
|
||||
"eslint-comments",
|
||||
"import",
|
||||
"flowtype",
|
||||
"jest",
|
||||
"jsx-a11y",
|
||||
"prettier",
|
||||
"promise",
|
||||
"react",
|
||||
"react-hooks",
|
||||
"unicorn"
|
||||
],
|
||||
"extends": [
|
||||
"airbnb-base",
|
||||
"eslint:recommended",
|
||||
"prettier",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:jsx-a11y/recommended",
|
||||
"plugin:import/errors",
|
||||
"plugin:import/warnings",
|
||||
"plugin:promise/recommended",
|
||||
"plugin:prettier/recommended",
|
||||
"plugin:react/recommended",
|
||||
"plugin:react-hooks/recommended"
|
||||
],
|
||||
"env": {
|
||||
"browser": true,
|
||||
"commonjs": true,
|
||||
"es6": true,
|
||||
"jest": true,
|
||||
"node": true,
|
||||
"mocha": true,
|
||||
"jasmine": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2020,
|
||||
"sourceType": "module",
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
},
|
||||
"requireConfigFile": false
|
||||
},
|
||||
"settings": {
|
||||
"react": {
|
||||
"version": "detect"
|
||||
}
|
||||
},
|
||||
"rules": {
|
||||
"no-bitwise": 0,
|
||||
"no-continue": 0,
|
||||
"no-lonely-if": 0,
|
||||
"no-multi-assign": 0,
|
||||
"no-nested-ternary": 0,
|
||||
"no-inner-declarations": 0,
|
||||
"no-unused-expressions": 0,
|
||||
"max-classes-per-file": 0,
|
||||
"prefer-destructuring": 0,
|
||||
"class-methods-use-this": 0,
|
||||
"implicit-arrow-linebreak": 0,
|
||||
"lines-between-class-members": 0,
|
||||
"@typescript-eslint/lines-between-class-members": 0,
|
||||
"consistent-return": 0,
|
||||
"no-return-assign": [2, "except-parens"],
|
||||
"no-param-reassign": [
|
||||
2,
|
||||
{
|
||||
"props": false
|
||||
}
|
||||
],
|
||||
"no-cond-assign": [2, "except-parens"],
|
||||
"no-console": [
|
||||
2,
|
||||
{
|
||||
"allow": ["warn", "error"]
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-unused-expressions": [
|
||||
2,
|
||||
{
|
||||
"allowShortCircuit": true,
|
||||
"allowTernary": true
|
||||
}
|
||||
],
|
||||
"eqeqeq": [
|
||||
2,
|
||||
"always",
|
||||
{
|
||||
"null": "ignore"
|
||||
}
|
||||
],
|
||||
"func-names": [
|
||||
1,
|
||||
"never",
|
||||
{
|
||||
"generators": "as-needed"
|
||||
}
|
||||
],
|
||||
"import/export": 0,
|
||||
"import/no-cycle": 0,
|
||||
"import/extensions": 0,
|
||||
"import/no-unresolved": 0,
|
||||
"import/prefer-default-export": 0,
|
||||
"import/no-extraneous-dependencies": 0,
|
||||
"promise/always-return": 0,
|
||||
"promise/catch-or-return": 0,
|
||||
"@typescript-eslint/no-namespace": 0,
|
||||
"@typescript-eslint/no-var-requires": 0,
|
||||
"@typescript-eslint/no-explicit-any": 0,
|
||||
"@typescript-eslint/no-non-null-assertion": 0,
|
||||
"@typescript-eslint/no-empty-function": 0,
|
||||
"@typescript-eslint/no-empty-interface": 0,
|
||||
"@typescript-eslint/explicit-module-boundary-types": 0,
|
||||
"no-shadow": 0,
|
||||
"@typescript-eslint/no-shadow": 0,
|
||||
"camelcase": 0,
|
||||
"@typescript-eslint/camelcase": 0,
|
||||
"no-use-before-define": 0,
|
||||
"@typescript-eslint/no-use-before-define": 0,
|
||||
"no-useless-constructor": 0,
|
||||
"@typescript-eslint/no-useless-constructor": 0,
|
||||
"no-unused-vars": 0,
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
2,
|
||||
{
|
||||
"vars": "all",
|
||||
"args": "after-used",
|
||||
"ignoreRestSiblings": true
|
||||
}
|
||||
],
|
||||
"no-redeclare": 0,
|
||||
"@typescript-eslint/no-redeclare": [
|
||||
2,
|
||||
{
|
||||
"ignoreDeclarationMerge": true
|
||||
}
|
||||
],
|
||||
"react/sort-comp": 0,
|
||||
"react/prop-types": 0,
|
||||
"react/jsx-props-no-spreading": 0,
|
||||
"react/destructuring-assignment": 0,
|
||||
"react/no-access-state-in-setstate": 0
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["**/*.js"],
|
||||
"rules": {
|
||||
"no-console": 0,
|
||||
"global-require": 0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
27
.github/workflows/backup/create-release-branch.yml
vendored
Normal file
27
.github/workflows/backup/create-release-branch.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
name: 🚀 Create Release Branch
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
jobs:
|
||||
crb:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: |
|
||||
echo "${{ github.sha }}" > .releasing
|
||||
- uses: wow-actions/use-app-token@v1
|
||||
with:
|
||||
app_id: ${{ secrets.APP_ID }}
|
||||
private_key: ${{ secrets.PRIVATE_KEY }}
|
||||
env_name: bot_token
|
||||
- uses: peter-evans/create-pull-request@v4
|
||||
with:
|
||||
token: ${{ env.bot_token }}
|
||||
branch: semantic-release
|
||||
commit-message: "trigger semantic release..."
|
||||
delete-branch: true
|
||||
labels: semantic-release
|
||||
title: "chore: semantic release [skip ci]"
|
||||
body: |
|
||||
Your **[semantic-release-monorepo](https://github.com/bubkoo/semantic-release-monorepo)** bot base on **[semantic-release](https://github.com/semantic-release/semantic-release)** :package::rocket:`
|
48
.github/workflows/backup/delete-stale-releases.yml
vendored
Normal file
48
.github/workflows/backup/delete-stale-releases.yml
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
name: 🚫 Delete Stale Releases
|
||||
# on:
|
||||
# repository_dispatch:
|
||||
# types: [released]
|
||||
# jobs:
|
||||
# clean:
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: wow-actions/use-app-token@v1
|
||||
# with:
|
||||
# app_id: ${{ secrets.APP_ID }}
|
||||
# private_key: ${{ secrets.PRIVATE_KEY }}
|
||||
# env_name: bot_token
|
||||
# - uses: wow-actions/delete-stale-releases@v1
|
||||
# with:
|
||||
# GITHUB_TOKEN: ${{ env.bot_token }}
|
||||
# delete_tags: true
|
||||
# keep_latest_count: 3
|
||||
# group: '(?!^)@.*$'
|
||||
# exclude: |
|
||||
# @antv/x6@**
|
||||
# @antv/x6-common@**
|
||||
# @antv/x6-geometry@**
|
||||
# @antv/x6-plugin-**@**
|
||||
# @antv/x6-vue-shape@**
|
||||
# @antv/x6-react-shape@**
|
||||
# @antv/x6-angular-shape@**
|
||||
# @antv/x6-react-components@**
|
||||
|
||||
# delete all releases and tag
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
jobs:
|
||||
clean:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: wow-actions/use-app-token@v1
|
||||
with:
|
||||
app_id: ${{ secrets.APP_ID }}
|
||||
private_key: ${{ secrets.PRIVATE_KEY }}
|
||||
env_name: bot_token
|
||||
- uses: wow-actions/delete-stale-releases@v1
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ env.bot_token }}
|
||||
delete_tags: true
|
||||
keep_latest_count: -1
|
@ -1,6 +1,6 @@
|
||||
name: 🥤 GitLeaks
|
||||
on:
|
||||
pull_request_target:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
@ -10,7 +10,7 @@ jobs:
|
||||
gitleaks:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: '1'
|
||||
- name: wget
|
97
.github/workflows/ci.yml
vendored
97
.github/workflows/ci.yml
vendored
@ -10,59 +10,82 @@ on:
|
||||
- beta
|
||||
jobs:
|
||||
ci:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
codecov: [x6, x6-common, x6-geometry]
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
||||
steps:
|
||||
- name: ⤵️ Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: 🎉 Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: 🎉 Setup nodejs
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: 🌱 Get Cache Directory
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: 🚸 Setup Cache
|
||||
uses: actions/cache@v2
|
||||
node-version: 16.x
|
||||
|
||||
- name: 🎉 Setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
version: 7
|
||||
run_install: false
|
||||
|
||||
- name: 🌱 Get pnpm store directory
|
||||
id: pnpm-cache
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: 🚸 Setup pnpm cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: 🚧 Prepare
|
||||
run: yarn global add lerna
|
||||
- name: 🚀 Bootstrap
|
||||
run: yarn bootstrap
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: 🚧 Install
|
||||
run: pnpm install --no-frozen-lockfile --ignore-scripts
|
||||
|
||||
- name: 🚀 Build
|
||||
run: pnpm run build
|
||||
|
||||
- name: ✅ Test
|
||||
run: yarn test
|
||||
run: pnpm run test
|
||||
|
||||
- name: 🔑 Generate Token
|
||||
uses: wow-actions/use-app-token@v1
|
||||
with:
|
||||
app_id: ${{ secrets.APP_ID }}
|
||||
private_key: ${{ secrets.PRIVATE_KEY }}
|
||||
env_name: bot_token
|
||||
- name: 💡 Coveralls
|
||||
uses: coverallsapp/github-action@master
|
||||
with:
|
||||
github-token: ${{ env.bot_token }}
|
||||
path-to-lcov: ./packages/x6/test/coverage/lcov.info
|
||||
- name: 💡 Codecov(x6)
|
||||
|
||||
- name: 💡 Codecov
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: ./packages/x6/test/coverage/lcov.info
|
||||
flags: x6
|
||||
- name: 💡 Codecov(x6-vector)
|
||||
uses: codecov/codecov-action@v1
|
||||
files: ./packages/${{ matrix.codecov }}/test/coverage/lcov.info
|
||||
flags: ${{ matrix.codecov }}
|
||||
|
||||
- name: 🔀 Dispatch(ci_passed)
|
||||
uses: peter-evans/repository-dispatch@v2
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: ./packages/x6-vector/test/coverage/lcov.info
|
||||
flags: x6-vector
|
||||
- name: 💡 Codecov(x6-geometry)
|
||||
uses: codecov/codecov-action@v1
|
||||
token: ${{ env.bot_token }}
|
||||
event-type: ci_passed
|
||||
|
||||
- name: 🔀 Dispatch(ci_pr_passed)
|
||||
if: github.event_name == 'pull_request_target'
|
||||
uses: peter-evans/repository-dispatch@v2
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: ./packages/x6-geometry/test/coverage/lcov.info
|
||||
flags: x6-geometry
|
||||
token: ${{ env.bot_token }}
|
||||
event-type: ci_pr_passed
|
||||
|
||||
- name: 🔀 Dispatch(ci_master_passed)
|
||||
if: github.event_name == 'push'
|
||||
uses: peter-evans/repository-dispatch@v2
|
||||
with:
|
||||
token: ${{ env.bot_token }}
|
||||
event-type: ci_master_passed
|
||||
|
||||
|
3
.github/workflows/config/labels.yml
vendored
3
.github/workflows/config/labels.yml
vendored
@ -138,9 +138,6 @@
|
||||
- name: pkg:x6
|
||||
color: eeeeee
|
||||
description: Denotes a PR that changes packages/x6
|
||||
- name: pkg:x6-react
|
||||
color: eeeeee
|
||||
description: Denotes a PR that changes packages/x6-react
|
||||
- name: pkg:x6-react-shape
|
||||
color: eeeeee
|
||||
description: Denotes a PR that changes packages/x6-react-shape
|
||||
|
1
.github/workflows/create-issue-branch.yml
vendored
1
.github/workflows/create-issue-branch.yml
vendored
@ -6,7 +6,6 @@ jobs:
|
||||
cib:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: wow-actions/use-app-token@v1
|
||||
with:
|
||||
app_id: ${{ secrets.APP_ID }}
|
||||
|
27
.github/workflows/delete-stale-releases.yml
vendored
27
.github/workflows/delete-stale-releases.yml
vendored
@ -1,27 +0,0 @@
|
||||
name: 🚫 Delete Stale Releases
|
||||
on:
|
||||
repository_dispatch:
|
||||
types: [released]
|
||||
jobs:
|
||||
clean:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: wow-actions/use-app-token@v1
|
||||
with:
|
||||
app_id: ${{ secrets.APP_ID }}
|
||||
private_key: ${{ secrets.PRIVATE_KEY }}
|
||||
env_name: bot_token
|
||||
- uses: wow-actions/delete-stale-releases@v1
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ env.bot_token }}
|
||||
delete_tags: true
|
||||
keep_latest_count: 3
|
||||
group: '(?!^)@.*$'
|
||||
exclude: |
|
||||
@antv/x6@**
|
||||
@antv/x6-react@**
|
||||
@antv/x6-vue-shape@**
|
||||
@antv/x6-react-shape@**
|
||||
@antv/x6-angular-shape@**
|
||||
@antv/x6-react-components@**
|
4
.github/workflows/deploy-sites.yml
vendored
4
.github/workflows/deploy-sites.yml
vendored
@ -7,10 +7,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
node-version: [16.x]
|
||||
steps:
|
||||
- name: ⤵️ Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
- name: 🎉 Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
|
3
.github/workflows/pr-label-patch-size.yml
vendored
3
.github/workflows/pr-label-patch-size.yml
vendored
@ -4,7 +4,6 @@ jobs:
|
||||
label:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: wow-actions/use-app-token@v1
|
||||
with:
|
||||
app_id: ${{ secrets.APP_ID }}
|
||||
@ -13,4 +12,4 @@ jobs:
|
||||
- uses: pascalgn/size-label-action@v0.4.3
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ env.bot_token }}
|
||||
IGNORED: "!.gitignore\nyarn.lock"
|
||||
IGNORED: "!.gitignore\nyarn.lock\npnpm-lock.yaml"
|
||||
|
4
.github/workflows/preview.yml
vendored
4
.github/workflows/preview.yml
vendored
@ -11,9 +11,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
node-version: [16.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: 🌱 Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
|
67
.github/workflows/release.yml
vendored
67
.github/workflows/release.yml
vendored
@ -12,32 +12,43 @@ on:
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- name: ⤵️ Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: 🎉 Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: 🎉 Setup nodejs
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: 🌱 Get Cache Directory
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: 🚸 Setup Cache
|
||||
uses: actions/cache@v2
|
||||
node-version: 16.x
|
||||
|
||||
- name: 🎉 Setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
version: 7
|
||||
run_install: false
|
||||
|
||||
- name: 🌱 Get pnpm store directory
|
||||
id: pnpm-cache
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: 🚸 Setup pnpm cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: 🚧 Prepare
|
||||
run: yarn global add lerna
|
||||
- name: 🚀 Bootstrap
|
||||
run: yarn bootstrap
|
||||
- name: ✅ Test
|
||||
run: yarn test
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: 🚧 Install dependencies
|
||||
run: pnpm install --no-frozen-lockfile --ignore-scripts
|
||||
|
||||
# - name: 📦 build
|
||||
# run: pnpm run build
|
||||
|
||||
# - name: ✅ Test
|
||||
# run: pnpm run test
|
||||
|
||||
- name: 🔑 Generate Token
|
||||
uses: wow-actions/use-app-token@v1
|
||||
@ -47,20 +58,26 @@ jobs:
|
||||
env_name: bot_token
|
||||
|
||||
- name: 📦 Semantic Release
|
||||
run: |
|
||||
sh ./scripts/release
|
||||
run: pnpm srm --debug --comment-footer 'Thanks for being a part of the [AntV](https://github.com/antvis) community! 💪💯'
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ env.bot_token }}
|
||||
ACTION_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GIT_AUTHOR_NAME: x6-bot
|
||||
GIT_AUTHOR_EMAIL: x6-bot@users.noreply.github.com
|
||||
GIT_COMMITTER_NAME: x6-bot
|
||||
GIT_COMMITTER_EMAIL: x6-bot@users.noreply.github.com
|
||||
|
||||
# - uses: actions/github-script@v6
|
||||
# with:
|
||||
# github-token: ${{ env.bot_token }}
|
||||
# script: |
|
||||
# const action = require('./scripts/finalize-release.js')
|
||||
# return await action({github, context, core})
|
||||
|
||||
- name: 🔀 Repository Dispatch
|
||||
if: github.ref == 'refs/heads/master'
|
||||
uses: peter-evans/repository-dispatch@v1
|
||||
uses: peter-evans/repository-dispatch@v2
|
||||
with:
|
||||
token: ${{ env.bot_token }}
|
||||
event-type: released
|
||||
|
1
.github/workflows/sync-labels.yml
vendored
1
.github/workflows/sync-labels.yml
vendored
@ -9,7 +9,6 @@ jobs:
|
||||
sync:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: wow-actions/use-app-token@v1
|
||||
with:
|
||||
app_id: ${{ secrets.APP_ID }}
|
||||
|
5
.github/workflows/update-authors.yml
vendored
5
.github/workflows/update-authors.yml
vendored
@ -3,13 +3,15 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- next
|
||||
- next-major
|
||||
- alpha
|
||||
- beta
|
||||
jobs:
|
||||
authors:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: wow-actions/use-app-token@v1
|
||||
@ -20,4 +22,5 @@ jobs:
|
||||
- uses: wow-actions/update-authors@v1
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ env.bot_token }}
|
||||
path: CONTRIBUTORS
|
||||
bots: false
|
||||
|
39
.github/workflows/update-cache.yaml
vendored
39
.github/workflows/update-cache.yaml
vendored
@ -1,39 +0,0 @@
|
||||
# Auto update cahe
|
||||
|
||||
name: 🌈 Update Cache
|
||||
on:
|
||||
pull_request_target:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- next
|
||||
- next-major
|
||||
- alpha
|
||||
- beta
|
||||
jobs:
|
||||
cache:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- name: ⤵️ Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: 🎉 Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: 🌱 Get Cache Directory
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: 🚸 Setup Cache
|
||||
id: cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
- name: 🚧 Update Cache
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
yarn global add lerna
|
||||
lerna bootstrap
|
2
.github/workflows/update-contributors.yml
vendored
2
.github/workflows/update-contributors.yml
vendored
@ -5,6 +5,8 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- next
|
||||
- next-major
|
||||
- alpha
|
||||
- beta
|
||||
jobs:
|
||||
|
2
.github/workflows/update-license.yml
vendored
2
.github/workflows/update-license.yml
vendored
@ -6,7 +6,7 @@ jobs:
|
||||
update:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: wow-actions/use-app-token@v1
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,6 +1,7 @@
|
||||
.DS_Store
|
||||
.vscode
|
||||
.idea
|
||||
.turbo
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
lerna-debug.log
|
||||
@ -11,3 +12,6 @@ es
|
||||
dist
|
||||
*.pem
|
||||
!mock-cert.pem
|
||||
tmp
|
||||
test/coverage
|
||||
packages/**/src/style/raw.ts
|
||||
|
4
.husky/commit-msg
Executable file
4
.husky/commit-msg
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npx @commitlint/cli --edit "$1"
|
4
.husky/pre-commit
Executable file
4
.husky/pre-commit
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npx lint-staged
|
@ -1,5 +1,4 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
. "$(dirname "$0")/common.sh"
|
||||
|
||||
./scripts/pre-push-check
|
@ -9,6 +9,7 @@
|
||||
"overrides": [
|
||||
{ "files": ".eslintrc", "options": { "parser": "json" } },
|
||||
{ "files": ".prettierrc", "options": { "parser": "json" } },
|
||||
{ "files": ".releaserc", "options": { "parser": "json" } },
|
||||
{ "files": ".stylelintrc", "options": { "parser": "json" } }
|
||||
]
|
||||
}
|
||||
|
47
.releaserc
Normal file
47
.releaserc
Normal file
@ -0,0 +1,47 @@
|
||||
{
|
||||
"branches": [
|
||||
"+([0-9])?(.{+([0-9]),x}).x",
|
||||
"master",
|
||||
"next",
|
||||
"next-major",
|
||||
{ "name": "beta", "prerelease": true },
|
||||
{ "name": "alpha", "prerelease": true }
|
||||
],
|
||||
"plugins": [
|
||||
[
|
||||
"@semantic-release/commit-analyzer",
|
||||
{
|
||||
"releaseRules": [
|
||||
{ "type": "build", "release": "patch" },
|
||||
{ "type": "ci", "release": "patch" },
|
||||
{ "type": "chore", "release": "patch" },
|
||||
{ "type": "docs", "release": "patch" },
|
||||
{ "type": "refactor", "release": "patch" },
|
||||
{ "type": "style", "release": "patch" },
|
||||
{ "type": "test", "release": "patch" }
|
||||
]
|
||||
}
|
||||
],
|
||||
"@semantic-release/release-notes-generator",
|
||||
"@semantic-release/changelog",
|
||||
[
|
||||
"@semantic-release/npm",
|
||||
{
|
||||
"npmPublish": false
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/github",
|
||||
{
|
||||
"addReleases": "bottom"
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/git",
|
||||
{
|
||||
"assets": ["package.json", "CHANGELOG.md"],
|
||||
"message": "chore(release): ${nextRelease.gitTag} [skip ci]"
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
19
.stylelintrc
19
.stylelintrc
@ -1,3 +1,20 @@
|
||||
{
|
||||
"extends": ["@antv/stylelint-config"]
|
||||
"extends": [
|
||||
"stylelint-config-standard",
|
||||
"stylelint-config-rational-order",
|
||||
"stylelint-config-prettier"
|
||||
],
|
||||
"plugins": [
|
||||
"stylelint-order",
|
||||
"stylelint-declaration-block-no-ignored-properties"
|
||||
],
|
||||
"rules": {
|
||||
"block-no-empty": null,
|
||||
"function-name-case": "lower",
|
||||
"comment-empty-line-before": null,
|
||||
"no-invalid-double-slash-comments": null,
|
||||
"no-descending-specificity": null,
|
||||
"declaration-empty-line-before": null,
|
||||
"no-duplicate-selectors": null
|
||||
}
|
||||
}
|
||||
|
19
.travis.yml
19
.travis.yml
@ -1,19 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 12
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
cache:
|
||||
yarn: true
|
||||
directories:
|
||||
- node_modules
|
||||
install:
|
||||
- npm install -g yarn
|
||||
- npm install -g lerna
|
||||
- yarn bootstrap
|
||||
script:
|
||||
- yarn build:dev
|
||||
# - yarn test
|
||||
# after_script:
|
||||
# - yarn coveralls
|
@ -41,7 +41,7 @@ No one can guarantee how much will be remembered about certain PR after some tim
|
||||
|
||||
### Style Guide
|
||||
|
||||
eslint can help to identify styling issues that may exist in your code. Your code is required to pass the test from eslint. Run the test locally by `$ yarn lint`.
|
||||
eslint can help to identify styling issues that may exist in your code. Your code is required to pass the test from eslint. Run the test locally by `$ npm run lint`.
|
||||
|
||||
### Commit Message Format
|
||||
|
||||
@ -110,8 +110,8 @@ Look at [these files](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJyg
|
||||
|
||||
X6 uses semantic versioning in release process based on [semver](https://semver.org/).
|
||||
|
||||
- [Publishing maintenance releases](https://github.com/semantic-release/semantic-release/blob/master/docs/recipes/maintenance-releases.md)
|
||||
- [Publishing pre-releases](https://github.com/semantic-release/semantic-release/blob/master/docs/recipes/pre-releases.md)
|
||||
- [Publishing maintenance releases](https://github.com/semantic-release/semantic-release/blob/master/docs/recipes/release-workflow/maintenance-releases.md)
|
||||
- [Publishing pre-releases](https://github.com/semantic-release/semantic-release/blob/master/docs/recipes/release-workflow/pre-releases.md)
|
||||
|
||||
### Branch Strategy
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# 代码贡献规范
|
||||
|
||||
有任何疑问,欢迎提交 [issue](https://github.com/antvis/x6/issues) 或 [PR](https://github.com/antvis/x6/pulls)!
|
||||
如果你有任何疑问,欢迎提交 [issue](https://github.com/antvis/x6/issues) 或 [PR](https://github.com/antvis/x6/pulls)!
|
||||
|
||||
## 提交 issue
|
||||
|
||||
@ -41,7 +41,7 @@ $ git push origin branch-name
|
||||
|
||||
### 代码风格
|
||||
|
||||
你的代码风格必须通过 eslint,你可以运行 `$ yarn lint` 本地测试。
|
||||
你的代码风格必须通过 eslint,你可以运行 `$ npm run lint` 本地测试。
|
||||
|
||||
### Commit 提交规范
|
||||
|
||||
@ -109,8 +109,8 @@ BREAKING CHANGE:
|
||||
|
||||
## 发布管理
|
||||
|
||||
- [Publishing maintenance releases](https://github.com/semantic-release/semantic-release/blob/master/docs/recipes/maintenance-releases.md)
|
||||
- [Publishing pre-releases](https://github.com/semantic-release/semantic-release/blob/master/docs/recipes/pre-releases.md)
|
||||
- [发布维护版本](https://github.com/semantic-release/semantic-release/blob/master/docs/recipes/release-workflow/maintenance-releases.md)
|
||||
- [发布预发版本](https://github.com/semantic-release/semantic-release/blob/master/docs/recipes/release-workflow/pre-releases.md)
|
||||
|
||||
X6 基于 [semver](http://semver.org/lang/zh-CN/) 语义化版本号进行发布。
|
||||
|
||||
@ -121,7 +121,7 @@ X6 基于 [semver](http://semver.org/lang/zh-CN/) 语义化版本号进行发布
|
||||
|
||||
### 发布策略
|
||||
|
||||
每个大版本都有一个发布经理管理(PM),他/她要做的事情
|
||||
在每个大版本的发布中,都会有一个PM,他在发布的不同阶段负有以下职责:
|
||||
|
||||
#### 准备工作:
|
||||
|
||||
@ -135,6 +135,6 @@ X6 基于 [semver](http://semver.org/lang/zh-CN/) 语义化版本号进行发布
|
||||
|
||||
#### 发布时:
|
||||
|
||||
- 将老的稳定版本(master)备份到以当前大版本为名字的分支上(例如 `1.x`),并设置 tag 为 {v}.x`( v 为当前版本,例如 `1.x`)。
|
||||
- 将老的稳定版本(master)备份到以当前大版本为名字的分支上(例如 `1.x`),并设置 tag 为 {v}.x( v 为当前版本,例如 `1.x`)。
|
||||
- 发布新的稳定版本到 [npm](http://npmjs.com),并通知上层框架进行更新。
|
||||
- `npm publish` 之前,请先阅读[『我是如何发布一个 npm 包的』](https://fengmk2.com/blog/2016/how-i-publish-a-npm-package)。
|
||||
|
@ -1,4 +1,5 @@
|
||||
BARM <284942955@qq.com>
|
||||
Candy <563378816@qq.com>
|
||||
Chaoqi <HAN>
|
||||
Clifford <ajard>
|
||||
DaiGang <42136433+daigang666@users.noreply.github.com>
|
||||
@ -6,11 +7,19 @@ 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>
|
||||
ImgBotApp <ImgBotHelp@gmail.com>
|
||||
Indomi <indomi126@gmail.com>
|
||||
James <san>
|
||||
Jógvan <lse>
|
||||
Ken <ei>
|
||||
Limbo <49612796+JUST-Limbo@users.noreply.github.com>
|
||||
Lixu <37231473+wflixu@users.noreply.github.com>
|
||||
Lloyd <ho>
|
||||
Lyn <47809781+lyn-boyu@users.noreply.github.com>
|
||||
Mingfei <az8641683@163.com>
|
||||
MrMengJ <2646973632@qq.com>
|
||||
Naveen <172697+naveensrinivasan@users.noreply.github.com>
|
||||
NewByVector <NewByVector@users.noreply.github.com>
|
||||
Olive.Wang <olivewind.wang@gmail.com>
|
||||
Opportunity <opportunity@live.in>
|
||||
@ -18,18 +27,25 @@ Questions <chip@twostewards.com>
|
||||
RuiLin <on>
|
||||
SSC <273702440@qq.com>
|
||||
Sindori <441933726@qq.com>
|
||||
Susan <527971893@qq.com>
|
||||
Thomas <eugne>
|
||||
Tony <>
|
||||
Utopia <greatauk11@gmail.com>
|
||||
XLZY <1017866168@qq.com>
|
||||
Xingjian <han>
|
||||
Zhenyu <o>
|
||||
arthur657834 <kingkom7834@126.com>
|
||||
boyu.zlj <boyu.zlj@antgroup.com>
|
||||
breezefaith <nyzhangzc@qq.com>
|
||||
bubkoo <bubkoo.wy@gmail.com>
|
||||
bubkoo <bubkoo@users.noreply.github.com>
|
||||
budlion <dongqi.ldq@alibaba-inc.com>
|
||||
cuidong626 <cuidong1234@outlook.com>
|
||||
daigang <1210242662@qq.com>
|
||||
doublewu <592581554@qq.com>
|
||||
iceytea <liyunheasap@yeah.net>
|
||||
jiqili <43718732+jiqili@users.noreply.github.com>
|
||||
kelin.zrh <34393362+AricZhu@users.noreply.github.com>
|
||||
kingshuaishuai <ken.wang@mrs.ai>
|
||||
kio <1421104933@qq.com>
|
||||
lijing666 <lijing241@yeah.net>
|
||||
@ -37,26 +53,36 @@ lopn <lopnxrp@126.com>
|
||||
luchunwei <luchunwei@gmail.com>
|
||||
luzhuang <364439895@qq.com>
|
||||
lvhuiyang <ilvhuiyang@gmail.com>
|
||||
myzxlin <myzxlin@163.com>
|
||||
newbyvector <vectorse@126.com>
|
||||
niexq <1879633916@qq.com>
|
||||
niexq <niexq@firstgrid.cn>
|
||||
pengxingjian.pxj <pengxingjian.pxj@alibaba-inc.com>
|
||||
pfdgithub <pfdgithub@users.noreply.github.com>
|
||||
qingchi <qinky94@163.com>
|
||||
qu <33251372+Qujh97@users.noreply.github.com>
|
||||
sallen450 <qinghua10199@gmail.com>
|
||||
semantic-release-bot <semantic-release-bot@martynus.net>
|
||||
vector <vectorse@126.com>
|
||||
wenbei <38773084+wb-wenbei@users.noreply.github.com>
|
||||
wgf <34190465+evelope@users.noreply.github.com>
|
||||
wind <>
|
||||
wjqsummer <52412389+wjqsummer@users.noreply.github.com>
|
||||
wtzeng1 <wtzeng1@gmail.com>
|
||||
x6-bot <x6-bot@users.noreply.github.com>
|
||||
xrkffgg <xrkffgg@gmail.com>
|
||||
yaojin2070 <48686959+yaojin2070@users.noreply.github.com>
|
||||
zdc1111 <39116292+zdc1111@users.noreply.github.com>
|
||||
九思⚡⚡⚡ <2228429150@qq.com>
|
||||
何腾飞 <avrin.live.cn@outlook.com>
|
||||
偏右 <afc163@gmail.com>
|
||||
小耀 <jinyue.gjy@antfin.com>
|
||||
崖 <bubkoo.wy@gmail.com>
|
||||
崖崖崖 <bubkoo.wy@gmail.com>
|
||||
文瑀 <wenyu.jqq@antfin.com>
|
||||
杨凌 <89915256@qq.com>
|
||||
柏愚 <boyu.zlj@antfin.com>
|
||||
粑粑超 <842486229@qq.com>
|
||||
金强强 <wenyu.jqq@antfin.com>
|
||||
问崖 <bubkoo.wy@gmail.com>
|
||||
问崖 <pengxingjian.pxj@antfin.com>
|
File diff suppressed because one or more lines are too long
Before (image error) Size: 8.7 MiB After (image error) Size: 9.7 MiB |
175
README.en-us.md
175
README.en-us.md
@ -2,10 +2,9 @@
|
||||
|
||||
<p align="center"><img src="/flow.svg"></p>
|
||||
|
||||
<p align="center"><strong>Graph Editing Engine Of AntV</strong></p>
|
||||
<p align="center"><strong>JavaScript diagramming library that uses SVG and HTML for rendering</strong></p>
|
||||
|
||||
<p align="center"><a href="https://x6.antv.vision/en/docs/tutorial/about">Tutorials</a> · <a href="https://x6.antv.vision/en/examples/gallery">Examples</a> · <a href="https://x6.antv.vision/en/docs/api/graph">API</a></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>
|
||||
@ -23,15 +22,22 @@
|
||||
|
||||
## Features
|
||||
|
||||
- 🌱 easy-to-customize: based on well known SVG/HTML/CSS or React/Vue to custom nodes and edges
|
||||
- 🚀 out-of-the-box: built-in 10+ plugins, such as selection, dnd, redo/undo, snapline, minimap, etc.
|
||||
- 🧲 data-driven: base on MVC architecture, you can focus on data logic and business logic
|
||||
- 💯 highly-event-driven: you can react on any event that happens inside the graph
|
||||
- 🌱 Easy-to-customize: based on well known SVG/HTML/CSS or React/Vue/Angular to custom nodes and edges
|
||||
- 🚀 Out-of-the-box: built-in 10+ plugins, such as selection, dnd, redo/undo, snapline, minimap, etc.
|
||||
- 🧲 Data-driven: base on MVC architecture, you can focus on data logic and business logic
|
||||
- 💯 Highly-event-driven: you can react on any event that happens inside the graph
|
||||
|
||||
## Environment Support
|
||||
|
||||
- Modern browsers and Internet Explorer 11 (with polyfills)
|
||||
- Server-side Rendering
|
||||
|
||||
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Safari |
|
||||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| IE11, Edge | last 2 versions | last 2 versions | last 2 versions |
|
||||
|
||||
## Installation
|
||||
|
||||
### NPM/Yarn
|
||||
|
||||
```shell
|
||||
# npm
|
||||
$ npm install @antv/x6 --save
|
||||
@ -40,51 +46,20 @@ $ npm install @antv/x6 --save
|
||||
$ yarn add @antv/x6
|
||||
```
|
||||
|
||||
### CDNs
|
||||
|
||||
For learning purposes, you can use the latest version with one of the CDN:
|
||||
|
||||
- https://unpkg.com/@antv/x6/dist/x6.js
|
||||
- https://cdn.jsdelivr.net/npm/@antv/x6/dist/x6.js
|
||||
- https://cdnjs.cloudflare.com/ajax/libs/antv-x6/1.3.20/x6.js
|
||||
|
||||
```html
|
||||
<script src="https://unpkg.com/@antv/x6/dist/x6.js"></script>
|
||||
```
|
||||
|
||||
For production, we recommend linking to a specific version number to avoid unexpected breakage from newer versions:
|
||||
|
||||
- https://unpkg.com/@antv/x6@1.1.1/dist/x6.js
|
||||
- https://cdn.jsdelivr.net/npm/@antv/x6@1.1.1/dist/x6.js
|
||||
- https://cdnjs.cloudflare.com/ajax/libs/antv-x6/1.1.1/x6.js
|
||||
|
||||
```html
|
||||
<script src="https://unpkg.com/@antv/x6@1.1.1/dist/x6.js"></script>
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
**Step 1**: specify a container the render the diagram.
|
||||
|
||||
```html
|
||||
<div id="container" style="width: 600px; height: 400px"></div>
|
||||
```
|
||||
|
||||
**Step 2**: render nodes and edges.
|
||||
|
||||
```ts
|
||||
// import from node_modules
|
||||
import { Graph } from '@antv/x6'
|
||||
// or use the global variable `X6` exported from CDN links
|
||||
// const { Graph } = X6
|
||||
|
||||
// Create an instance of Graph.
|
||||
const graph = new Graph({
|
||||
container: document.getElementById('container'),
|
||||
grid: true
|
||||
})
|
||||
|
||||
// Render source node.
|
||||
const source = graph.addNode({
|
||||
x: 300,
|
||||
y: 40,
|
||||
@ -93,7 +68,6 @@ const source = graph.addNode({
|
||||
label: 'Hello',
|
||||
})
|
||||
|
||||
// Render target node.
|
||||
const target = graph.addNode({
|
||||
x: 420,
|
||||
y: 180,
|
||||
@ -102,132 +76,39 @@ const target = graph.addNode({
|
||||
label: 'World',
|
||||
})
|
||||
|
||||
// Render edge from source to target.
|
||||
graph.addEdge({
|
||||
source,
|
||||
target,
|
||||
})
|
||||
```
|
||||
|
||||
<img src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*o4W3RLZicagAAAAAAAAAAAAAARQnAQ" alt="HelloWorld" />
|
||||
## Links
|
||||
|
||||
## Documentation
|
||||
|
||||
- [About](https://x6.antv.vision/en/docs/tutorial/about)
|
||||
- [Getting Started](https://x6.antv.vision/en/docs/tutorial/getting-started)
|
||||
- [Basic Usage](https://x6.antv.vision/en/docs/tutorial/basic/graph)
|
||||
- [Advanced Practice](https://x6.antv.vision/en/docs/tutorial/intermediate/serialization)
|
||||
- [Senior Guidance](https://x6.antv.vision/en/docs/tutorial/advanced/animation)
|
||||
- [ChangeLog](https://x6.antv.vision/en/docs/tutorial/log)
|
||||
|
||||
## App Demos Build with X6
|
||||
|
||||
<center>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#flowchart" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="250" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*JSr-RbwCgmcAAAAAAAAAAAAAARQnAQ" alt="Flow"/>
|
||||
</a>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#dag" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="250" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*RPiGRaSus3UAAAAAAAAAAAAAARQnAQ" alt="Dag"/>
|
||||
</a>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#mindmap" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="200" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*GsEGSaBkc84AAAAAAAAAAAAAARQnAQ" alt="MindMap"/>
|
||||
</a>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#bpmn" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="200" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*aPSySa8oz4sAAAAAAAAAAAAAARQnAQ" alt="BPMN"/>
|
||||
</a>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#class" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="250" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*OaCpR7t_mVoAAAAAAAAAAAAAARQnAQ" alt="Class"/>
|
||||
</a>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#org" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="250" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*FWx5SYDzLw4AAAAAAAAAAAAAARQnAQ" alt="ORG"/>
|
||||
</a>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#er" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="250" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*7yVJQoM6-9AAAAAAAAAAAAAAARQnAQ" alt="ER"/>
|
||||
</a>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#swimlane" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="250" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*mUVrSJMkP1UAAAAAAAAAAAAAARQnAQ" alt="SwimLane"/>
|
||||
</a>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#tree" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="250" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*XDnNRqnj4WkAAAAAAAAAAAAAARQnAQ" alt="Tree"/>
|
||||
</a>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#elk" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="250" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*Z3ebTKy0w9cAAAAAAAAAAAAAARQnAQ" alt="ELK"/>
|
||||
</a>
|
||||
</center>
|
||||
|
||||
## Communication
|
||||
|
||||
Welcome to join the **X6 Communication Group** (Scan the QR Code to Join us). We also welcome the github [issues](https://github.com/antvis/x6/issues).
|
||||
|
||||
<a href="https://qr.dingtalk.com/action/joingroup?code=v1,k1,rOHuvgq5s0EHDktyyQJffDE3ZAmHnbB2e6iwn/w4BKs=&_dt_no_comment=1&origin=11" target="_blank" rel="noopener noreferrer">
|
||||
<img src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*Up-4S4v8H-0AAAAAAAAAAAAAARQnAQ" alt="X6 图可视化交流群1" width="375" />
|
||||
<img src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*4Y_5S7i26LAAAAAAAAAAAAAAARQnAQ" alt="X6 图可视化交流群2" width="375" />
|
||||
<img src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*KHB4QJAsW4QAAAAAAAAAAAAAARQnAQ" alt="X6 图可视化交流群3" width="375" />
|
||||
</a>
|
||||
- [Documents](https://x6.antv.vision/zh/docs/tutorial/about)
|
||||
- [Samples](https://x6.antv.vision/zh/examples/gallery)
|
||||
- [Blog](https://www.yuque.com/antv/x6/gcinvi)
|
||||
- [Versioning Release Note](https://www.yuque.com/antv/x6/bbfu6r)
|
||||
- [FAQ](https://www.yuque.com/antv/x6/be9pfx)
|
||||
- [CodeSanbox Template](https://codesandbox.io/s/qosj0?file=/src/app.tsx)
|
||||
|
||||
## Development
|
||||
|
||||
This repo is based on [lerna](https://github.com/lerna/lerna) with the following structure:
|
||||
|
||||
```
|
||||
.
|
||||
├── examples
|
||||
│ ├── x6-app-dag # example of dag graph
|
||||
│ ├── x6-app-draw # example of flowchart
|
||||
│ ├── x6-app-er # example of ER chart
|
||||
│ └── x6-example-features # example of basic features
|
||||
├── packages
|
||||
│ ├── x6 # X6
|
||||
│ ├── x6-react # wrap X6 with react(reserved)
|
||||
│ ├── x6-react-components # react componets to build graph apps
|
||||
│ ├── x6-react-shape # support render node with react
|
||||
│ └── x6-vue-shape # support render node with vue
|
||||
└── sites
|
||||
├── x6-sites # sites and documents
|
||||
├── x6-sites-demos # demos in documents
|
||||
└── x6-sites-demos-helper # tools to build demos
|
||||
```
|
||||
|
||||
We need to install some necessary global tools before getting started.
|
||||
|
||||
```shell
|
||||
# install yarn and lerna
|
||||
$ npm install yarn -g
|
||||
$ npm install lerna -g
|
||||
|
||||
# install deps and build
|
||||
$ yarn bootstrap
|
||||
```
|
||||
$ pnpm install
|
||||
|
||||
Then we can `cd` to dirs to development and debugging.
|
||||
|
||||
Such as, we can start `examples/x6-example-features` locally:
|
||||
|
||||
```shell
|
||||
cd examples/x6-example-features
|
||||
|
||||
yarn start
|
||||
```
|
||||
|
||||
When need to fix some bugs of X6, we can start with **watch** mode:
|
||||
|
||||
```shell
|
||||
# enter the specified project development and debugging
|
||||
cd packages/x6
|
||||
pnpm run build:watch
|
||||
|
||||
// build esm to "em" dir
|
||||
yarn build:watch:esm
|
||||
|
||||
// build commonjs to "lib" dir
|
||||
yarn build:watch:cjs
|
||||
# start example to see the effect
|
||||
cd examples/x6-example-features
|
||||
pnpm run start
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Please let us know how can we help. Do check out [issues](https://github.com/antvis/x6/issues) for bug reports or suggestions first.
|
||||
|
||||
To become a contributor, please follow our [contributing guide](/CONTRIBUTING.md).
|
||||
|
||||
## Contributors
|
||||
To become a contributor, please follow our [contributing guide](/CONTRIBUTING.md). If you are an active contributor, you can apply to be a outside collaborator.
|
||||
|
||||
<a href="https://github.com/antvis/x6/graphs/contributors">
|
||||
<img src="/CONTRIBUTORS.svg" alt="Contributors" width="740" />
|
||||
|
178
README.md
178
README.md
@ -1,10 +1,9 @@
|
||||
简体中文 | [English](/README.en-us.md)
|
||||
|
||||
<p align="center"><img src="/flow.svg"></p>
|
||||
<p align="center"><img alt="flow" src="/flow.svg"></p>
|
||||
|
||||
<p align="center"><strong>X6 是 AntV 旗下的图编辑引擎</strong></p>
|
||||
<p align="center"><strong>提供简单易用的节点定制能力和开箱即用的交互组件,方便我们快速搭建流程图、DAG 图、ER 图等图应用</strong></p>
|
||||
<p align="center"><a href="https://x6.antv.vision/zh/docs/tutorial/about">教程</a> • <a href="https://x6.antv.vision/zh/examples/gallery">示例</a> • <a href="https://x6.antv.vision/zh/docs/api/graph">API</a></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>
|
||||
@ -21,17 +20,23 @@
|
||||
<a href="https://x6.antv.vision"><img alt="website" src="https://img.shields.io/static/v1?label=&labelColor=505050&message=website&color=0076D6&style=flat-square&logo=google-chrome&logoColor=0076D6"></a>
|
||||
</p>
|
||||
|
||||
|
||||
## 特性
|
||||
|
||||
- 🌱 极易定制:支持使用 SVG/HTML/React/Vue 定制节点样式和交互
|
||||
- 🌱 极易定制:支持使用 SVG/HTML/React/Vue/Angular 定制节点样式和交互
|
||||
- 🚀 开箱即用:内置 10+ 图编辑配套扩展,如框选、对齐线、小地图等
|
||||
- 🧲 数据驱动:基于 MVC 架构,用户更加专注于数据逻辑和业务逻辑
|
||||
- 💯 事件驱动:完备的事件系统,可以监听图表内发生的任何事件
|
||||
|
||||
## 安装
|
||||
## 兼容环境
|
||||
|
||||
### 使用 NPM/Yarn
|
||||
- 现代浏览器和 IE11(需要 polyfills)
|
||||
- 支持服务端渲染。
|
||||
|
||||
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Safari |
|
||||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| IE11, Edge | last 2 versions | last 2 versions | last 2 versions |
|
||||
|
||||
## 安装
|
||||
|
||||
```shell
|
||||
# npm
|
||||
@ -41,51 +46,20 @@ $ npm install @antv/x6 --save
|
||||
$ yarn add @antv/x6
|
||||
```
|
||||
|
||||
### 使用 CDN
|
||||
|
||||
可以使用下面任意一个最新版本的 CDN 地址:
|
||||
|
||||
- https://unpkg.com/@antv/x6/dist/x6.js
|
||||
- https://cdn.jsdelivr.net/npm/@antv/x6/dist/x6.js
|
||||
- https://cdnjs.cloudflare.com/ajax/libs/antv-x6/1.3.20/x6.js
|
||||
|
||||
```html
|
||||
<script src="https://unpkg.com/@antv/x6/dist/x6.js"></script>
|
||||
```
|
||||
|
||||
在生产环境中,建议使用指定版本号的链接,以避免版本更新带来的意外破坏:
|
||||
|
||||
- https://unpkg.com/@antv/x6@1.1.1/dist/x6.js
|
||||
- https://cdn.jsdelivr.net/npm/@antv/x6@1.1.1/dist/x6.js
|
||||
- https://cdnjs.cloudflare.com/ajax/libs/antv-x6/1.1.1/x6.js
|
||||
|
||||
```html
|
||||
<script src="https://unpkg.com/@antv/x6@1.1.1/dist/x6.js"></script>
|
||||
```
|
||||
|
||||
## 快速使用
|
||||
|
||||
**Step 1**: 指定渲染图的容器。
|
||||
## 示例
|
||||
|
||||
```html
|
||||
<div id="container" style="width: 600px; height: 400px"></div>
|
||||
```
|
||||
|
||||
**Step 2**: 渲染节点和边。
|
||||
|
||||
```ts
|
||||
// 从 node_modules 引入
|
||||
import { Graph } from '@antv/x6'
|
||||
// 从 CND 引入时,我们暴露了 X6 这个全局变量
|
||||
// const { Graph } = X6
|
||||
|
||||
// 创建 Graph 的实例
|
||||
const graph = new Graph({
|
||||
container: document.getElementById('container'),
|
||||
grid: true
|
||||
})
|
||||
|
||||
// 渲染源节点
|
||||
const source = graph.addNode({
|
||||
x: 300,
|
||||
y: 40,
|
||||
@ -94,7 +68,6 @@ const source = graph.addNode({
|
||||
label: 'Hello',
|
||||
})
|
||||
|
||||
// 渲染目标节点
|
||||
const target = graph.addNode({
|
||||
x: 420,
|
||||
y: 180,
|
||||
@ -103,134 +76,39 @@ const target = graph.addNode({
|
||||
label: 'World',
|
||||
})
|
||||
|
||||
// 渲染边
|
||||
graph.addEdge({
|
||||
source,
|
||||
target,
|
||||
})
|
||||
```
|
||||
|
||||
渲染结果如下。
|
||||
## 链接
|
||||
|
||||
<img src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*o4W3RLZicagAAAAAAAAAAAAAARQnAQ" alt="HelloWorld" />
|
||||
- [文档](https://x6.antv.vision/zh/docs/tutorial/about)
|
||||
- [示例](https://x6.antv.vision/zh/examples/gallery)
|
||||
- [博客](https://www.yuque.com/antv/x6/gcinvi)
|
||||
- [更新日志](https://www.yuque.com/antv/x6/bbfu6r)
|
||||
- [常见问题](https://www.yuque.com/antv/x6/be9pfx)
|
||||
- [CodeSanbox 模板](https://codesandbox.io/s/qosj0?file=/src/app.tsx)
|
||||
|
||||
## 使用文档
|
||||
|
||||
- [简介](https://x6.antv.vision/zh/docs/tutorial/about)
|
||||
- [快速上手](https://x6.antv.vision/zh/docs/tutorial/getting-started)
|
||||
- [基础教程](https://x6.antv.vision/zh/docs/tutorial/basic/graph)
|
||||
- [进阶实践](https://x6.antv.vision/zh/docs/tutorial/intermediate/serialization)
|
||||
- [高级指引](https://x6.antv.vision/zh/docs/tutorial/advanced/animation)
|
||||
- [更新日志](https://x6.antv.vision/zh/docs/tutorial/log)
|
||||
|
||||
## 应用案例
|
||||
|
||||
<center>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#flowchart" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="250" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*JSr-RbwCgmcAAAAAAAAAAAAAARQnAQ" alt="Flow"/>
|
||||
</a>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#dag" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="250" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*RPiGRaSus3UAAAAAAAAAAAAAARQnAQ" alt="Dag"/>
|
||||
</a>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#mindmap" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="200" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*GsEGSaBkc84AAAAAAAAAAAAAARQnAQ" alt="MindMap"/>
|
||||
</a>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#bpmn" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="200" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*aPSySa8oz4sAAAAAAAAAAAAAARQnAQ" alt="BPMN"/>
|
||||
</a>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#class" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="250" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*OaCpR7t_mVoAAAAAAAAAAAAAARQnAQ" alt="Class"/>
|
||||
</a>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#org" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="250" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*FWx5SYDzLw4AAAAAAAAAAAAAARQnAQ" alt="ORG"/>
|
||||
</a>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#er" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="250" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*7yVJQoM6-9AAAAAAAAAAAAAAARQnAQ" alt="ER"/>
|
||||
</a>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#swimlane" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="250" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*mUVrSJMkP1UAAAAAAAAAAAAAARQnAQ" alt="SwimLane"/>
|
||||
</a>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#tree" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="250" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*XDnNRqnj4WkAAAAAAAAAAAAAARQnAQ" alt="Tree"/>
|
||||
</a>
|
||||
<a href="https://x6.antv.vision/zh/examples/showcase/practices#elk" target="_blank" rel="noopener noreferrer">
|
||||
<img width="400" height="250" style="margin-bottom: 20px" src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*Z3ebTKy0w9cAAAAAAAAAAAAAARQnAQ" alt="ELK"/>
|
||||
</a>
|
||||
</center>
|
||||
|
||||
## 如何交流
|
||||
|
||||
如果你在使用的过程中碰到问题,可以先通过 [issues](https://github.com/antvis/x6/issues) 看看有没有类似的 bug 或者建议。欢迎提 [issues](https://github.com/antvis/x6/issues/new) 交流,也可以使用[钉钉](https://m.dingtalk.com/)扫描下面二维码加入**X6 交流群**。
|
||||
|
||||
需要注意的是,提问题时请配上 [CodeSandbox](https://codesandbox.io/s/pensive-sound-f4nhc) 的复现代码,方便快速定位和解决问题。
|
||||
|
||||
<a href="https://qr.dingtalk.com/action/joingroup?code=v1,k1,rOHuvgq5s0EHDktyyQJffDE3ZAmHnbB2e6iwn/w4BKs=&_dt_no_comment=1&origin=11" target="_blank" rel="noopener noreferrer">
|
||||
<img src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*Up-4S4v8H-0AAAAAAAAAAAAAARQnAQ" alt="X6 图可视化交流群1" width="375" />
|
||||
<img src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*4Y_5S7i26LAAAAAAAAAAAAAAARQnAQ" alt="X6 图可视化交流群2" width="375" />
|
||||
<img src="https://gw.alipayobjects.com/mdn/rms_43231b/afts/img/A*KHB4QJAsW4QAAAAAAAAAAAAAARQnAQ" alt="X6 图可视化交流群3" width="375" />
|
||||
</a>
|
||||
|
||||
## 如何开发
|
||||
|
||||
我们使用了 [lerna](https://github.com/lerna/lerna) 来管理项目,目录结构如下:
|
||||
|
||||
```
|
||||
.
|
||||
├── examples
|
||||
│ ├── x6-app-dag # dag 图示例
|
||||
│ ├── x6-app-draw # 流程图示例
|
||||
│ ├── x6-app-er # ER 图示例
|
||||
│ └── x6-example-features # 特性演示示例
|
||||
├── packages
|
||||
│ ├── x6 # X6
|
||||
│ ├── x6-react # X6 的 React 封装(预留)
|
||||
│ ├── x6-react-components # 配套 React 组件库
|
||||
│ ├── x6-react-shape # 支持使用 React 渲染节点
|
||||
│ └── x6-vue-shape # 支持使用 Vue 渲染节点
|
||||
└── sites
|
||||
├── x6-sites # 官网和文档
|
||||
├── x6-sites-demos # 文档中嵌入的 DEMO
|
||||
└── x6-sites-demos-helper # 构建文档 DEMO 的工具
|
||||
```
|
||||
|
||||
开始之前需要安装必要的全局依赖和初始化:
|
||||
## 本地开发
|
||||
|
||||
```shell
|
||||
# 全局安装 yarn 和 lerna 工具
|
||||
$ npm install yarn -g
|
||||
$ npm install lerna -g
|
||||
|
||||
# 安装项目依赖和初始化构建
|
||||
$ yarn bootstrap
|
||||
```
|
||||
$ pnpm install
|
||||
|
||||
然后可以进入到指定项目开发和调试。
|
||||
|
||||
如本地启动 `examples/x6-example-features` 示例:
|
||||
|
||||
```shell
|
||||
cd examples/x6-example-features
|
||||
|
||||
yarn start
|
||||
```
|
||||
|
||||
修复 X6 的 BUG 时可以开启 watch 模式,配合上面启动的本地 DEMO,实时查看修复效果:
|
||||
|
||||
```shell
|
||||
# 进入到指定项目开发和调试
|
||||
cd packages/x6
|
||||
pnpm run build:watch
|
||||
|
||||
// esm 模式,动态构建 es 产物
|
||||
yarn build:watch:esm
|
||||
|
||||
// commonjs 模式,动态构建 lib 产物
|
||||
yarn build:watch:cjs
|
||||
# 启动 example 查看效果
|
||||
cd examples/x6-example-features
|
||||
pnpm run start
|
||||
```
|
||||
|
||||
## 如何贡献
|
||||
## 参与共建
|
||||
|
||||
如果你在使用的过程中碰到问题,可以先通过 [issues](https://github.com/antvis/x6/issues) 看看有没有类似的 bug 或者建议。
|
||||
|
||||
如需提交代码,请遵从我们的[贡献指南](/CONTRIBUTING.zh-CN.md)。我们会收集贡献者的 Github 头像到下面贡献者清单中。
|
||||
如果希望参与到 X6 的开发中,请遵从我们的[贡献指南](/CONTRIBUTING.zh-CN.md)。如果你贡献度足够活跃,你可以申请成为社区协作者。
|
||||
|
||||
<a href="https://github.com/antvis/x6/graphs/contributors">
|
||||
<img src="/CONTRIBUTORS.svg" alt="Contributors" width="740" />
|
||||
|
21
SECURITY.md
Normal file
21
SECURITY.md
Normal file
@ -0,0 +1,21 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Use this section to tell people about which versions of your project are
|
||||
currently being supported with security updates.
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 5.1.x | :white_check_mark: |
|
||||
| 5.0.x | :x: |
|
||||
| 4.0.x | :white_check_mark: |
|
||||
| < 4.0 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Use this section to tell people how to report a vulnerability.
|
||||
|
||||
Tell them where to go, how often they can expect to get an update on a
|
||||
reported vulnerability, what to expect if the vulnerability is accepted or
|
||||
declined, etc.
|
@ -1,113 +0,0 @@
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-11-14)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-11-08)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-11-08)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-11-07)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-11-05)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-11-03)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-11-01)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-10-22)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-10-19)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-10-12)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-10-12)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-10-08)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-10-02)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-10-02)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-10-01)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-10-01)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-10-01)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-10-01)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-09-30)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-09-22)
|
||||
|
||||
## @antv/eslint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/eslint-config@1.0.0...@antv/eslint-config@1.0.1) (2021-09-13)
|
||||
|
||||
# @antv/eslint-config 1.0.0 (2021-06-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix eslint errors ([06ba121](https://github.com/antvis/x6/commit/06ba121e3b937c5aeebbbe2b24e6db67fc141cb9))
|
||||
* update dependencies and fix type errors ([#1103](https://github.com/antvis/x6/issues/1103)) ([056b862](https://github.com/antvis/x6/commit/056b862b4efe7dbdc559cac7194c2453996acc07))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add lint rules for *.js files ([21f5436](https://github.com/antvis/x6/commit/21f54366776a304e8abb9df087c645653fb22ed5))
|
||||
* ✨ add unicorn plugin ([3e8515b](https://github.com/antvis/x6/commit/3e8515bedf0da8ca10119c8a00ffd972f3a1e3aa))
|
||||
* ✨ support bitwise ([d9bc9d9](https://github.com/antvis/x6/commit/d9bc9d92e8bec74e780a44364f9e21da5f34096b))
|
||||
|
||||
# @antv/eslint-config 1.0.0 (2021-06-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix eslint errors ([06ba121](https://github.com/antvis/x6/commit/06ba121e3b937c5aeebbbe2b24e6db67fc141cb9))
|
||||
* update dependencies and fix type errors ([#1103](https://github.com/antvis/x6/issues/1103)) ([056b862](https://github.com/antvis/x6/commit/056b862b4efe7dbdc559cac7194c2453996acc07))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add lint rules for *.js files ([21f5436](https://github.com/antvis/x6/commit/21f54366776a304e8abb9df087c645653fb22ed5))
|
||||
* ✨ add unicorn plugin ([3e8515b](https://github.com/antvis/x6/commit/3e8515bedf0da8ca10119c8a00ffd972f3a1e3aa))
|
||||
* ✨ support bitwise ([d9bc9d9](https://github.com/antvis/x6/commit/d9bc9d92e8bec74e780a44364f9e21da5f34096b))
|
||||
|
||||
# @antv/eslint-config 1.0.0 (2021-06-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix eslint errors ([06ba121](https://github.com/antvis/x6/commit/06ba121e3b937c5aeebbbe2b24e6db67fc141cb9))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add lint rules for *.js files ([21f5436](https://github.com/antvis/x6/commit/21f54366776a304e8abb9df087c645653fb22ed5))
|
||||
* ✨ add unicorn plugin ([3e8515b](https://github.com/antvis/x6/commit/3e8515bedf0da8ca10119c8a00ffd972f3a1e3aa))
|
||||
* ✨ support bitwise ([d9bc9d9](https://github.com/antvis/x6/commit/d9bc9d92e8bec74e780a44364f9e21da5f34096b))
|
||||
|
||||
# @antv/eslint-config 1.0.0 (2021-06-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix eslint errors ([06ba121](https://github.com/antvis/x6/commit/06ba121e3b937c5aeebbbe2b24e6db67fc141cb9))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add lint rules for *.js files ([21f5436](https://github.com/antvis/x6/commit/21f54366776a304e8abb9df087c645653fb22ed5))
|
||||
* ✨ add unicorn plugin ([3e8515b](https://github.com/antvis/x6/commit/3e8515bedf0da8ca10119c8a00ffd972f3a1e3aa))
|
||||
* ✨ support bitwise ([d9bc9d9](https://github.com/antvis/x6/commit/d9bc9d92e8bec74e780a44364f9e21da5f34096b))
|
||||
|
||||
# @antv/eslint-config 1.0.0 (2021-06-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix eslint errors ([06ba121](https://github.com/antvis/x6/commit/06ba121e3b937c5aeebbbe2b24e6db67fc141cb9))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add lint rules for *.js files ([21f5436](https://github.com/antvis/x6/commit/21f54366776a304e8abb9df087c645653fb22ed5))
|
||||
* ✨ add unicorn plugin ([3e8515b](https://github.com/antvis/x6/commit/3e8515bedf0da8ca10119c8a00ffd972f3a1e3aa))
|
||||
* ✨ support bitwise ([d9bc9d9](https://github.com/antvis/x6/commit/d9bc9d92e8bec74e780a44364f9e21da5f34096b))
|
@ -1,55 +0,0 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@antv/eslint-config",
|
||||
"version": "1.0.1",
|
||||
"main": "./lib/index.js",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "rimraf lib",
|
||||
"lint": "eslint 'src/**/*.{js,ts}?(x)' --fix",
|
||||
"build": "tsc --outDir ./lib",
|
||||
"build:watch": "yarn build --w",
|
||||
"prebuild": "run-s clean",
|
||||
"postinstall": "run-s build",
|
||||
"prepare": "run-s build",
|
||||
"precommit": "lint-staged"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.ts": [
|
||||
"eslint --fix"
|
||||
]
|
||||
},
|
||||
"inherits": [
|
||||
"@antv/x6-package-json/cli.json",
|
||||
"@antv/x6-package-json/eslint.json"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.9.1",
|
||||
"@typescript-eslint/eslint-plugin": "^4.31.0",
|
||||
"@typescript-eslint/parser": "^4.31.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-import": "^2.24.2",
|
||||
"eslint-plugin-jest": "^24.4.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.4.1",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"eslint-plugin-promise": "^5.1.0",
|
||||
"eslint-plugin-react": "^7.25.1",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"eslint-plugin-unicorn": "^36.0.0",
|
||||
"fs-extra": "^10.0.0",
|
||||
"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",
|
||||
"watch": "^1.0.2"
|
||||
}
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: [
|
||||
'@typescript-eslint',
|
||||
'eslint-comments',
|
||||
'import',
|
||||
'flowtype',
|
||||
'jest',
|
||||
'jsx-a11y',
|
||||
'prettier',
|
||||
'promise',
|
||||
'react',
|
||||
'react-hooks',
|
||||
'unicorn',
|
||||
],
|
||||
extends: [
|
||||
'airbnb-base',
|
||||
'eslint:recommended',
|
||||
'prettier',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:jsx-a11y/recommended',
|
||||
'plugin:import/errors',
|
||||
'plugin:import/warnings',
|
||||
'plugin:promise/recommended',
|
||||
'plugin:prettier/recommended',
|
||||
'plugin:react/recommended',
|
||||
'plugin:react-hooks/recommended',
|
||||
],
|
||||
env: {
|
||||
browser: true,
|
||||
commonjs: true,
|
||||
es6: true,
|
||||
jest: true,
|
||||
node: true,
|
||||
mocha: true,
|
||||
jasmine: true,
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 2020,
|
||||
sourceType: 'module',
|
||||
// project: './tsconfig.json',
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
requireConfigFile: false,
|
||||
},
|
||||
settings: {
|
||||
react: {
|
||||
version: 'detect',
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'no-bitwise': 0,
|
||||
'no-continue': 0,
|
||||
'no-lonely-if': 0,
|
||||
'no-multi-assign': 0,
|
||||
'no-nested-ternary': 0,
|
||||
'no-inner-declarations': 0,
|
||||
'no-unused-expressions': 0,
|
||||
'max-classes-per-file': 0,
|
||||
'prefer-destructuring': 0,
|
||||
'class-methods-use-this': 0,
|
||||
'implicit-arrow-linebreak': 0,
|
||||
'lines-between-class-members': 0,
|
||||
'@typescript-eslint/lines-between-class-members': 0,
|
||||
'consistent-return': 0,
|
||||
'no-return-assign': [2, 'except-parens'],
|
||||
'no-param-reassign': [2, { props: false }],
|
||||
'no-cond-assign': [2, 'except-parens'],
|
||||
'no-console': [2, { allow: ['warn', 'error'] }],
|
||||
'@typescript-eslint/no-unused-expressions': [
|
||||
2,
|
||||
{ allowShortCircuit: true, allowTernary: true },
|
||||
],
|
||||
eqeqeq: [2, 'always', { null: 'ignore' }],
|
||||
'func-names': [1, 'never', { generators: 'as-needed' }],
|
||||
|
||||
'import/export': 0,
|
||||
'import/no-cycle': 0,
|
||||
'import/extensions': 0,
|
||||
'import/no-unresolved': 0,
|
||||
'import/prefer-default-export': 0,
|
||||
'import/no-extraneous-dependencies': 0,
|
||||
|
||||
'promise/always-return': 0,
|
||||
'promise/catch-or-return': 0,
|
||||
|
||||
'@typescript-eslint/no-namespace': 0,
|
||||
'@typescript-eslint/no-var-requires': 0,
|
||||
'@typescript-eslint/no-explicit-any': 0,
|
||||
'@typescript-eslint/no-non-null-assertion': 0,
|
||||
'@typescript-eslint/no-empty-function': 0,
|
||||
'@typescript-eslint/no-empty-interface': 0,
|
||||
'@typescript-eslint/explicit-module-boundary-types': 0,
|
||||
|
||||
'no-shadow': 0,
|
||||
'@typescript-eslint/no-shadow': 0,
|
||||
|
||||
camelcase: 0,
|
||||
'@typescript-eslint/camelcase': 0,
|
||||
|
||||
'no-use-before-define': 0,
|
||||
'@typescript-eslint/no-use-before-define': 0,
|
||||
|
||||
'no-useless-constructor': 0,
|
||||
'@typescript-eslint/no-useless-constructor': 0,
|
||||
|
||||
'no-unused-vars': 0,
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
2,
|
||||
{ vars: 'all', args: 'after-used', ignoreRestSiblings: true },
|
||||
],
|
||||
|
||||
'no-redeclare': 0,
|
||||
'@typescript-eslint/no-redeclare': [2, { ignoreDeclarationMerge: true }],
|
||||
|
||||
'react/sort-comp': 0,
|
||||
'react/prop-types': 0,
|
||||
'react/jsx-props-no-spreading': 0,
|
||||
'react/destructuring-assignment': 0,
|
||||
'react/no-access-state-in-setstate': 0,
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['**/*.js'],
|
||||
rules: {
|
||||
'no-console': 0,
|
||||
'global-require': 0,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
. "$(dirname "$0")/common.sh"
|
||||
|
||||
yarn commitlint --edit "$1"
|
@ -1 +0,0 @@
|
||||
echo
|
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
. "$(dirname "$0")/common.sh"
|
||||
|
||||
yarn precommit
|
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
. "$(dirname "$0")/common.sh"
|
||||
|
||||
npx devmoji -e --lint
|
@ -1,151 +0,0 @@
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-11-14)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-11-08)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-11-08)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-11-07)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-11-05)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-11-03)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-11-01)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-10-22)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-10-19)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-10-12)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-10-12)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-10-08)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-10-02)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-10-02)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-10-01)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-10-01)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-10-01)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-10-01)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-09-30)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-09-22)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-09-13)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-08-31)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-08-24)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-08-18)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-08-17)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-08-16)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-08-06)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-08-06)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-08-03)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-07-27)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-07-22)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-07-21)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-07-21)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-07-10)
|
||||
|
||||
## @antv/x6-package-json [1.0.1](https://github.com/antvis/x6/compare/@antv/x6-package-json@1.0.0...@antv/x6-package-json@1.0.1) (2021-07-09)
|
||||
|
||||
# @antv/x6-package-json 1.0.0 (2021-06-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix karma can not process lodash-es ([f7ae6b1](https://github.com/antvis/x6/commit/f7ae6b1f6b961a01c58d8827a9aaa2d5a984a6e0))
|
||||
* 🐛 should only read json files ([af9d87f](https://github.com/antvis/x6/commit/af9d87fedccf4ba791db5570ca73228520107e2a))
|
||||
* update dependencies and fix type errors ([#1103](https://github.com/antvis/x6/issues/1103)) ([056b862](https://github.com/antvis/x6/commit/056b862b4efe7dbdc559cac7194c2453996acc07))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add deps for jest ([4c831b8](https://github.com/antvis/x6/commit/4c831b84d032cc92f1c914143f4182772202620d))
|
||||
* ✨ add package inherit, compare commands ([d494b9f](https://github.com/antvis/x6/commit/d494b9f92e4e98816fb00acc02296bf5aa63f1b4))
|
||||
* ✨ sharing partial(devDependencies, peerDependencies, dependencies, scripts) package.json ([95c1112](https://github.com/antvis/x6/commit/95c1112c4e226c060dd94019f6ce5530a922a92f))
|
||||
* ✨ update vue deps ([37eae0b](https://github.com/antvis/x6/commit/37eae0b12502fba373d30153e0d1ac2085e843e8))
|
||||
|
||||
# @antv/x6-package-json 1.0.0 (2021-06-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix karma can not process lodash-es ([f7ae6b1](https://github.com/antvis/x6/commit/f7ae6b1f6b961a01c58d8827a9aaa2d5a984a6e0))
|
||||
* 🐛 should only read json files ([af9d87f](https://github.com/antvis/x6/commit/af9d87fedccf4ba791db5570ca73228520107e2a))
|
||||
* update dependencies and fix type errors ([#1103](https://github.com/antvis/x6/issues/1103)) ([056b862](https://github.com/antvis/x6/commit/056b862b4efe7dbdc559cac7194c2453996acc07))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add deps for jest ([4c831b8](https://github.com/antvis/x6/commit/4c831b84d032cc92f1c914143f4182772202620d))
|
||||
* ✨ add package inherit, compare commands ([d494b9f](https://github.com/antvis/x6/commit/d494b9f92e4e98816fb00acc02296bf5aa63f1b4))
|
||||
* ✨ sharing partial(devDependencies, peerDependencies, dependencies, scripts) package.json ([95c1112](https://github.com/antvis/x6/commit/95c1112c4e226c060dd94019f6ce5530a922a92f))
|
||||
* ✨ update vue deps ([37eae0b](https://github.com/antvis/x6/commit/37eae0b12502fba373d30153e0d1ac2085e843e8))
|
||||
|
||||
# @antv/x6-package-json 1.0.0 (2021-06-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix karma can not process lodash-es ([f7ae6b1](https://github.com/antvis/x6/commit/f7ae6b1f6b961a01c58d8827a9aaa2d5a984a6e0))
|
||||
* 🐛 should only read json files ([af9d87f](https://github.com/antvis/x6/commit/af9d87fedccf4ba791db5570ca73228520107e2a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add deps for jest ([4c831b8](https://github.com/antvis/x6/commit/4c831b84d032cc92f1c914143f4182772202620d))
|
||||
* ✨ add package inherit, compare commands ([d494b9f](https://github.com/antvis/x6/commit/d494b9f92e4e98816fb00acc02296bf5aa63f1b4))
|
||||
* ✨ sharing partial(devDependencies, peerDependencies, dependencies, scripts) package.json ([95c1112](https://github.com/antvis/x6/commit/95c1112c4e226c060dd94019f6ce5530a922a92f))
|
||||
* ✨ update vue deps ([37eae0b](https://github.com/antvis/x6/commit/37eae0b12502fba373d30153e0d1ac2085e843e8))
|
||||
|
||||
# @antv/x6-package-json 1.0.0 (2021-06-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix karma can not process lodash-es ([f7ae6b1](https://github.com/antvis/x6/commit/f7ae6b1f6b961a01c58d8827a9aaa2d5a984a6e0))
|
||||
* 🐛 should only read json files ([af9d87f](https://github.com/antvis/x6/commit/af9d87fedccf4ba791db5570ca73228520107e2a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add deps for jest ([4c831b8](https://github.com/antvis/x6/commit/4c831b84d032cc92f1c914143f4182772202620d))
|
||||
* ✨ add package inherit, compare commands ([d494b9f](https://github.com/antvis/x6/commit/d494b9f92e4e98816fb00acc02296bf5aa63f1b4))
|
||||
* ✨ sharing partial(devDependencies, peerDependencies, dependencies, scripts) package.json ([95c1112](https://github.com/antvis/x6/commit/95c1112c4e226c060dd94019f6ce5530a922a92f))
|
||||
* ✨ update vue deps ([37eae0b](https://github.com/antvis/x6/commit/37eae0b12502fba373d30153e0d1ac2085e843e8))
|
||||
|
||||
# @antv/x6-package-json 1.0.0 (2021-06-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 🐛 fix karma can not process lodash-es ([f7ae6b1](https://github.com/antvis/x6/commit/f7ae6b1f6b961a01c58d8827a9aaa2d5a984a6e0))
|
||||
* 🐛 should only read json files ([af9d87f](https://github.com/antvis/x6/commit/af9d87fedccf4ba791db5570ca73228520107e2a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ add deps for jest ([4c831b8](https://github.com/antvis/x6/commit/4c831b84d032cc92f1c914143f4182772202620d))
|
||||
* ✨ add package inherit, compare commands ([d494b9f](https://github.com/antvis/x6/commit/d494b9f92e4e98816fb00acc02296bf5aa63f1b4))
|
||||
* ✨ sharing partial(devDependencies, peerDependencies, dependencies, scripts) package.json ([95c1112](https://github.com/antvis/x6/commit/95c1112c4e226c060dd94019f6ce5530a922a92f))
|
||||
* ✨ update vue deps ([37eae0b](https://github.com/antvis/x6/commit/37eae0b12502fba373d30153e0d1ac2085e843e8))
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"peerDependencies": {
|
||||
"@angular/core": ">=10.2.3",
|
||||
"@angular/cdk": ">=10.2.3",
|
||||
"@angular/common": "^10.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/core": "^10.2.3",
|
||||
"@angular/cdk": "^10.2.3",
|
||||
"@angular/common": "^10.2.3"
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"peerDependencies": {
|
||||
"antd": ">=4.4.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"antd": "^4.4.2"
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
require('../lib/compare/cli')
|
@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// @see https://github.com/microsoft/package-inherit
|
||||
|
||||
require('../lib/inherit/cli')
|
@ -1,13 +0,0 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.9.1",
|
||||
"fs-extra": "^10.0.0",
|
||||
"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"
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^4.31.0",
|
||||
"@typescript-eslint/parser": "^4.31.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-import": "^2.24.2",
|
||||
"eslint-plugin-jest": "^24.4.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.4.1",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"eslint-plugin-promise": "^5.1.0",
|
||||
"eslint-plugin-react": "^7.25.1",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"eslint-plugin-unicorn": "^36.0.0"
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.0.1",
|
||||
"coveralls": "^3.1.1",
|
||||
"jest": "^27.1.1",
|
||||
"ts-jest": "^27.0.5"
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"@types/jasmine": "^3.9.0",
|
||||
"@types/sinon": "^10.0.2",
|
||||
"coveralls": "^3.1.1",
|
||||
"jasmine-core": "^3.9.0",
|
||||
"karma": "^6.3.4",
|
||||
"karma-chrome-launcher": "^3.1.0",
|
||||
"karma-cli": "^2.0.0",
|
||||
"karma-jasmine": "^4.0.1",
|
||||
"karma-spec-reporter": "^0.0.32",
|
||||
"karma-typescript": "5.3.0",
|
||||
"karma-typescript-es6-transform": "5.3.0",
|
||||
"sinon": "^11.1.2"
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
保持下面两个模块的版本,不然 x6 主包的测试跑步起来
|
||||
- "karma-typescript": "^5.3.0"
|
||||
- "karma-typescript-es6-transform": "^5.3.0"
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"less": "^4.1.1",
|
||||
"stylelint": "^13.13.1",
|
||||
"stylelint-config-prettier": "^8.0.2",
|
||||
"stylelint-config-rational-order": "^0.1.2",
|
||||
"stylelint-config-standard": "^22.0.0",
|
||||
"stylelint-declaration-block-no-ignored-properties": "^2.4.0",
|
||||
"stylelint-order": "^4.1.0"
|
||||
}
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@antv/x6-package-json",
|
||||
"version": "1.0.1",
|
||||
"bin": {
|
||||
"package-compare": "./bin/package-compare.js",
|
||||
"package-inherit": "./bin/package-inherit.js"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"bin"
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "rimraf lib",
|
||||
"lint": "eslint 'src/**/*.{js,ts}?(x)' --fix",
|
||||
"build": "tsc --outDir ./lib",
|
||||
"build:watch": "yarn build --w",
|
||||
"prebuild": "run-s clean",
|
||||
"postinstall": "run-s build",
|
||||
"prepare": "run-s build",
|
||||
"precommit": "lint-staged"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.ts": [
|
||||
"eslint --fix"
|
||||
]
|
||||
},
|
||||
"inherits": [
|
||||
"@antv/x6-package-json/cli.json",
|
||||
"@antv/x6-package-json/eslint.json",
|
||||
"@antv/x6-package-json/rollup.json"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^20.0.0",
|
||||
"@rollup/plugin-node-resolve": "^13.0.4",
|
||||
"@rollup/plugin-replace": "^3.0.0",
|
||||
"@rollup/plugin-typescript": "^8.2.5",
|
||||
"@types/node": "^16.9.1",
|
||||
"@types/parse-package-name": "^0.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.31.0",
|
||||
"@typescript-eslint/parser": "^4.31.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-import": "^2.24.2",
|
||||
"eslint-plugin-jest": "^24.4.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.4.1",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"eslint-plugin-promise": "^5.1.0",
|
||||
"eslint-plugin-react": "^7.25.1",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"eslint-plugin-unicorn": "^36.0.0",
|
||||
"fs-extra": "^10.0.0",
|
||||
"lint-staged": "^11.1.2",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"postcss": "^8.3.6",
|
||||
"prettier": "^2.4.0",
|
||||
"pretty-quick": "^3.1.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^2.56.3",
|
||||
"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",
|
||||
"ts-node": "^10.2.1",
|
||||
"tslib": "^2.3.1",
|
||||
"typescript": "^4.4.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"latest-version": "^5.1.0",
|
||||
"chalk": "^4.1.0",
|
||||
"detect-newline": "^3.1.0",
|
||||
"parse-package-name": "^0.1.0",
|
||||
"workspace-tools": "^0.12.3",
|
||||
"yargs-parser": "^20.2.7"
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8.6 || >=17.0.0",
|
||||
"react-dom": ">=16.8.6 || >=17.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^16.9.13",
|
||||
"react": "^16.12.0",
|
||||
"react-dom": "^16.12.0"
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^20.0.0",
|
||||
"@rollup/plugin-node-resolve": "^13.0.4",
|
||||
"@rollup/plugin-replace": "^3.0.0",
|
||||
"@rollup/plugin-typescript": "^8.2.5",
|
||||
"postcss": "^8.3.6",
|
||||
"rollup": "^2.56.3",
|
||||
"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",
|
||||
"tslib": "^2.3.1"
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"extends": "../../../.eslintrc",
|
||||
"rules": {
|
||||
"no-console": 0
|
||||
}
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import chalk from 'chalk'
|
||||
import latestVersion from 'latest-version'
|
||||
|
||||
const root = path.resolve(__dirname, '../../')
|
||||
const reserved = 'package.json'
|
||||
const sections = ['dependencies', 'devDependencies']
|
||||
const pad = (str: string, max: number) => {
|
||||
return str.length < max
|
||||
? `${str}${Array(max - str.length).join(' ')}`
|
||||
: `${str.substr(0, max - 4)}...`
|
||||
}
|
||||
|
||||
const pkgs = []
|
||||
const files = fs.readdirSync(root)
|
||||
files.forEach((name: string) => {
|
||||
const file = path.join(root, name)
|
||||
const stat = fs.statSync(file)
|
||||
if (stat.isFile() && path.extname(file) === '.json' && name !== reserved) {
|
||||
pkgs.push(file)
|
||||
}
|
||||
})
|
||||
|
||||
pkgs.unshift(path.resolve(__dirname, '../../../../', reserved))
|
||||
|
||||
const moduleNames: string[] = []
|
||||
pkgs.forEach((file) => {
|
||||
const content = fs.readFileSync(file, { encoding: 'utf-8' })
|
||||
const pkgJSON = JSON.parse(content)
|
||||
sections.forEach((section) => {
|
||||
const deps = pkgJSON[section]
|
||||
if (deps) {
|
||||
moduleNames.push(...Object.keys(deps))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
const paths = pkgs.map((file) => path.relative(process.cwd(), file))
|
||||
const maxFileLength = Math.max(...paths.map((item) => item.length)) + 2
|
||||
const maxNameLength = Math.min(
|
||||
Math.max(...moduleNames.map((item) => item.length)) + 2,
|
||||
40,
|
||||
)
|
||||
const maxSectionLength = Math.max(...sections.map((item) => item.length)) + 2
|
||||
const log = (
|
||||
pkg: string,
|
||||
section: string,
|
||||
name: string,
|
||||
local: string,
|
||||
remote: string,
|
||||
highlight?: boolean,
|
||||
) => {
|
||||
const line = `${pad(pkg, maxFileLength)} ${pad(
|
||||
section,
|
||||
maxSectionLength,
|
||||
)} ${pad(name, maxNameLength)} ${pad(local, 10)} ${remote}`
|
||||
console.log(highlight ? chalk.gray(line) : line)
|
||||
}
|
||||
|
||||
console.log()
|
||||
console.log(
|
||||
'Comapre packages local version with latest version on npm registry.',
|
||||
)
|
||||
console.log()
|
||||
|
||||
log('file', 'section', 'name', 'local', 'remote')
|
||||
console.log(
|
||||
Array(maxFileLength + maxSectionLength + maxNameLength + 21).join('-'),
|
||||
)
|
||||
|
||||
pkgs.forEach((file) => {
|
||||
const content = fs.readFileSync(file, { encoding: 'utf-8' })
|
||||
const pkgJSON = JSON.parse(content)
|
||||
const defers: Promise<any>[] = []
|
||||
sections.forEach((section) => {
|
||||
const deps = pkgJSON[section]
|
||||
if (deps) {
|
||||
Object.keys(deps).forEach(async (name) => {
|
||||
const pkg = path.relative(process.cwd(), file)
|
||||
const local = deps[name]
|
||||
const defer = latestVersion(name).then((remote) => {
|
||||
return {
|
||||
pkg,
|
||||
section,
|
||||
name,
|
||||
local,
|
||||
remote,
|
||||
}
|
||||
})
|
||||
defers.push(defer)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
Promise.all(defers).then((arr) => {
|
||||
arr.forEach(({ pkg, section, name, local, remote }) => {
|
||||
const localv = local.replace(/^[\^~]|>=/, '')
|
||||
log(pkg, section, name, local, remote, localv !== remote)
|
||||
})
|
||||
})
|
||||
})
|
@ -1,21 +0,0 @@
|
||||
import { collect } from './collect'
|
||||
|
||||
export function check(cwd: string, args: any) {
|
||||
const updatedInfo = collect(cwd)
|
||||
if (updatedInfo.modifiedPackages.length > 0) {
|
||||
const recoveryCommand = args.recovery || 'package-inherit update'
|
||||
console.error(
|
||||
`
|
||||
The inheritance of package.json is in an inconsistent state.
|
||||
These packages are inconsistent:
|
||||
|
||||
${updatedInfo.modifiedPackages.sort().join('\n')}
|
||||
|
||||
Please run the following command:
|
||||
> ${recoveryCommand}
|
||||
`,
|
||||
)
|
||||
} else {
|
||||
console.log('Nothing needs to be updated.')
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
import yargsParser from 'yargs-parser'
|
||||
import { update } from './update'
|
||||
import { check } from './check'
|
||||
|
||||
const args = yargsParser(process.argv.slice(2))
|
||||
|
||||
const command = args._[0]
|
||||
|
||||
switch (command) {
|
||||
case 'update':
|
||||
update(process.cwd())
|
||||
break
|
||||
|
||||
case 'check':
|
||||
check(process.cwd(), args)
|
||||
break
|
||||
|
||||
default:
|
||||
console.log(`
|
||||
Usage: package-inherit [command] [--recovery]
|
||||
|
||||
This utility will update package.json in a monorepo to inherit from another
|
||||
package.json template. Currently, support the following sections to merge
|
||||
into the package.json
|
||||
|
||||
- scripts
|
||||
- dependencies
|
||||
- devDependencies
|
||||
- peerDependencies
|
||||
|
||||
Commands:
|
||||
|
||||
update updates the package.json for all packages in a monorepo to
|
||||
match inheritance.
|
||||
check checks all the package.json inheritance are consistent.
|
||||
|
||||
Options:
|
||||
|
||||
--recovery custom recovery command to show developers when the check has failed
|
||||
`)
|
||||
break
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import parsePackageName from 'parse-package-name'
|
||||
import { PackageInfos } from 'workspace-tools/lib/types/PackageInfo'
|
||||
import { getPackageInfos } from 'workspace-tools/lib/getPackageInfos'
|
||||
|
||||
type KeyValue = { [key: string]: string }
|
||||
|
||||
export function collect(cwd: string) {
|
||||
const allPackages = getPackageInfos(cwd)
|
||||
const modifiedPackages: string[] = []
|
||||
const sections = [
|
||||
'devDependencies',
|
||||
'peerDependencies',
|
||||
'dependencies',
|
||||
'scripts',
|
||||
]
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const [pkg, pkgInfo] of Object.entries(allPackages)) {
|
||||
// workspace-tools typings are not comprehensive about what is possible,
|
||||
// so we force cast it
|
||||
const inherits = pkgInfo.inherits as string[]
|
||||
if (inherits) {
|
||||
const merged: { [section: string]: KeyValue } = {}
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const inherit of inherits) {
|
||||
const file = resolveInRepo(pkg, inherit, allPackages)
|
||||
if (!file) {
|
||||
throw new Error(`${file} does not exist`)
|
||||
}
|
||||
const inheritInfo = JSON.parse(fs.readFileSync(file, 'utf-8'))
|
||||
|
||||
// Merge inherit infos for given package together before checking
|
||||
// shouldUpdate. This will allows inherit check behavior to be
|
||||
// symmetric with update behavior, which updates packages defined
|
||||
// in multiple inherit files to their last occurrence.
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const section of sections) {
|
||||
merged[section] = {
|
||||
...merged[section],
|
||||
...inheritInfo[section],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const section of sections) {
|
||||
const prev = pkgInfo[section] as KeyValue
|
||||
const next = merged[section]
|
||||
|
||||
if (shouldUpdate(prev, next)) {
|
||||
const combined = { ...prev, ...next }
|
||||
const sorted: KeyValue = {}
|
||||
Object.keys(combined)
|
||||
.sort()
|
||||
.forEach(function (name) {
|
||||
sorted[name] = combined[name]
|
||||
})
|
||||
|
||||
pkgInfo[section] = sorted
|
||||
modifiedPackages.push(pkg)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return { allPackages, modifiedPackages }
|
||||
}
|
||||
|
||||
function resolveInRepo(
|
||||
pkg: string,
|
||||
inherit: string,
|
||||
allPackages: PackageInfos,
|
||||
) {
|
||||
const parsedInfo = parsePackageName(inherit)
|
||||
|
||||
if (parsedInfo.name === '.') {
|
||||
parsedInfo.name = pkg
|
||||
}
|
||||
|
||||
const info = allPackages[parsedInfo.name]
|
||||
if (info) {
|
||||
return path.join(path.dirname(info.packageJsonPath), parsedInfo.path)
|
||||
}
|
||||
}
|
||||
|
||||
function shouldUpdate(mine: KeyValue, theirs?: KeyValue) {
|
||||
if (!theirs) {
|
||||
return false
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const [key, value] of Object.entries(theirs)) {
|
||||
if (mine[key] !== value) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
// Please see: https://github.com/microsoft/package-inherit
|
||||
|
||||
import { update } from './update'
|
||||
import { check } from './check'
|
||||
|
||||
export { update, check }
|
@ -1,27 +0,0 @@
|
||||
import fs from 'fs'
|
||||
import os from 'os'
|
||||
import detectNewline from 'detect-newline'
|
||||
import { collect } from './collect'
|
||||
|
||||
export function update(cwd: string) {
|
||||
const updatedInfo = collect(cwd)
|
||||
if (updatedInfo.modifiedPackages.length > 0) {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const pkg of updatedInfo.modifiedPackages) {
|
||||
const info = updatedInfo.allPackages[pkg]
|
||||
const { packageJsonPath, ...output } = info
|
||||
|
||||
const newLine =
|
||||
detectNewline(fs.readFileSync(info.packageJsonPath, 'utf-8')) || os.EOL
|
||||
|
||||
fs.writeFileSync(
|
||||
info.packageJsonPath,
|
||||
JSON.stringify(output, null, 2).replace(/\n/g, newLine) + newLine,
|
||||
)
|
||||
}
|
||||
console.log(`Updated these packages: `)
|
||||
console.log(updatedInfo.modifiedPackages.sort().join('\n'))
|
||||
} else {
|
||||
console.log('Nothing needs to be updated.')
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"vue-demi": "^0.7.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@vue/composition-api": "^1.0.0-rc.6",
|
||||
"vue": "^2.6.12 || ^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/composition-api": "^1.0.0-rc.6",
|
||||
"vue": "^2.6.12"
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
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'
|
||||
import filesize from 'rollup-plugin-filesize'
|
||||
import typescript from '@rollup/plugin-typescript'
|
||||
|
||||
export default (config) => {
|
||||
const { plugins = [], ...others } = config
|
||||
return {
|
||||
input: './src/index.ts',
|
||||
plugins: [
|
||||
typescript({ declaration: false }),
|
||||
resolve(),
|
||||
commonjs(),
|
||||
replace({
|
||||
preventAssignment: true,
|
||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||
}),
|
||||
terser(),
|
||||
filesize(),
|
||||
...plugins,
|
||||
],
|
||||
...others,
|
||||
}
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-11-14)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-11-08)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-11-08)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-11-07)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-11-05)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-11-03)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-11-01)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-10-22)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-10-19)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-10-12)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-10-12)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-10-08)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-10-02)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-10-02)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-10-01)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-10-01)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-10-01)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-10-01)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-09-30)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-09-22)
|
||||
|
||||
## @antv/stylelint-config [1.0.1](https://github.com/antvis/x6/compare/@antv/stylelint-config@1.0.0...@antv/stylelint-config@1.0.1) (2021-09-13)
|
||||
|
||||
# @antv/stylelint-config 1.0.0 (2021-06-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* update dependencies and fix type errors ([#1103](https://github.com/antvis/x6/issues/1103)) ([056b862](https://github.com/antvis/x6/commit/056b862b4efe7dbdc559cac7194c2453996acc07))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ sharing stylelint configurations ([5061c5d](https://github.com/antvis/x6/commit/5061c5ddf875f43578e8f0f81801151f80c51ee9))
|
||||
|
||||
# @antv/stylelint-config 1.0.0 (2021-06-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* update dependencies and fix type errors ([#1103](https://github.com/antvis/x6/issues/1103)) ([056b862](https://github.com/antvis/x6/commit/056b862b4efe7dbdc559cac7194c2453996acc07))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ sharing stylelint configurations ([5061c5d](https://github.com/antvis/x6/commit/5061c5ddf875f43578e8f0f81801151f80c51ee9))
|
||||
|
||||
# @antv/stylelint-config 1.0.0 (2021-06-15)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ sharing stylelint configurations ([5061c5d](https://github.com/antvis/x6/commit/5061c5ddf875f43578e8f0f81801151f80c51ee9))
|
||||
|
||||
# @antv/stylelint-config 1.0.0 (2021-06-15)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ sharing stylelint configurations ([5061c5d](https://github.com/antvis/x6/commit/5061c5ddf875f43578e8f0f81801151f80c51ee9))
|
||||
|
||||
# @antv/stylelint-config 1.0.0 (2021-06-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* ✨ sharing stylelint configurations ([5061c5d](https://github.com/antvis/x6/commit/5061c5ddf875f43578e8f0f81801151f80c51ee9))
|
@ -1,63 +0,0 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@antv/stylelint-config",
|
||||
"version": "1.0.1",
|
||||
"main": "./lib/index.js",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"clean": "rimraf lib",
|
||||
"lint": "eslint 'src/**/*.{js,ts}?(x)' --fix",
|
||||
"build": "tsc --outDir ./lib",
|
||||
"build:watch": "yarn build --w",
|
||||
"prebuild": "run-s clean",
|
||||
"postinstall": "run-s build",
|
||||
"prepare": "run-s build",
|
||||
"precommit": "lint-staged"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.ts": [
|
||||
"eslint --fix"
|
||||
]
|
||||
},
|
||||
"inherits": [
|
||||
"@antv/x6-package-json/cli.json",
|
||||
"@antv/x6-package-json/less.json",
|
||||
"@antv/x6-package-json/eslint.json"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.9.1",
|
||||
"@typescript-eslint/eslint-plugin": "^4.31.0",
|
||||
"@typescript-eslint/parser": "^4.31.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-import": "^2.24.2",
|
||||
"eslint-plugin-jest": "^24.4.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.4.1",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"eslint-plugin-promise": "^5.1.0",
|
||||
"eslint-plugin-react": "^7.25.1",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"eslint-plugin-unicorn": "^36.0.0",
|
||||
"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",
|
||||
"stylelint": "^13.13.1",
|
||||
"stylelint-config-prettier": "^8.0.2",
|
||||
"stylelint-config-rational-order": "^0.1.2",
|
||||
"stylelint-config-standard": "^22.0.0",
|
||||
"stylelint-declaration-block-no-ignored-properties": "^2.4.0",
|
||||
"stylelint-order": "^4.1.0",
|
||||
"ts-node": "^10.2.1",
|
||||
"typescript": "^4.4.3",
|
||||
"watch": "^1.0.2"
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
module.exports = {
|
||||
extends: [
|
||||
'stylelint-config-standard',
|
||||
'stylelint-config-rational-order',
|
||||
'stylelint-config-prettier',
|
||||
],
|
||||
plugins: [
|
||||
'stylelint-order',
|
||||
'stylelint-declaration-block-no-ignored-properties',
|
||||
],
|
||||
rules: {
|
||||
'block-no-empty': null,
|
||||
'function-name-case': 'lower',
|
||||
'comment-empty-line-before': null,
|
||||
'no-invalid-double-slash-comments': null,
|
||||
'no-descending-specificity': null,
|
||||
'declaration-empty-line-before': null,
|
||||
'no-duplicate-selectors': null,
|
||||
},
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
# http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "eslint-config-umi"
|
||||
}
|
20
examples/x6-app-dag/.gitignore
vendored
20
examples/x6-app-dag/.gitignore
vendored
@ -1,20 +0,0 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/npm-debug.log*
|
||||
/yarn-error.log
|
||||
/yarn.lock
|
||||
/package-lock.json
|
||||
|
||||
# production
|
||||
/dist
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
|
||||
# umi
|
||||
/src/.umi
|
||||
/src/.umi-production
|
||||
/src/.umi-test
|
||||
/.env.local
|
@ -1,8 +0,0 @@
|
||||
**/*.md
|
||||
**/*.svg
|
||||
**/*.ejs
|
||||
**/*.html
|
||||
package.json
|
||||
.umi
|
||||
.umi-production
|
||||
.umi-test
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"semi": false,
|
||||
"printWidth": 80,
|
||||
"overrides": [
|
||||
{
|
||||
"files": ".prettierrc",
|
||||
"options": {
|
||||
"parser": "json"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
import { defineConfig } from 'umi'
|
||||
|
||||
export default defineConfig({
|
||||
publicPath: './',
|
||||
routes: [
|
||||
{ path: '/', component: '@/pages/index' },
|
||||
{ path: '/apps/dag', component: '@/pages/index' },
|
||||
],
|
||||
theme: {
|
||||
'@ant-prefix': 'ant',
|
||||
'@menu-item-active-bg': '#f0f5ff',
|
||||
},
|
||||
extraBabelPlugins: [
|
||||
[
|
||||
'import',
|
||||
{
|
||||
libraryName: '@antv/x6-react-components',
|
||||
libraryDirectory: 'es',
|
||||
transformToDefaultImport: false,
|
||||
style: true,
|
||||
},
|
||||
],
|
||||
],
|
||||
})
|
File diff suppressed because it is too large
Load Diff
@ -1,15 +0,0 @@
|
||||
# X6 DAG React demo project
|
||||
|
||||
## Getting Started
|
||||
|
||||
Install dependencies,
|
||||
|
||||
```bash
|
||||
$ yarn
|
||||
```
|
||||
|
||||
Start the dev server,
|
||||
|
||||
```bash
|
||||
$ yarn start
|
||||
```
|
@ -1,50 +0,0 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@antv/x6-app-dag",
|
||||
"version": "1.1.7",
|
||||
"scripts": {
|
||||
"start": "umi dev",
|
||||
"build": "umi build",
|
||||
"postinstall": "umi generate tmp",
|
||||
"prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",
|
||||
"test": "umi-test",
|
||||
"lint": "umi-lint --eslint src/ -p.no-semi --prettier --fix",
|
||||
"test:coverage": "umi-test --coverage"
|
||||
},
|
||||
"gitHooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,jsx,less,md,json}": [
|
||||
"prettier --write"
|
||||
],
|
||||
"*.ts?(x)": [
|
||||
"prettier --parser=typescript --write"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^4.2.1",
|
||||
"@antv/x6": "^1.30.2",
|
||||
"@antv/x6-react-components": "^1.1.16",
|
||||
"@antv/x6-react-shape": "^1.6.0",
|
||||
"@types/dompurify": "^2.0.4",
|
||||
"ahooks": "^2.7.0",
|
||||
"antd": "^4.4.2",
|
||||
"classnames": "^2.2.6",
|
||||
"dompurify": "^2.1.1",
|
||||
"react": "^16.13.1",
|
||||
"react-dnd": "^11.1.3",
|
||||
"react-dnd-html5-backend": "^11.1.3",
|
||||
"react-dom": "^16.13.1",
|
||||
"umi-lint": "^2.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ant-design/pro-layout": "^5.0.12",
|
||||
"@umijs/preset-react": "1.x",
|
||||
"@umijs/test": "^3.2.19",
|
||||
"lint-staged": "^10.5.3",
|
||||
"prettier": "^2.2.1",
|
||||
"umi": "^3.2.19",
|
||||
"yorkie": "^2.0.0"
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
import React, { useEffect, useMemo, useState } from 'react'
|
||||
import { BehaviorSubject, Observable } from 'rxjs'
|
||||
|
||||
export const useObservableState = <T extends any>(
|
||||
source$: Observable<T> | { (): Observable<T> },
|
||||
initialState?: T,
|
||||
): [T, React.Dispatch<React.SetStateAction<T>>] => {
|
||||
const source = useMemo<Observable<T>>(() => {
|
||||
if (typeof source$ === 'function') {
|
||||
return source$()
|
||||
}
|
||||
return source$
|
||||
}, [source$])
|
||||
const [state, setState] = useState<T>(() => {
|
||||
if (source instanceof BehaviorSubject) {
|
||||
return source.getValue()
|
||||
}
|
||||
return initialState
|
||||
})
|
||||
useEffect(() => {
|
||||
const sub = source.subscribe((v) => {
|
||||
setState(v)
|
||||
})
|
||||
return () => {
|
||||
sub.unsubscribe()
|
||||
}
|
||||
}, [source])
|
||||
return [state, setState]
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
export { unescape } from 'lodash-es'
|
||||
|
||||
export class Deferred<T> {
|
||||
resolve!: (value?: T) => void
|
||||
|
||||
reject!: (err?: any) => void
|
||||
|
||||
promise: Promise<T>
|
||||
|
||||
constructor() {
|
||||
this.promise = new Promise<T>((resolve, reject) => {
|
||||
this.resolve = resolve
|
||||
this.reject = reject
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 解析 JSON 字符串不引起报错
|
||||
export const safeJson = (jsonStr = '{}', defaultVal = {}) => {
|
||||
try {
|
||||
return JSON.parse(jsonStr)
|
||||
} catch (error) {
|
||||
console.warn(`${jsonStr} is not valid json`)
|
||||
return defaultVal
|
||||
}
|
||||
}
|
||||
|
||||
export class CodeName {
|
||||
static parse(codeName = '') {
|
||||
return codeName.replace(/_\d+$/, '').toLocaleLowerCase()
|
||||
}
|
||||
|
||||
static equal(c1: string, c2: string) {
|
||||
return CodeName.parse(c1) === CodeName.parse(c2)
|
||||
}
|
||||
|
||||
static some(list: string[], c2: string) {
|
||||
return list.some((c1) => CodeName.equal(c1, c2))
|
||||
}
|
||||
|
||||
static getFromNode(node: any = {}) {
|
||||
const { codeName = '' } = node
|
||||
return CodeName.parse(codeName)
|
||||
}
|
||||
}
|
||||
|
||||
export const isPromise = (obj: any) =>
|
||||
!!obj &&
|
||||
(typeof obj === 'object' || typeof obj === 'function') &&
|
||||
typeof obj.then === 'function'
|
@ -1,6 +0,0 @@
|
||||
.no-wrap {
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
import React, { useCallback } from 'react'
|
||||
import styles from './cut.less'
|
||||
|
||||
interface Props {
|
||||
left: number
|
||||
right: number
|
||||
max: number
|
||||
children: string
|
||||
}
|
||||
|
||||
export const Cut: React.FC<Props> = (props) => {
|
||||
const { left, right = 0, max, children } = props
|
||||
const getText = useCallback(() => {
|
||||
const len = children.length
|
||||
const ellipsis = '...'
|
||||
let leftStr = ''
|
||||
let rightStr = ''
|
||||
|
||||
if (len > max) {
|
||||
if (left && len) {
|
||||
leftStr = children.substr(0, left)
|
||||
} else {
|
||||
leftStr = children.substr(0, max)
|
||||
}
|
||||
|
||||
if (right) {
|
||||
rightStr = children.substr(-right, right)
|
||||
}
|
||||
|
||||
return `${leftStr}${ellipsis}${rightStr}`
|
||||
}
|
||||
|
||||
return children
|
||||
}, [left, right, max, children])
|
||||
return <span className={styles['no-wrap']}>{getText()}</span>
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
import React from 'react'
|
||||
import { unescape } from 'lodash-es'
|
||||
import { Cut } from '@/component/cut'
|
||||
import { Keyword } from '@/component/keyword'
|
||||
|
||||
interface Props {
|
||||
data: any
|
||||
}
|
||||
|
||||
export const ItemName: React.FC<Props> = (props) => {
|
||||
const { data } = props
|
||||
const { keyword, cutParas = {} } = data
|
||||
const name = unescape(data.name)
|
||||
const { max, side } = cutParas
|
||||
if (keyword) {
|
||||
return <Keyword raw={name} keyword={keyword} />
|
||||
}
|
||||
if (max) {
|
||||
return (
|
||||
<Cut max={max} left={side} right={side}>
|
||||
{name}
|
||||
</Cut>
|
||||
)
|
||||
}
|
||||
return <span>{name}</span>
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
.keywordWrapper {
|
||||
strong {
|
||||
color: #dd4b39;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
max-width: 200px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
import React from 'react'
|
||||
import classnames from 'classnames'
|
||||
import styles from './keyword.less'
|
||||
|
||||
interface Props {
|
||||
raw: string
|
||||
keyword: string
|
||||
className?: string
|
||||
}
|
||||
|
||||
export const Keyword: React.FC<Props> = (props) => {
|
||||
const { raw, keyword, className } = props
|
||||
if (keyword) {
|
||||
const regex = new RegExp(keyword, 'ig')
|
||||
const arr = raw.split(regex)
|
||||
return (
|
||||
<span
|
||||
className={classnames({
|
||||
[styles.keywordWrapper]: true,
|
||||
[className!]: !!className,
|
||||
})}
|
||||
>
|
||||
{arr.map((section, index) =>
|
||||
index !== arr.length - 1 ? (
|
||||
<span key={section + index}>
|
||||
{section}
|
||||
<strong>{keyword}</strong>
|
||||
</span>
|
||||
) : (
|
||||
section
|
||||
),
|
||||
)}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
return null
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import { Modal, ConfigProvider } from 'antd'
|
||||
import { ModalFuncProps, ModalProps } from 'antd/es/modal'
|
||||
import { isPromise } from '@/common/utils'
|
||||
import { ANT_PREFIX } from '@/constants/global'
|
||||
|
||||
type ShowProps = ModalProps & {
|
||||
afterClose?: (...args: any[]) => void
|
||||
children: React.ReactNode
|
||||
}
|
||||
|
||||
export const showModal = (props: ShowProps) => {
|
||||
const div = document.createElement('div')
|
||||
document.body.appendChild(div)
|
||||
|
||||
let config: ShowProps = {
|
||||
...props,
|
||||
visible: true,
|
||||
onCancel: close,
|
||||
onOk: (e) => {
|
||||
if (typeof props.onOk === 'function') {
|
||||
const ret = props.onOk(e)
|
||||
if (isPromise(ret as any)) {
|
||||
;(ret as any).then(() => {
|
||||
close()
|
||||
})
|
||||
}
|
||||
} else {
|
||||
close()
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
function destroy(...args: any[]) {
|
||||
const unmountResult = ReactDOM.unmountComponentAtNode(div)
|
||||
if (unmountResult && div.parentNode) {
|
||||
div.parentNode.removeChild(div)
|
||||
}
|
||||
if (typeof props.afterClose === 'function') {
|
||||
props.afterClose(...args)
|
||||
}
|
||||
}
|
||||
|
||||
function update(newConfig: ModalFuncProps) {
|
||||
config = {
|
||||
...config,
|
||||
...newConfig,
|
||||
}
|
||||
render(config)
|
||||
}
|
||||
|
||||
function close(...args: any[]) {
|
||||
const nextConfig = {
|
||||
...config,
|
||||
visible: false,
|
||||
afterClose: destroy.bind(undefined, ...args),
|
||||
}
|
||||
update(nextConfig)
|
||||
}
|
||||
|
||||
function render(usedConfig: ModalProps & { children: React.ReactNode }) {
|
||||
const { children, ...others } = usedConfig
|
||||
setTimeout(() => {
|
||||
ReactDOM.render(
|
||||
<ConfigProvider prefixCls={ANT_PREFIX}>
|
||||
<Modal {...others}>{children}</Modal>
|
||||
</ConfigProvider>,
|
||||
div,
|
||||
)
|
||||
}, 0)
|
||||
}
|
||||
|
||||
render(config)
|
||||
|
||||
return {
|
||||
close,
|
||||
update,
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
import React from 'react'
|
||||
import { Observable } from 'rxjs'
|
||||
import { Input, ConfigProvider } from 'antd'
|
||||
import { InputProps } from 'antd/es/input'
|
||||
import { useObservableState } from '@/common/hooks/useObservableState'
|
||||
import { ANT_PREFIX } from '@/constants/global'
|
||||
|
||||
interface RxInputProps extends Omit<InputProps, 'value'> {
|
||||
value: Observable<string>
|
||||
}
|
||||
|
||||
export const RxInput: React.FC<RxInputProps> = (props) => {
|
||||
const { value, ...otherProps } = props
|
||||
const [realValue] = useObservableState(() => value)
|
||||
return (
|
||||
<ConfigProvider prefixCls={ANT_PREFIX}>
|
||||
<Input value={realValue} {...otherProps} />
|
||||
</ConfigProvider>
|
||||
)
|
||||
}
|
@ -1 +0,0 @@
|
||||
export const ANT_PREFIX = 'ant'
|
@ -1,14 +0,0 @@
|
||||
export const GROUP_HORIZONTAL__PADDING = 24 // 分组横向 padding
|
||||
export const GROUP_VERTICAL__PADDING = 40 // 分组纵向 padding
|
||||
export const NODE_WIDTH = 180
|
||||
export const NODE_HEIGHT = 32
|
||||
|
||||
// 触发画布重新渲染事件
|
||||
export const RERENDER_EVENT = 'RERENDER_EVENT'
|
||||
|
||||
/*
|
||||
* 以下是拖拽相关
|
||||
*/
|
||||
|
||||
export const DRAGGABLE_ALGO_COMPONENT = 'ALGO_COMPONENT'
|
||||
export const DRAGGABLE_MODEL = 'MODEL'
|
@ -1,42 +0,0 @@
|
||||
.menuWrap {
|
||||
max-height: 316px;
|
||||
overflow: auto;
|
||||
position: relative;
|
||||
top: -10px;
|
||||
left: -1px;
|
||||
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.1);
|
||||
:global {
|
||||
.@{ant-prefix}-menu-item {
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
padding: 0px 8px;
|
||||
margin: 0 !important;
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
font-size: 13px;
|
||||
&:hover {
|
||||
color: #1890ff;
|
||||
background-color: @menu-item-active-bg;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.name {
|
||||
padding-right: 2px;
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
|
||||
.wrap {
|
||||
height: 48px;
|
||||
margin-left: 24px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.divider {
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.dropdown {
|
||||
color: rgba(0, 0, 0, 0.65);
|
||||
font-size: 12px;
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
import React from 'react'
|
||||
import css from './index.less'
|
||||
|
||||
export interface IProps {
|
||||
experimentName?: string
|
||||
}
|
||||
|
||||
export const ExperimentTitle: React.FC<IProps> = ({ experimentName }) => {
|
||||
return (
|
||||
<div className={css.wrap}>
|
||||
<span className={css.name}> {experimentName} </span>
|
||||
</div>
|
||||
)
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
.header {
|
||||
z-index: 99;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 48px;
|
||||
min-height: 48px;
|
||||
overflow: hidden;
|
||||
line-height: 48px;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.08);
|
||||
padding: 0;
|
||||
.headerLeft,
|
||||
.headerRight {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
.doc {
|
||||
margin-right: 32px;
|
||||
font-size: 12px;
|
||||
a {
|
||||
color: rgba(0, 0, 0, 0.65);
|
||||
}
|
||||
|
||||
.text {
|
||||
padding: 0 4px;
|
||||
color: rgba(0, 0, 0, 0.65);
|
||||
}
|
||||
|
||||
:global {
|
||||
.anticon {
|
||||
position: relative;
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
import React from 'react'
|
||||
import { Layout } from 'antd'
|
||||
import { useObservableState } from '@/common/hooks/useObservableState'
|
||||
import { useExperimentGraph } from '@/pages/rx-models/experiment-graph'
|
||||
import { GithubOutlined } from '@ant-design/icons'
|
||||
import { SimpleLogo } from './logo'
|
||||
import { ExperimentTitle } from './experiment-title'
|
||||
|
||||
import css from './index.less'
|
||||
|
||||
const { Header } = Layout
|
||||
|
||||
interface IProps {
|
||||
experimentId: string
|
||||
}
|
||||
|
||||
export const GuideHeader: React.FC<IProps> = (props) => {
|
||||
const expGraph = useExperimentGraph(props.experimentId)
|
||||
const [activeExperiment] = useObservableState(expGraph.experiment$)
|
||||
|
||||
const openGithub = () => {
|
||||
window.open(
|
||||
'https://github.com/antvis/X6/tree/master/examples/x6-app-dag',
|
||||
'_blank',
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header className={css.header}>
|
||||
<div className={css.headerLeft}>
|
||||
<SimpleLogo />
|
||||
<ExperimentTitle experimentName={activeExperiment.name} />
|
||||
</div>
|
||||
<div className={css.headerRight}>
|
||||
<div className={css.doc}>
|
||||
<GithubOutlined onClick={openGithub} />
|
||||
</div>
|
||||
</div>
|
||||
</Header>
|
||||
</>
|
||||
)
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
.root {
|
||||
height: 48px;
|
||||
width: 64px;
|
||||
line-height: 48px;
|
||||
position: relative;
|
||||
border-right: 1px solid rgba(0, 0, 0, 0.08);
|
||||
color: #fba831;
|
||||
}
|
||||
|
||||
.logo {
|
||||
top: 8px;
|
||||
left: 18px;
|
||||
position: absolute;
|
||||
font-size: 28px;
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
import React from 'react'
|
||||
import { ApartmentOutlined } from '@ant-design/icons'
|
||||
import css from './index.less'
|
||||
|
||||
interface Props {
|
||||
border?: boolean
|
||||
}
|
||||
|
||||
export const SimpleLogo: React.FC<Props> = ({ border }) => {
|
||||
return (
|
||||
<div className={`${css.root} `}>
|
||||
<ApartmentOutlined className={css.logo} />
|
||||
</div>
|
||||
)
|
||||
}
|
@ -1,268 +0,0 @@
|
||||
export const algoData = [
|
||||
{
|
||||
id: 'recentlyUsed',
|
||||
name: '最近使用',
|
||||
isDir: true,
|
||||
children: [
|
||||
{
|
||||
id: 10,
|
||||
defSource: 2,
|
||||
docUrl: '',
|
||||
ioType: 0,
|
||||
up: 148,
|
||||
down: 11,
|
||||
iconType: 1,
|
||||
isDisabled: false,
|
||||
author: 'demo author',
|
||||
codeName: 'algo_1',
|
||||
catId: 1,
|
||||
lastModifyTime: '2020-08-25 15:43:39',
|
||||
createdTime: '2015-04-16 13:38:11',
|
||||
engineType: 0,
|
||||
isComposite: false,
|
||||
sequence: 0,
|
||||
owner: 'system',
|
||||
description: '组件描述信息',
|
||||
name: '算法组件1',
|
||||
parentId: 'recentlyUsed',
|
||||
isBranch: false,
|
||||
social: {
|
||||
defSource: 2,
|
||||
isEnabled: true,
|
||||
docUrl: '#',
|
||||
iconType: 1,
|
||||
isDisabled: false,
|
||||
author: 'demo author',
|
||||
codeName: 'algo_1',
|
||||
catId: 1,
|
||||
lastModifyTime: '2020-08-25 15:43:39',
|
||||
createdTime: '2015-04-16 13:38:11',
|
||||
owner: 'system',
|
||||
description: '组件描述信息',
|
||||
name: '算法组件1',
|
||||
id: 10,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
defSource: 2,
|
||||
docUrl: '',
|
||||
ioType: 0,
|
||||
up: 148,
|
||||
down: 11,
|
||||
iconType: 1,
|
||||
isDisabled: false,
|
||||
author: 'demo author',
|
||||
codeName: 'algo_2',
|
||||
catId: 1,
|
||||
lastModifyTime: '2020-08-25 15:43:39',
|
||||
createdTime: '2015-04-16 13:38:11',
|
||||
engineType: 0,
|
||||
isComposite: false,
|
||||
sequence: 0,
|
||||
owner: 'system',
|
||||
description: '组件描述信息',
|
||||
name: '算法组件2',
|
||||
parentId: 'recentlyUsed',
|
||||
isBranch: false,
|
||||
social: {
|
||||
defSource: 2,
|
||||
isEnabled: true,
|
||||
docUrl: '#',
|
||||
iconType: 1,
|
||||
isDisabled: false,
|
||||
author: 'demo author',
|
||||
codeName: 'algo_2',
|
||||
catId: 1,
|
||||
lastModifyTime: '2020-08-25 15:43:39',
|
||||
createdTime: '2015-04-16 13:38:11',
|
||||
owner: 'system',
|
||||
description: '组件描述信息',
|
||||
name: '算法组件2',
|
||||
id: 11,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
defSource: 2,
|
||||
docUrl: '',
|
||||
ioType: 0,
|
||||
up: 148,
|
||||
down: 11,
|
||||
iconType: 1,
|
||||
isDisabled: false,
|
||||
author: 'demo author',
|
||||
codeName: 'algo_3',
|
||||
catId: 1,
|
||||
lastModifyTime: '2020-08-25 15:43:39',
|
||||
createdTime: '2015-04-16 13:38:11',
|
||||
engineType: 0,
|
||||
isComposite: false,
|
||||
sequence: 0,
|
||||
owner: 'system',
|
||||
description: '组件描述信息',
|
||||
name: '算法组件3',
|
||||
parentId: 'recentlyUsed',
|
||||
isBranch: false,
|
||||
social: {
|
||||
defSource: 2,
|
||||
isEnabled: true,
|
||||
docUrl: '#',
|
||||
iconType: 1,
|
||||
isDisabled: false,
|
||||
author: 'demo author',
|
||||
codeName: 'algo_3',
|
||||
catId: 1,
|
||||
lastModifyTime: '2020-08-25 15:43:39',
|
||||
createdTime: '2015-04-16 13:38:11',
|
||||
owner: 'system',
|
||||
description: '组件描述信息',
|
||||
name: '算法组件3',
|
||||
id: 12,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: '数据读写',
|
||||
id: 21,
|
||||
category: 'source',
|
||||
isDir: true,
|
||||
children: [
|
||||
{
|
||||
defSource: 2,
|
||||
docUrl: '',
|
||||
ioType: 0,
|
||||
up: 148,
|
||||
down: 11,
|
||||
iconType: 1,
|
||||
isDisabled: false,
|
||||
author: 'demo author',
|
||||
codeName: 'odps_source',
|
||||
catId: 1,
|
||||
lastModifyTime: '2020-08-25 15:43:39',
|
||||
createdTime: '2015-04-16 13:38:11',
|
||||
engineType: 0,
|
||||
isComposite: false,
|
||||
sequence: 0,
|
||||
owner: 'system',
|
||||
description: '组件描述信息',
|
||||
name: '读数据表',
|
||||
id: 100,
|
||||
parentId: 'recentlyUsed',
|
||||
isBranch: false,
|
||||
social: {
|
||||
defSource: 2,
|
||||
isEnabled: true,
|
||||
docUrl: '#',
|
||||
iconType: 1,
|
||||
isDisabled: false,
|
||||
author: 'demo author',
|
||||
codeName: 'odps_source',
|
||||
catId: 1,
|
||||
lastModifyTime: '2020-08-25 15:43:39',
|
||||
createdTime: '2015-04-16 13:38:11',
|
||||
owner: 'system',
|
||||
description: '组件描述信息',
|
||||
name: '读数据表',
|
||||
id: 100,
|
||||
},
|
||||
},
|
||||
],
|
||||
isBranch: true,
|
||||
isExpanded: false,
|
||||
codeName: 'source',
|
||||
parentId: 'platformAlgo',
|
||||
},
|
||||
{
|
||||
name: '统计分析',
|
||||
id: 22,
|
||||
category: 'analytics',
|
||||
isDir: true,
|
||||
children: [],
|
||||
isBranch: true,
|
||||
isExpanded: false,
|
||||
codeName: 'analytics',
|
||||
parentId: 'platformAlgo',
|
||||
},
|
||||
{
|
||||
name: '算法',
|
||||
id: 23,
|
||||
category: 'ai_algo',
|
||||
isDir: true,
|
||||
children: [],
|
||||
isBranch: true,
|
||||
isExpanded: false,
|
||||
codeName: 'algorithm',
|
||||
parentId: 'platformAlgo',
|
||||
},
|
||||
{
|
||||
name: '预测',
|
||||
id: 24,
|
||||
category: 'predict',
|
||||
isDir: true,
|
||||
children: [],
|
||||
isBranch: true,
|
||||
isExpanded: false,
|
||||
codeName: 'predict',
|
||||
parentId: 'platformAlgo',
|
||||
},
|
||||
{
|
||||
name: '评估',
|
||||
id: 25,
|
||||
category: 'evaluation',
|
||||
isDir: true,
|
||||
children: [],
|
||||
isBranch: true,
|
||||
isExpanded: false,
|
||||
codeName: 'evaluation',
|
||||
parentId: 'platformAlgo',
|
||||
},
|
||||
]
|
||||
|
||||
export const searchByKeyword = async (keyword: string) => {
|
||||
return Array(10)
|
||||
.fill(null)
|
||||
.map((i, idx) => {
|
||||
return {
|
||||
defSource: 2,
|
||||
docUrl: '',
|
||||
ioType: 0,
|
||||
up: 148,
|
||||
down: 11,
|
||||
iconType: 1,
|
||||
isDir: false,
|
||||
isDisabled: false,
|
||||
author: 'demo author',
|
||||
codeName: `${keyword}${idx}`,
|
||||
catId: 1,
|
||||
lastModifyTime: '2020-08-25 15:43:39',
|
||||
createdTime: '2015-04-16 13:38:11',
|
||||
engineType: 0,
|
||||
isComposite: false,
|
||||
sequence: 0,
|
||||
owner: 'system',
|
||||
description: '组件描述信息',
|
||||
name: `${keyword}__${idx}`,
|
||||
id: idx,
|
||||
parentId: 'recentlyUsed',
|
||||
isBranch: false,
|
||||
social: {
|
||||
defSource: 2,
|
||||
isEnabled: true,
|
||||
docUrl: '#',
|
||||
iconType: 1,
|
||||
isDisabled: false,
|
||||
author: 'demo author',
|
||||
name: `${keyword}-${idx}`,
|
||||
codeName: `${keyword}${idx}`,
|
||||
catId: 1,
|
||||
lastModifyTime: '2020-08-25 15:43:39',
|
||||
createdTime: '2015-04-16 13:38:11',
|
||||
owner: 'system',
|
||||
description: '组件描述信息',
|
||||
id: idx,
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
@ -1,720 +0,0 @@
|
||||
import random from 'lodash/random'
|
||||
|
||||
interface NodeParams {
|
||||
name: string
|
||||
x: number
|
||||
y: number
|
||||
}
|
||||
|
||||
export const copyNode = ({ name, x, y }: NodeParams) => {
|
||||
const id = `${Date.now()}`
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
inPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输入1',
|
||||
id: id + 100000,
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输入2',
|
||||
id: id + 200000,
|
||||
},
|
||||
],
|
||||
outPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输出表1',
|
||||
id: id + 300000,
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输出表2',
|
||||
id: id + 400000,
|
||||
},
|
||||
],
|
||||
positionX: x + 200 + random(20, false),
|
||||
positionY: y + random(10, false),
|
||||
codeName: 'source_11111',
|
||||
catId: 1,
|
||||
nodeDefId: 111111,
|
||||
category: 'source',
|
||||
status: 3,
|
||||
groupId: 0,
|
||||
}
|
||||
}
|
||||
export const addNode = ({ name, x, y }: NodeParams) => {
|
||||
const id = `${Date.now()}`
|
||||
return {
|
||||
id,
|
||||
name,
|
||||
inPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输入1',
|
||||
id: id + '_in_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输入2',
|
||||
id: id + '_in_2',
|
||||
},
|
||||
],
|
||||
outPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输出表1',
|
||||
id: id + '_out_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输出表2',
|
||||
id: id + '_out_2',
|
||||
},
|
||||
],
|
||||
positionX: x,
|
||||
positionY: y,
|
||||
codeName: 'source_11111',
|
||||
catId: 1,
|
||||
nodeDefId: 111111,
|
||||
category: 'source',
|
||||
status: 3,
|
||||
groupId: 0,
|
||||
}
|
||||
}
|
||||
|
||||
export const queryGraph = (id: string) => {
|
||||
return {
|
||||
lang: 'zh_CN',
|
||||
success: true,
|
||||
data: initData,
|
||||
Lang: 'zh_CN',
|
||||
}
|
||||
}
|
||||
|
||||
export const addNodeGroup = async (groupName: string) => {
|
||||
return {
|
||||
success: true,
|
||||
data: {
|
||||
group: {
|
||||
name: groupName,
|
||||
id: Date.now(),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
const initData = {
|
||||
nodes: [
|
||||
{
|
||||
id: '1603716783816',
|
||||
name: '算法组件1',
|
||||
inPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输入1',
|
||||
id: '1603716783816_in_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输入2',
|
||||
id: '1603716783816_in_2',
|
||||
},
|
||||
],
|
||||
outPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输出表1',
|
||||
id: '1603716783816_out_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输出表2',
|
||||
id: '1603716783816_out_2',
|
||||
},
|
||||
],
|
||||
positionX: -200,
|
||||
positionY: -300,
|
||||
codeName: 'source_11111',
|
||||
catId: 1,
|
||||
nodeDefId: 111111,
|
||||
category: 'source',
|
||||
status: 3,
|
||||
groupId: 0,
|
||||
},
|
||||
{
|
||||
id: '1603716786205',
|
||||
name: '算法组件2',
|
||||
inPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输入1',
|
||||
id: '1603716786205_in_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输入2',
|
||||
id: '1603716786205_in_2',
|
||||
},
|
||||
],
|
||||
outPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输出表1',
|
||||
id: '1603716786205_out_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输出表2',
|
||||
id: '1603716786205_out_2',
|
||||
},
|
||||
],
|
||||
positionX: -369,
|
||||
positionY: -161,
|
||||
codeName: 'source_11111',
|
||||
catId: 1,
|
||||
nodeDefId: 111111,
|
||||
category: 'source',
|
||||
status: 3,
|
||||
groupId: 0,
|
||||
},
|
||||
{
|
||||
id: '1603716788394',
|
||||
name: '算法组件2',
|
||||
inPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输入1',
|
||||
id: '1603716788394_in_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输入2',
|
||||
id: '1603716788394_in_2',
|
||||
},
|
||||
],
|
||||
outPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输出表1',
|
||||
id: '1603716788394_out_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输出表2',
|
||||
id: '1603716788394_out_2',
|
||||
},
|
||||
],
|
||||
positionX: -154,
|
||||
positionY: -161,
|
||||
codeName: 'source_11111',
|
||||
catId: 1,
|
||||
nodeDefId: 111111,
|
||||
category: 'source',
|
||||
status: 3,
|
||||
groupId: 0,
|
||||
},
|
||||
{
|
||||
id: '1603716792826',
|
||||
name: '算法组件3',
|
||||
inPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输入1',
|
||||
id: '1603716792826_in_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输入2',
|
||||
id: '1603716792826_in_2',
|
||||
},
|
||||
],
|
||||
outPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输出表1',
|
||||
id: '1603716792826_out_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输出表2',
|
||||
id: '1603716792826_out_2',
|
||||
},
|
||||
],
|
||||
positionX: -520,
|
||||
positionY: -30,
|
||||
codeName: 'source_11111',
|
||||
catId: 1,
|
||||
nodeDefId: 111111,
|
||||
category: 'source',
|
||||
status: 3,
|
||||
groupId: 0,
|
||||
},
|
||||
{
|
||||
id: '1603716795011',
|
||||
name: '算法组件2',
|
||||
inPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输入1',
|
||||
id: '1603716795011_in_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输入2',
|
||||
id: '1603716795011_in_2',
|
||||
},
|
||||
],
|
||||
outPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输出表1',
|
||||
id: '1603716795011_out_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输出表2',
|
||||
id: '1603716795011_out_2',
|
||||
},
|
||||
],
|
||||
positionX: 74,
|
||||
positionY: -160,
|
||||
codeName: 'source_11111',
|
||||
catId: 1,
|
||||
nodeDefId: 111111,
|
||||
category: 'source',
|
||||
status: 3,
|
||||
groupId: 0,
|
||||
},
|
||||
{
|
||||
id: '1603716814719',
|
||||
name: '算法组件3',
|
||||
inPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输入1',
|
||||
id: '1603716814719_in_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输入2',
|
||||
id: '1603716814719_in_2',
|
||||
},
|
||||
],
|
||||
outPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输出表1',
|
||||
id: '1603716814719_out_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输出表2',
|
||||
id: '1603716814719_out_2',
|
||||
},
|
||||
],
|
||||
positionX: -310,
|
||||
positionY: -30,
|
||||
codeName: 'source_11111',
|
||||
catId: 1,
|
||||
nodeDefId: 111111,
|
||||
category: 'source',
|
||||
status: 3,
|
||||
groupId: 0,
|
||||
},
|
||||
{
|
||||
id: '1603716822805',
|
||||
name: '算法组件3',
|
||||
inPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输入1',
|
||||
id: '1603716822805_in_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输入2',
|
||||
id: '1603716822805_in_2',
|
||||
},
|
||||
],
|
||||
outPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输出表1',
|
||||
id: '1603716822805_out_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输出表2',
|
||||
id: '1603716822805_out_2',
|
||||
},
|
||||
],
|
||||
positionX: -50,
|
||||
positionY: -30,
|
||||
codeName: 'source_11111',
|
||||
catId: 1,
|
||||
nodeDefId: 111111,
|
||||
category: 'source',
|
||||
status: 3,
|
||||
groupId: 0,
|
||||
},
|
||||
{
|
||||
id: '1603716828657',
|
||||
name: '算法组件3',
|
||||
inPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输入1',
|
||||
id: '1603716828657_in_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输入2',
|
||||
id: '1603716828657_in_2',
|
||||
},
|
||||
],
|
||||
outPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输出表1',
|
||||
id: '1603716828657_out_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输出表2',
|
||||
id: '1603716828657_out_2',
|
||||
},
|
||||
],
|
||||
positionX: 160,
|
||||
positionY: -30,
|
||||
codeName: 'source_11111',
|
||||
catId: 1,
|
||||
nodeDefId: 111111,
|
||||
category: 'source',
|
||||
status: 3,
|
||||
groupId: 0,
|
||||
},
|
||||
{
|
||||
id: '1603716834901',
|
||||
name: '算法组件2',
|
||||
inPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输入1',
|
||||
id: '1603716834901_in_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输入2',
|
||||
id: '1603716834901_in_2',
|
||||
},
|
||||
],
|
||||
outPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输出表1',
|
||||
id: '1603716834901_out_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输出表2',
|
||||
id: '1603716834901_out_2',
|
||||
},
|
||||
],
|
||||
positionX: -390,
|
||||
positionY: 90,
|
||||
codeName: 'source_11111',
|
||||
catId: 1,
|
||||
nodeDefId: 111111,
|
||||
category: 'source',
|
||||
status: 3,
|
||||
groupId: 0,
|
||||
},
|
||||
{
|
||||
id: '1603716844054',
|
||||
name: '算法组件2',
|
||||
inPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输入1',
|
||||
id: '1603716844054_in_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输入2',
|
||||
id: '1603716844054_in_2',
|
||||
},
|
||||
],
|
||||
outPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输出表1',
|
||||
id: '1603716844054_out_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输出表2',
|
||||
id: '1603716844054_out_2',
|
||||
},
|
||||
],
|
||||
positionX: -170,
|
||||
positionY: 90,
|
||||
codeName: 'source_11111',
|
||||
catId: 1,
|
||||
nodeDefId: 111111,
|
||||
category: 'source',
|
||||
status: 3,
|
||||
groupId: 0,
|
||||
},
|
||||
{
|
||||
id: '1603716854368',
|
||||
name: '算法组件2',
|
||||
inPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输入1',
|
||||
id: '1603716854368_in_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输入2',
|
||||
id: '1603716854368_in_2',
|
||||
},
|
||||
],
|
||||
outPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输出表1',
|
||||
id: '1603716854368_out_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输出表2',
|
||||
id: '1603716854368_out_2',
|
||||
},
|
||||
],
|
||||
positionX: 40,
|
||||
positionY: 90,
|
||||
codeName: 'source_11111',
|
||||
catId: 1,
|
||||
nodeDefId: 111111,
|
||||
category: 'source',
|
||||
status: 3,
|
||||
groupId: 0,
|
||||
},
|
||||
{
|
||||
id: '1603716858435',
|
||||
name: '算法组件3',
|
||||
inPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输入1',
|
||||
id: '1603716858435_in_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输入2',
|
||||
id: '1603716858435_in_2',
|
||||
},
|
||||
],
|
||||
outPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输出表1',
|
||||
id: '1603716858435_out_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输出表2',
|
||||
id: '1603716858435_out_2',
|
||||
},
|
||||
],
|
||||
positionX: -310,
|
||||
positionY: 230,
|
||||
codeName: 'source_11111',
|
||||
catId: 1,
|
||||
nodeDefId: 111111,
|
||||
category: 'source',
|
||||
status: 3,
|
||||
groupId: 0,
|
||||
},
|
||||
{
|
||||
id: '1603716868041',
|
||||
name: '算法组件2',
|
||||
inPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输入1',
|
||||
id: '1603716868041_in_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输入2',
|
||||
id: '1603716868041_in_2',
|
||||
},
|
||||
],
|
||||
outPorts: [
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 1,
|
||||
description: '输出表1',
|
||||
id: '1603716868041_out_1',
|
||||
},
|
||||
{
|
||||
tableName: 'germany_credit_data',
|
||||
sequence: 2,
|
||||
description: '输出表2',
|
||||
id: '1603716868041_out_2',
|
||||
},
|
||||
],
|
||||
positionX: -100,
|
||||
positionY: 230,
|
||||
codeName: 'source_11111',
|
||||
catId: 1,
|
||||
nodeDefId: 111111,
|
||||
category: 'source',
|
||||
status: 3,
|
||||
groupId: 0,
|
||||
},
|
||||
],
|
||||
links: [
|
||||
{
|
||||
source: '1603716783816',
|
||||
target: '1603716786205',
|
||||
outputPortId: '1603716783816_out_1',
|
||||
inputPortId: '1603716786205_in_1',
|
||||
},
|
||||
{
|
||||
source: '1603716783816',
|
||||
target: '1603716788394',
|
||||
outputPortId: '1603716783816_out_2',
|
||||
inputPortId: '1603716788394_in_1',
|
||||
},
|
||||
{
|
||||
source: '1603716783816',
|
||||
target: '1603716795011',
|
||||
outputPortId: '1603716783816_out_2',
|
||||
inputPortId: '1603716795011_in_1',
|
||||
},
|
||||
{
|
||||
source: '1603716786205',
|
||||
target: '1603716792826',
|
||||
outputPortId: '1603716786205_out_1',
|
||||
inputPortId: '1603716792826_in_1',
|
||||
},
|
||||
{
|
||||
source: '1603716788394',
|
||||
target: '1603716814719',
|
||||
outputPortId: '1603716788394_out_1',
|
||||
inputPortId: '1603716814719_in_1',
|
||||
},
|
||||
{
|
||||
source: '1603716795011',
|
||||
target: '1603716822805',
|
||||
outputPortId: '1603716795011_out_1',
|
||||
inputPortId: '1603716822805_in_1',
|
||||
},
|
||||
{
|
||||
source: '1603716795011',
|
||||
target: '1603716828657',
|
||||
outputPortId: '1603716795011_out_2',
|
||||
inputPortId: '1603716828657_in_2',
|
||||
},
|
||||
{
|
||||
source: '1603716792826',
|
||||
target: '1603716834901',
|
||||
outputPortId: '1603716792826_out_1',
|
||||
inputPortId: '1603716834901_in_1',
|
||||
},
|
||||
{
|
||||
source: '1603716814719',
|
||||
target: '1603716844054',
|
||||
outputPortId: '1603716814719_out_1',
|
||||
inputPortId: '1603716844054_in_1',
|
||||
},
|
||||
{
|
||||
source: '1603716822805',
|
||||
target: '1603716854368',
|
||||
outputPortId: '1603716822805_out_1',
|
||||
inputPortId: '1603716854368_in_1',
|
||||
},
|
||||
{
|
||||
source: '1603716834901',
|
||||
target: '1603716858435',
|
||||
outputPortId: '1603716834901_out_1',
|
||||
inputPortId: '1603716858435_in_1',
|
||||
},
|
||||
{
|
||||
source: '1603716844054',
|
||||
target: '1603716858435',
|
||||
outputPortId: '1603716844054_out_1',
|
||||
inputPortId: '1603716858435_in_2',
|
||||
},
|
||||
{
|
||||
source: '1603716854368',
|
||||
target: '1603716868041',
|
||||
outputPortId: '1603716854368_out_1',
|
||||
inputPortId: '1603716868041_in_1',
|
||||
},
|
||||
],
|
||||
}
|
@ -1,108 +0,0 @@
|
||||
import get from 'lodash/get'
|
||||
import set from 'lodash/set'
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
|
||||
let state = {
|
||||
idx: 0,
|
||||
running: false,
|
||||
statusRes: {
|
||||
lang: 'zh_CN',
|
||||
success: true,
|
||||
data: {
|
||||
instStatus: {
|
||||
'10571193': 'success',
|
||||
'10571194': 'success',
|
||||
'10571195': 'success',
|
||||
'10571196': 'success',
|
||||
'10571197': 'success',
|
||||
},
|
||||
execInfo: {
|
||||
'10571193': {
|
||||
jobStatus: 'success',
|
||||
defName: '读数据表',
|
||||
name: 'germany_credit_data',
|
||||
id: 10571193,
|
||||
},
|
||||
'10571194': {
|
||||
jobStatus: 'success',
|
||||
defName: '离散值特征分析',
|
||||
name: '离散值特征分析',
|
||||
id: 10571194,
|
||||
},
|
||||
'10571195': {
|
||||
jobStatus: 'success',
|
||||
defName: '分箱',
|
||||
startTime: '2020-10-19 13:28:55',
|
||||
endTime: '2020-10-19 13:30:20',
|
||||
name: '分箱',
|
||||
id: 10571195,
|
||||
},
|
||||
'10571196': {
|
||||
jobStatus: 'success',
|
||||
defName: '评分卡训练',
|
||||
startTime: '2020-10-19 13:28:55',
|
||||
endTime: '2020-10-19 13:32:02',
|
||||
name: '评分卡训练-1',
|
||||
id: 10571196,
|
||||
},
|
||||
},
|
||||
status: 'default',
|
||||
},
|
||||
Lang: 'zh_CN',
|
||||
} as any,
|
||||
}
|
||||
|
||||
export const runGraph = async (nodes: any[]) => {
|
||||
const newState = getStatus()
|
||||
newState.data.instStatus = {}
|
||||
newState.data.execInfo = {}
|
||||
nodes.forEach((node) => {
|
||||
newState.data.instStatus[node.id] = 'default'
|
||||
newState.data.execInfo[node.id] = {
|
||||
jobStatus: 'default',
|
||||
defName: node.name,
|
||||
startTime: '2020-10-19 13:28:55',
|
||||
endTime: '2020-10-19 13:32:02',
|
||||
name: node.name,
|
||||
id: 10571196,
|
||||
}
|
||||
})
|
||||
state.running = true
|
||||
state.idx = 0
|
||||
state.statusRes = newState
|
||||
return { success: true }
|
||||
}
|
||||
|
||||
export const stopGraphRun = () => {
|
||||
state.running = false
|
||||
state.idx = 0
|
||||
return { success: true }
|
||||
}
|
||||
|
||||
const getStatus = () => cloneDeep(state.statusRes)
|
||||
|
||||
export const queryGraphStatus = async () => {
|
||||
const newState = getStatus()
|
||||
// console.log('Call Api QueryGraphStatus', state)
|
||||
if (state.running) {
|
||||
const { instStatus, execInfo } = newState.data
|
||||
const idList = Object.keys(instStatus)
|
||||
if (state.idx === idList.length) {
|
||||
state.idx = 0
|
||||
state.running = false
|
||||
idList.forEach((id) => {
|
||||
set(instStatus, id, 'success')
|
||||
set(execInfo, `${id}.jobStatus`, 'success')
|
||||
set(newState, 'data.status', 'success')
|
||||
})
|
||||
return newState
|
||||
}
|
||||
const key = get(idList, state.idx)
|
||||
set(instStatus, key, 'running')
|
||||
set(execInfo, `${key}.jobStatus`, 'running')
|
||||
set(newState, 'data.status', 'running')
|
||||
state.idx += 1
|
||||
return newState
|
||||
}
|
||||
return newState
|
||||
}
|
@ -1,123 +0,0 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
import { useCallback, useState } from 'react'
|
||||
import { algoData, searchByKeyword } from '../mock/algo'
|
||||
|
||||
export namespace Res {
|
||||
export interface Data {
|
||||
defs: NodeDef[]
|
||||
cats: Cat[]
|
||||
}
|
||||
|
||||
export interface NodeDef {
|
||||
up: number
|
||||
down: number
|
||||
defSource: number
|
||||
catName: string
|
||||
isDeprecated: boolean
|
||||
isSubscribed: boolean
|
||||
isEnabled: boolean
|
||||
iconType: number
|
||||
docUrl: string
|
||||
sequence: number
|
||||
author?: string
|
||||
ioType: number
|
||||
lastModifyTime: string
|
||||
createdTime: string
|
||||
catId: number
|
||||
isComposite: boolean
|
||||
codeName: string
|
||||
engineType?: number
|
||||
description?: string
|
||||
name: string
|
||||
id: number
|
||||
type: number
|
||||
owner: string
|
||||
algoSourceType?: number
|
||||
}
|
||||
|
||||
export interface Cat {
|
||||
defSource: number
|
||||
isEnabled: boolean
|
||||
iconType: number
|
||||
codeName: string
|
||||
description: string
|
||||
sequence: number
|
||||
name: string
|
||||
id: number
|
||||
category?: string
|
||||
}
|
||||
}
|
||||
|
||||
function dfs(
|
||||
path = '',
|
||||
nodes: any[],
|
||||
isTarget: (node: any) => boolean,
|
||||
result: string[] = [],
|
||||
) {
|
||||
nodes.forEach((node, idx) => {
|
||||
if (node.children) {
|
||||
const currentIdx = path ? `${path}.${idx}.children` : `${idx}.children`
|
||||
dfs(currentIdx, node.children, isTarget, result)
|
||||
}
|
||||
|
||||
if (isTarget(node)) {
|
||||
const currentIdx = path ? `${path}.${idx}` : idx
|
||||
result.push(currentIdx.toString())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export default () => {
|
||||
const [keyword, setKeyword] = useState<string>('') // 搜索关键字
|
||||
const [loading, setLoading] = useState<boolean>(false) // 加载状态
|
||||
const [componentTreeNodes, setComponentTreeNodes] = useState<any[]>([])
|
||||
const [searchList, setSearchList] = useState<any[]>([]) // 搜索结果列表
|
||||
|
||||
// 加载组件
|
||||
const loadComponentNodes = useCallback(() => {
|
||||
setLoading(true)
|
||||
const load = async () => {
|
||||
try {
|
||||
if (algoData) {
|
||||
setComponentTreeNodes(algoData)
|
||||
}
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
return load()
|
||||
}, [])
|
||||
|
||||
// 搜索组件
|
||||
const search = useCallback((params: { keyword: string }) => {
|
||||
setKeyword(params.keyword ? params.keyword : '')
|
||||
if (!params.keyword) {
|
||||
return
|
||||
}
|
||||
setLoading(true)
|
||||
|
||||
const load = async () => {
|
||||
try {
|
||||
const nodes = ([] = await searchByKeyword(params.keyword))
|
||||
setSearchList(nodes)
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
load()
|
||||
}, [])
|
||||
|
||||
return {
|
||||
// 状态
|
||||
keyword,
|
||||
loading,
|
||||
componentTreeNodes,
|
||||
searchList,
|
||||
|
||||
// 方法
|
||||
setKeyword,
|
||||
loadComponentNodes,
|
||||
search,
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
@import (reference) '~antd/es/style/themes/default.less';
|
||||
|
||||
.handler {
|
||||
position: absolute;
|
||||
top: 61px;
|
||||
right: 14px;
|
||||
z-index: 99;
|
||||
width: 32px;
|
||||
margin: 0;
|
||||
padding: 3px 0;
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
font-size: 16px;
|
||||
list-style-type: none;
|
||||
background-color: #fff;
|
||||
border: 1px solid rgba(0, 0, 0, 0.04);
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 0 20px rgba(0, 0, 0, 0.01);
|
||||
|
||||
.item {
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: #000;
|
||||
background-color: #e0e0e0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.popover {
|
||||
:global {
|
||||
.@{ant-prefix}-popover-inner-content {
|
||||
padding: 3px 8px;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
import React from 'react'
|
||||
import { Popover } from 'antd'
|
||||
import {
|
||||
CompressOutlined,
|
||||
OneToOneOutlined,
|
||||
ZoomInOutlined,
|
||||
ZoomOutOutlined,
|
||||
} from '@ant-design/icons'
|
||||
import classNames from 'classnames'
|
||||
import styles from './index.less'
|
||||
|
||||
interface Props {
|
||||
className?: string
|
||||
onZoomIn: () => void
|
||||
onZoomOut: () => void
|
||||
onFitContent: () => void
|
||||
onRealContent: () => void
|
||||
}
|
||||
|
||||
export const CanvasHandler: React.FC<Props> = (props) => {
|
||||
const { className, onZoomIn, onZoomOut, onFitContent, onRealContent } = props
|
||||
|
||||
return (
|
||||
<ul className={classNames(styles.handler, className)}>
|
||||
<Popover
|
||||
overlayClassName={styles.popover}
|
||||
content="放大"
|
||||
placement="left"
|
||||
>
|
||||
<li onClick={onZoomIn} className={styles.item}>
|
||||
<ZoomInOutlined />
|
||||
</li>
|
||||
</Popover>
|
||||
<Popover
|
||||
overlayClassName={styles.popover}
|
||||
content="缩小"
|
||||
placement="left"
|
||||
>
|
||||
<li onClick={onZoomOut} className={styles.item}>
|
||||
<ZoomOutOutlined />
|
||||
</li>
|
||||
</Popover>
|
||||
<Popover
|
||||
overlayClassName={styles.popover}
|
||||
content="实际尺寸"
|
||||
placement="left"
|
||||
>
|
||||
<li onClick={onRealContent} className={styles.item}>
|
||||
<OneToOneOutlined />
|
||||
</li>
|
||||
</Popover>
|
||||
<Popover
|
||||
overlayClassName={styles.popover}
|
||||
content="适应画布"
|
||||
placement="left"
|
||||
>
|
||||
<li onClick={onFitContent} className={styles.item}>
|
||||
<CompressOutlined />
|
||||
</li>
|
||||
</Popover>
|
||||
</ul>
|
||||
)
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user