Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
363 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Alipay.inc | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
"packages": [ | ||
"packages/*" | ||
], | ||
"npmClient": "cnpm", | ||
"npmClient": "yarn", | ||
"version": "0.0.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,90 @@ | ||
--- | ||
title: 分析组件 | ||
order: 3 | ||
order: 5 | ||
--- | ||
|
||
## \<Toolbar /> 组件 | ||
|
||
两个组件的 Prop API | ||
Props: | ||
|
||
| 属性 | 类型 | 是否必选 | 说明 | | ||
| ------------- | ---------------------------------------------------------- | -------- | --------------------------------------------------------- | | ||
| bindType | 'node' \| 'edge' \| 'canvas' | 否 | 事件的监听对象类型,默认值为 node | | ||
| graph | Graph | 否 | G6 实例 | | ||
| options | [MenuItemType](#menuitemtype)[] | 否 | 菜单项配置 | | ||
| render | (props: [RenderProps](#renderprops)) => React.ReactElement | 否 | 自定义的菜单渲染函数 | | ||
| onContextmenu | (e: G6Event, graph: Graph) => boolean; | 否 | 右键菜单事件的 hook 函数。返回 false 可以阻止右键菜单出现 | | ||
|
||
注意:options 和 render 必须提供一个。 | ||
|
||
### RenderProps | ||
|
||
Toolbar render 函数的参数。 | ||
|
||
RenderProps extend 了 Toolbar 的 Props: | ||
|
||
| 属性 | 类型 | 是否必选 | 说明 | | ||
| ------- | ------------ | -------- | -------------------- | | ||
| onClose | ( ) => void; | 否 | 隐藏右键菜单事件回调 | | ||
|
||
### MenuItemType | ||
|
||
MenuItem 的配置项 | ||
|
||
| 属性 | 类型 | 是否必选 | 说明 | | ||
| ------------- | ----------------------------------------------------------- | -------- | ------------------- | | ||
| key | string | **是** | React 组件 key | | ||
| visible | boolean | 否 | G6 实例 | | ||
| iconType | string | 否 | antd icon 类型 | | ||
| title | string | 否 | 菜单项文本 | | ||
| width | number | 否 | 菜单宽度 | | ||
| height | number | 否 | 菜单高度 | | ||
| onClick | (props: [ContainerProps](#containerprops)) => void; | 否 | 点击回调 | | ||
| useCustomIcon | boolean | 否 | 是否使用自定义 icon | | ||
| render | (props: [ContainerProps](#containerprops)) => ReactElement; | 否 | 自定义渲染函数 | | ||
|
||
### ContainerProps | ||
|
||
MenuItem 点击和渲染函数的参数 | ||
|
||
| 属性 | 类型 | 是否必选 | 说明 | | ||
| ------- | -------------------------------- | -------- | -------------------- | | ||
| graph | Graph | 否 | G6 实例 | | ||
| menu | [MenuItemType](#menuitemtype)[ ] | 否 | 菜单项配置 | | ||
| onClose | ( ) => void; | 否 | 隐藏右键菜单事件回调 | | ||
|
||
## \<ContextMenu /> 组件 | ||
|
||
Props: | ||
|
||
| 属性 | 类型 | 是否必选 | 说明 | | ||
| --------- | ---------------------------------------------------------------- | -------- | ---------------------------------------------------- | | ||
| graphDOM | HTMLElement | **是** | G6 挂载的 DOM 节点,Graphin 组件的子组件会被自动注入 | | ||
| graph | Graph | 否 | G6 实例 | | ||
| apis | [Apis](/zh/docs/api/graphin/#apis) | 否 | Graphin API | | ||
| className | string | 否 | 类名 | | ||
| graphVars | { width?: number; height: number; } | 否 | G6 图表信息 | | ||
| direction | horizontal \| vertical | 否 | Toolbar 布局方向 | | ||
| render | (props: [RenderProps](#renderprops)) => [MenuItem](#menuitem)[ ] | 否 | 自定义工具栏菜单渲染函数 | | ||
|
||
### MenuItem | ||
|
||
| 属性 | 类型 | 是否必选 | 说明 | | ||
| ------------- | ---------------------- | -------- | ------------------------ | | ||
| id | string | **是** | 唯一标识 | | ||
| name | string | **是** | 菜单项文本 | | ||
| icon | string | **是** | 菜单项 icon 类型(antd) | | ||
| action | horizontal \| vertical | **是** | 点击事件回调 | | ||
| disabled | boolean | 否 | 是否禁用菜单项 | | ||
| style | CSSProperties | 否 | 自定义样式 | | ||
| renderTooltip | () => ReactElement; | 否 | 自定义工具栏渲染函数 | | ||
|
||
### RenderProps | ||
|
||
| 属性 | 类型 | 是否必选 | 说明 | | ||
| ---------- | ----------------------------------- | -------- | -------------------- | | ||
| toolbarCfg | [MenuItem](#menuitem)[] | **是** | 默认的工具栏配置数组 | | ||
| graph | Graph | 否 | G6 实例 | | ||
| apis | [Apis](/zh/docs/api/graphin/#apis) | 否 | Graphin API | | | ||
| graphVars | { width?: number; height: number; } | 否 | G6 图表信息 | | ||
| direction | horizontal \| vertical | 否 | Toolbar 布局方向 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.