Commit Graph

4998 Commits

Author SHA1 Message Date
Aaron
b7bbc29704
refactor: adjust project and add 3d extension package (#5497)
* refactor: remove g6-plugin-map-view and react-node

* refactor: adjust exports

* chore: update deps, use turbo to batch build

* feat(3d): init g6-extension-3d package

* chore: update turbo config

* refactor: fix cr issues
2024-03-05 19:13:37 +08:00
Aaron
3c3e8979bf
refactor(elements): adjust element type definitions (#5494) 2024-03-05 16:40:39 +08:00
Joel Alan
948f868912
fix: dev scripts (#5482) 2024-03-05 15:17:50 +08:00
Aaron
0a74e2f973
refactor: change widget to plugin (#5490)
* refactor: rename widget to plugin

* refactor: change module to extension
2024-03-05 15:00:06 +08:00
Aaron
2fc6e0ebdb
feat(runtime): support fit api (#5489)
* refactor(utils): union support multiple bboxes

* fix(test): fix test env

* refactor(utils): add getBBoxSize, multiple and divide support number

* refactor(spec): adjust animation, add extra viewport options

* refactor(behaviors): zoom canvas set pointer position as origin when wheel

* refactor(behaviors): drag-canvas use graph api

* feat(runtime): support fit api

* refactor(test): update test case and snapshot use x,y

* refactor(animation): add getAnimation util to get global animation config

* refactor(utils): remove getElementsBBox, and extend union to getCombinedBBox
2024-03-04 20:44:24 +08:00
Yuxin
f9e2ac6815
feat(combo): add circle combo element (#5473)
* feat: circle combo

* refactor: ci

* refactor: registry typo

* feat: test combo children change

* refactor: combo animation

* refactor: circle combo

* refactor: base-combo

* refactor: combo collapsed marker

* test: add combo test

* refactor: fix cr issues
2024-03-04 19:02:12 +08:00
Yuxin
c0d02134f6
fix: fix issues that wrong getEllipseIntersectPoint (#5485)
* fix: fix issues that wrong getEllipseIntersectPoint

* test: update test snapshots
2024-03-01 13:20:42 +08:00
Aaron
251b9a8528
refactor: adjust test env (#5479)
* refactor(test): use lil-gui in demo env

* refactor(runtime): graph viewport api use default canvas center as origin

* refactor(runtime): layout support preset options

* refactor(test): remove createGraph

* refactor(test): update test case and snapshot

* test: add test cases
2024-02-29 15:09:56 +08:00
Aaron
b98a164d5f
feat: add drag canvas behavior (#5475)
* refactor(types): rename loose to loosen

* feat(utils): add Shortcut util

* refactor(behaviors): refactor zoom canvas with shortcuts

* chore(test): update toBeCloseTo message style

* feat(behaviors): add drag-canvas behavior

* refactor(utils): abstract out module from behavior and widget

* feat(runtime): add widget controller

* refactor: fix cr issues
2024-02-28 15:45:25 +08:00
Yuxin
e802349d81
docs: add build-in and custom arrows demos (#5477)
* refactor: simplify arrow size setting

* test: add buildin and custom arrows tests

* docs: add arrows site demos

* test: add arrow snapshots
2024-02-28 12:34:24 +08:00
omahs
7539c3eb99
docs: fix typos (#5476)
* fix typos

* fix typo

* fix typos

* fix typos
2024-02-27 21:07:36 +08:00
Aaron
b86bdcde91
feat: add behavior controller and zoom-canvas (#5470)
* feat(utils): add parseBehaviors util

* feat(constants): add events definition

* refactor(event): rename Event to BaseEvent

* refactor(utils): adjust events

* refactor(utils): move isNode to element

* feat(utils): add isEdge util

* feat(utils): add eventTargetOf util

* feat(runtime): add behavior controller

* refactor(runtime): viewport emit standard event

* feat(behaviors): add zoom-canvas

* chore(test): update test env

* refactor(runtime): export event, destroy behavior, add test cases
2024-02-26 18:48:21 +08:00
Aaron
d2d2bc6507
refactor(elements): optimize elements types (#5472) 2024-02-26 16:56:43 +08:00
Yuxin
634d5960f4
feat: add light and dark theme; node supports new badgePalette attribute (#5467)
* feat(node): support new badgePalette attribute

* feat: add light theme and dark theme;update demo and test panel

* refactor(site): update site demos

* refactor: rename disable to disabled

* refactor: rename disable to disabled

---------

Co-authored-by: Aaron <yangtao.yangtao@antgroup.com>
2024-02-26 15:45:59 +08:00
Aaron
1096dd903d
refactor: adjust test env and fix element types (#5471)
* chore(test): support alias in test cases

* chore(test): adjust test utils, add toMatchSnapshot

* chore(tests): use path alias in tests

* feat(utils): add parseSize util

* chore: set vite alias config

* fix(elements): fix elements types and remove edge sourcePoints

* refactor(tests): adapt size and remove sourcePoint, update snapshots

* refactor(runtime): remove sleep usage
2024-02-26 10:24:02 +08:00
hustcc
17de905d81
refactor: type define (#5468)
* chore: add 3d sphere file

* test: add createDeterministicRandom for 3d test data

* chore: simplify type define

* fix: create webgl instance

* chore: remove sphere
2024-02-23 18:51:22 +08:00
Yuxin
491838604a
docs: add line demo (#5464)
* docs: add line demo

* test: update test snapshots

* test: add unit tests

* fix: fix cr issues

* fix: fix cr issues
2024-02-23 10:50:05 +08:00
Yuxin
d0f8d526f3
fix: fix issue that wrong label bg when rotate (#5462)
* fix: fix issue that wrong label bg when rotate

* test: update test snapshots
2024-02-22 20:41:55 +08:00
Song Pengjie (宋鹏捷)
8af3cf0bb0
feat: add image node (#5417)
* fix: contextmenu event emit (#5380)

Co-authored-by: 宋鹏捷 <songpengjie@abtnetworks.com>

* feat: add image node

* fix: remove empty method

* fix: remove fill color for image node

* feat: add image node

* test: update image node snapshot

* test: update controller viewport snapshot

* fix: update unit test and fix bugs for image node

* fix: fix code review issue

* fix: remove console.log

* fix: fix code review issue

* ci: add ci for pull request

* fix: add getIconStyle for image node

* fix: fix ci issue and code review issue

---------

Co-authored-by: 宋鹏捷 <songpengjie@abtnetworks.com>
2024-02-22 18:48:34 +08:00
hustcc
75906453f1
docs: add ellipse, star demo (#5457)
* docs: add ellipse demo

* feat: calculate icon size by key shape attribute

* chore: add ICON_SIZE_RATIO constant
2024-02-22 15:59:46 +08:00
Aaron
50bb0cc1cb
refactor(runtime): adapt polyline and cubic edges (#5458)
* refactor(registry): register built-in edges

* fix(utils): fix getEllipseIntersectPoint get NaN result

* refactor(runtime): adapt more edges

* fix: fix cr issues
2024-02-22 15:56:21 +08:00
hustcc
b364dba430
docs: add radius rect demo, and draw rect node with GRect (#5452)
* docs: add radius rect demo, and draw rect node with GRect

* test: upadte node-rect with Graph

* chore: fix ci

* fix: rect anchor draw error
2024-02-22 10:44:04 +08:00
Aaron
836efe4376
refactor: adjust render and draw async invoke (#5456)
* refactor(runtime): adjust async render process

* refactor(runtime): setup default zoom

* test: update layout test case

* refactor(runtime): remove context param from controller api
2024-02-22 09:37:09 +08:00
Yuxin
cce285be70
feat: polyline supports orthogonal routing and loop (#5449)
* feat: polyline supports orthogonal routing

* feat: orth routing adapts ports

* refactor: draw cubic loop

* feat: add polyline loop

* feat: optimize loop radius calculation

* test: update unit snapshots

* test: add unit tests

* fix: fix code review

* test: add orth route ut

---------

Co-authored-by: banxuan.zyx <banxuan.zyx@antgroup.com>
2024-02-22 09:35:14 +08:00
Aaron
288c7b34bf
refactor: replace the animation return value with an event throw (#5445)
* fix(animation): fix issue that onfinish is override

* refactor: emit animation event instead of return

* refactor(element): optimize invoke logic

* refactor(events): rename event name

* refactor(runtime): adjust event value

* refactor(demo): dev env support display timer

* refactor(runtime): rename element render to draw

* feat(utils): add isEmptyData util

* refactor(utils): modify createAnimationsProxy, add withAnimationCallbacks, executeAnimatableTasks

* refactor(runtime): refactor element controller, add events

* refactor: adjust async draw, layout, emit render event
2024-02-21 17:19:10 +08:00
hustcc
bb09bc447b
docs: add triangle demo (#5451)
* docs: add triangle demo

* fix: halo stroke should be key fill

* fix: remove port width, height, use r to set the radius
2024-02-21 13:20:10 +08:00
hustcc
619cf7d26b
feat: add portXyy and badgeXyy options (#5450)
* feat: add portFill and badgeFill options

* chore: change .js to .ts
2024-02-20 21:41:25 +08:00
hustcc
9c8ae0e12a
feat: add autoResize in graph (#5448)
* feat: add autoResize in graph

* chore: fix cr

* refactor: onResize base on resize + debounce
2024-02-20 19:13:21 +08:00
hustcc
a4a2299ea4
docs: make site build (#5446)
* chore: make site build

* docs: make api reference work

* chore: add case gallery

* docs: add one demo
2024-02-20 13:25:29 +08:00
Yuxin
095581a3b3
feat: edge supports portLinkToCenter attributes (#5447)
* feat(port): add linkToCenter attribute

* fix: ci

* refactor: rename getCurveControlPoint function

* refactor: update snapshots related to port

---------

Co-authored-by: banxuan.zyx <banxuan.zyx@antgroup.com>
2024-02-20 12:51:49 +08:00
hustcc
a4346ddc2b
test: add test case for viewport with svg renderer (#5441)
* test: add test case for viewport with svg renderer

* chore: rename file

* chore: update test case

* chore: keep the comment

* feat: add createGraphCavas, and use it in main.ts

* chore: move viewport.spec.ts to unit

* test: use real graph instance instead of mock

* chore: remove unused code

* chore: fix ci
2024-02-19 20:54:12 +08:00
Aaron
0f21e8d6fa
refactor(event): unified event name naming style (#5444) 2024-02-19 20:08:03 +08:00
hustcc
b693790821
refactor: move all plugin into build-in, and remove constants.ts file (#5440)
* refactor: move all build in to one file, and remove constants.ts file

* chore: fix ci
2024-02-19 11:44:13 +08:00
Aaron
135640afd4
feat: add graph class (#5439)
* refactor(runtime): element provide setElementState api

* refactor(runtime): data update getElementType returns

* feat(utils): add toPointObject util

* test(demos): support render custom panel

* feat(utils): add cacheStyle and getCachedStyle utils

* feat(runtime): element support setElementsVisibility API

* feat(runtime): element support setElementZIndex API

* feat(runtime): emit graph event

* refactor(runtime): implement setElementState, support partial style calc

* refactor(spec): container support canvas instance

* test(runtime): update snapshots

* feat(graph): init graph

* refactor(test): remove getEnv util

* test: fix test case issue

* refactor(utils): rename transformTreeDataToGraphData to treeToGraphData

* test(runtime): add test assertion
2024-02-19 09:58:36 +08:00
Aaron
b51a86e730
feat: add layout controller (#5423)
* refactor(runtime): rename dataController in context to model

* feat(utils): add isVisible and update uitls

* refactor(layout): update layout types and register built-in layouts

* feat(utils): add deduplicate util

* refactor(utils): update inferDefaultValue to infer position

* refactor(element): add updateNodeLikePosition method to update position immediately

* feat(runtime): data controller support call methods without trace

* fix(animation): it's neccessary to reserve commonEffectTiming config

* fix(test): fix test case issue

* feat(utils): add tree data converter utils

* refactor(runtime): update element controller, add get element api, and updateByLayoutResult method

* feat(utils): add layout utils

* refactor(layout): add built-in layouts

* refactor(elements): add built-in edges

* feat(runtime): add layout controller

* test(layout): add and update test snapshot

* test: update test case

* refactor(utils): remove transformGraphDataToTreeData

* fix: fix issue occured in rebase

* refactor(layout): add built-in layout registration

* refactor(spec): support config global animation

* test(runtime): update element controller snapshots

* fix(elements): fix issue that edge lack of default control points

* refactor(runtime): support tree layout

* fix(elements): fix issue that unexpect loop edge infer

* fix(runtime): fix layout error, support global animation, optimize updateNodeLikePosition method

* test(layout): add static layout test case

* refactor(test): update dendrogram snapshot

* fix(utils): fix pickLayoutResult test case

* refactor(types): add positions type

* refactor(runtime): optimize element updateNodeLikePosition perf

* fix(test): fix test case types issue

* test(demo): update test demos

* refactor(utils): modify transformTreeDataToGraphData default getNodeData

* refactor(runtime): data controller provide getParentData API

* refactor(runtime): rename sneak to silence

* refactor(layout): add comment

* refactor(registry): use console.error instead of throw when plugin duplicated
2024-02-18 11:36:50 +08:00
Aaron
39c8deafb2
fix(utils): fix issue that unexpected object attribute value animation (#5434)
* fix(utils): fix issue that unexpected object attribute value animation

* refactor(animation): update animation keyframe types

* test: update snapshots

* refactor(elements): omit context from grphicStyle
2024-02-08 10:27:19 +08:00
Yuxin
8436aaa9a8
refactor: draw nodes (#5427)
* refactor: draw nodes

* refactor: rename anchorOptions to anchors;rename badgeOptions to badges

* chore: update ts

* test: update ut snapshots

* refactor: circle node

* refactor: ellipse node

* refactor: rect node

* refactor: rename  to

* refactor: star node

* refactor: triangle node

* refactor: update animation fields

---------

Co-authored-by: yvonneyx <banxuan.zyx@antgroup.com>
2024-02-07 22:30:26 +08:00
Aaron
712ca23e35
chore: update tsconfig (#5433) 2024-02-07 15:25:40 +08:00
Yuxin
36f579c86b
fix: function (#5432)
Co-authored-by: yvonneyx <banxuan.zyx@antgroup.com>
2024-02-07 13:38:20 +08:00
Aaron
2dd9412cba
refactor(spec): rename DataOptions to GraphData (#5430) 2024-02-07 10:48:30 +08:00
Cee
8831b15b88
feat: v5 ellipse node (#5426)
* feat(shape): add ellipse node

* chore: remove canvas.init()

* fix: modify haloStyle according to keyShape lineWidth

* fix: update 'lineWidth' of rect and ellipse in haloStyle
2024-02-06 15:33:47 +08:00
A_Bo
1ce481d0cc
feat: add triangle node (#5421)
* feat: add triangle shape

* feat: update triangle snapshots

* fix: fix triangle anchor type

* feat: fix review problem

* feat: update triangle snapshots

* fix: fix review problem

---------

Co-authored-by: liwenbo <liwenbo@kanzhun.com>
2024-02-06 11:49:36 +08:00
Yuxin
4bc31f71e7
feat(edge): add loop as part of edge (#5422)
* feat(edge): add loop edge element

* feat: update demo

* refactor: change loop edge from an element to part of base edge

* test: update ut snapshots

* chore: fix code review

* chore: fix cr

---------

Co-authored-by: yvonneyx <banxuan.zyx@antgroup.com>
2024-02-06 10:28:17 +08:00
Frank William
6c5d407710
feat(v5): add rect node (#5420)
* feat(v5): add rect node

---------

Co-authored-by: wb-xcf804241 <wb-xcf804241@alibaba-inc.com>
2024-02-05 11:18:46 +08:00
Aaron
fafec34990
feat: add viewport controller (#5416)
* feat: add viewport controller

* test: add test case
2024-02-04 17:21:28 +08:00
hustcc
84874b10f3
feat: update node default style (#5415)
* chore: update node render order

* feat: add node default style

* feat: badge align style with different position

* feat: add maxWidth and wordWrapWidth for edge

* chore: fix ci

* chore: remove isEmpty, use antv util
2024-02-04 16:50:12 +08:00
Yuxin
dd31335682
feat(edge): calculate endpoints of edge (#5419)
* feat(edge): calculate endpoints

* chore: fix code review

---------

Co-authored-by: yvonneyx <banxuan.zyx@antgroup.com>
2024-02-04 16:06:48 +08:00
hustcc
e6f4623314
feat: add star node (#5410)
* feat: add star node

* test: add test case

* test: add test case for star anchor

* chore: for coverage

* feat: padding = 0 when undefined

* fix: remove import type
2024-02-03 09:37:59 +08:00
Yuxin
183fe3a4fd
feat(edge): add simple polyline edge element (#5412)
* feat(edge): add simple polyline edge element

* chore: fix code review

---------

Co-authored-by: yvonneyx <banxuan.zyx@antgroup.com>
2024-02-02 18:05:56 +08:00
Aaron
c763217197
feat(runtime): add element controller (#5393)
* feat(themes): add theme plugin type definition

* feat(palettes): add palette utils and plugin type definition

* feat(utils): add computeElementCallbackStyle util

* refactor(spec): edge data style support config sourcePort and targetPort

* refactor(animation): adjust executor to adapt undefined animation

* test(spec): fix spec animation test case

* feat(palettes): add built-in palettes

* refactor(utils): adjust palette default logic

* feat(theme): add built in theme

* feat(runtime): add element controller

* refactor(spec): rename port to anchor

* test(registry): update registry test case

* refactor(palettes): remove built in palettes to canstants

* refactor(runtime): data controler remove event emit and provide getChanges API

* refactor(registry): register built-in nodes and edges

* refactor(runtime): adapt data controller changes, store animation result

* refactor(runtime): element style callback returns index and element data extractly

* fix(animation): remove parseAnimation to avoid circular dependencies

* test: update test case

* refactor: adjust demo env

* refactor(animation): executor support specific modifiedStyle, and provide default style value infer

* refactor(themes): update built-in themes

* refactor(utils): update createAnimationsProxy to avoid sync onframe and onfinish to all instances

* refactor(runtime): refactor cavas init function

* refactor(spec): support to disable animation

* test: update test spec

* test: update test case

* refactor(runtime): update element controller and integration cases

* chore: update editor config

* refactor(runtime): update render logic and fix issue that data states change
2024-02-02 17:34:33 +08:00