Commit Graph

4871 Commits

Author SHA1 Message Date
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
Yuxin
2b780f489a
feat(edge): add cubic edge element and its vertical and. horizontal variants (#5404)
* feat(edge): add cubic edge element

* feat(edge): add cubic horizontal edge element

* feat(edge): add cubic vertical edge element

* fix: format code

* feat: update animation snapshots

---------

Co-authored-by: yvonneyx <banxuan.zyx@antgroup.com>
2024-02-01 14:48:55 +08:00
Aaron
509552d1ed
refactor: data controller support collect changes (#5406)
* feat(utils): add reduceDataChanges util

* feat(utils): add cloneElementData util

* refactor(runtime): data controller support collect changes

* test(utils): rename case naming

* refactor(runtime): define ChangeTypeEnum
2024-02-01 14:39:10 +08:00
Yuxin
82d28f264c
feat(edge): add quadratic edge element (#5402)
* feat(edge): add quadratic edge element

* test(edge): add quadratic unit tests

* fix(edge): fix code review

---------

Co-authored-by: yvonneyx <banxuan.zyx@antgroup.com>
2024-01-31 20:34:48 +08:00
Yuxin
5f41eaea15
feat(edge): add edge base class and line edge element (#5385)
* feat(edge): add base edge(keyShape,label and halo)

* feat: add edge arrow

* feat: update ci

* refactor: make render function clear

* feat(edge): add edge animation

* refactor: perf ts type and fix ci

* feat(edge): update edge animation

* chore: fix code review

* fix: ci

* test: add unit test

* fix: export circle demo

* chore: update point format

* fix: fix code preview

* chore: update ts type

* test: perf coverage

---------

Co-authored-by: yvonneyx <banxuan.zyx@antgroup.com>
2024-01-31 13:02:15 +08:00
Aaron
896fe1499d
feat: animation grammar executor and snippets (#5390)
* feat(utils): add parseAnimation util

* refactor(utils): extract preprocessKeyframes to util

* feat(utils): add getDescendantShapes util

* feat(utils): add executeAnimation util

* refactor(test): test case import preset and update snapshot

* fix(elements): fix animate method that may lack of animate attributes

* feat(animation): add custom spec animation config

* refactor(test): update animation breathe case

* refactor(animation): adjust animation type definition, remove component animation

* refactor(animation): remove component animation machenism, add spec exector

* chore(animation): update integraion test snapshots

* test(animation): update unit test case
2024-01-30 15:36:07 +08:00
hustcc
5c4e98a4e6
refactor: add node base class (#5389)
* feat: add base node class

* chore: fix ci

* chore: fix code review
2024-01-30 14:33:15 +08:00
hustcc
5b70663af9
feat: add circle node element (#5381)
* chore: add circle node template

* feat: draw circle key, label, icon

* chore: update test case

* feat: add icon shape and test case

* refactor: make render function simple

* chore: fix code review

* feat: add key for anchor
2024-01-30 10:52:24 +08:00
hustcc
134dfb9e43
test: add coverage (#5388)
* chore: add coverage action

* docs: update readme add badge
2024-01-30 10:46:29 +08:00
Aaron
96b13e9760
feat: add register mechanism (#5383) 2024-01-29 10:04:55 +08:00
Aaron
9459b452fa
feat: add data controller (#5382)
* chore: use strict mode

* feat(utils): add isEdgeData util to judge edge data

* refactor(spec): edge data allow unset id

* feat(utils): add toGraphlibData, toG6Data utils

* feat(utils): add arrayDiff util

* feat(utils): add dfs util

* feat(types): add types about data

* feat(runtime): add adta controller

* refactor: fix issues that cause type errors

* refactor(runtime): remove data controller's dependency of graph

* refactor(runtime): adjust types definition place

* refactor(runtime): move mergeElementsData to utils folder and add test case
2024-01-28 21:23:19 +08:00
hustcc
9b6a66349b
feat: add badge shape (#5378)
* refactor: use antv util

* test: update label-shape test case

* feat: add badge ui, test case

* chore: fix import type
2024-01-26 17:51:21 +08:00
Aaron
4be279b522
feat: add basic shape (#5377)
* feat(utils): add parsePadding util

* feat(utils): add prefix utils

* feat: config dev env

* refactor(test): update test case context

* refactor(test): update layeredCanvas test case

* refactor(test): add background grid to help verifying

* feat(elements): add label shape

* refactor(tests): adjust integration test types definition

* test(label): add integraion of label

* test(animation): add animation test case
2024-01-26 15:58:55 +08:00
Aaron
4e11baeb51
feat(test): config integration test env and add modular canvas (#5374)
* feat(test): config integration test env

* feat(runtime): add modular canvas

* refactor(test): update snapshot naming rule

* chore(runtime): adjust variable naming

* chore(test): adjust folder naming

* refactor(runtime): remove unnecessary variable usage
2024-01-26 10:59:52 +08:00
Aaron
d48787e345
refactor(spec): adjust spec exports (#5373) 2024-01-25 21:56:59 +08:00
Aaron
64175c58c2
feat(spec): init spec definition (#5371) 2024-01-25 21:19:17 +08:00
Aaron
acbe71d2e5 test: add default test case 2024-01-25 16:06:27 +08:00
Aaron
3618d4a6e3 feat: create project structure 2024-01-25 16:02:05 +08:00
Aaron
46b0effda8 chore: create init exports 2024-01-25 15:32:14 +08:00
Aaron
2bf30cf2c6 chore: rename test folder 2024-01-25 15:31:45 +08:00
Aaron
707aa8abc0 chore: clear dependencies 2024-01-25 15:30:31 +08:00
Aaron
53a3a5341b chore: clear workspace 2024-01-25 15:10:00 +08:00
hustcc
bb847876c3
feat: add autoResize option on graph (#5362)
* feat: add autoResize option on graph

* test: add test cases
2024-01-24 12:37:03 +08:00
Aaron
08de942823
refactor(spec): change mode to behaviors (#5365) 2024-01-23 20:48:53 +08:00
Aaron
a4aa09bc41
refactor(register): adjust getPlugins returns type (#5363) 2024-01-23 14:40:43 +08:00
Aaron
9f09fa4eef
refactor: adjust spec types (#5364)
* refactor(spec): remove io.ts

* refactor(spec): use plural naming convention

* refactor(types): use more readable generic types naming

* refactor(spec): adjust edge spec definition

* refactor(spec): support config default states in data style
2024-01-23 14:03:19 +08:00
hustcc
b6fb51700d
chore: remove v2 util and tests for utils (#5357)
* chore: remove util v2 from map plugin

* chore: upgrade util to v3 in site

* test: add tests for utils/array

* test: add test case for bbox
2024-01-19 14:23:57 +08:00
hustcc
3c96d53d1e
refactor: utils and it's tests (#5356)
* refactor: use same console function

* test: add test case for math

* chore: fix lint

* test: fix ci
2024-01-19 09:58:10 +08:00