Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: 优化自定义元素文档 #6920

Open
wants to merge 1 commit into
base: v5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions packages/site/docs/manual/behavior/build-in/ClickSelect.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ const graph = new Graph({

## 配置项

| 配置项 | 说明 | 类型 | 默认值 | 必选 |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | -------------- | ---- |
| type | 交互类型名称。此插件已内置,你可以通过 `type: 'click-select'` 来使用它。 | `click-select` \| string | `click-select` | ✓ |
| animation | 是否启用动画 | boolean | true | |
| [degree](#degree) | 控制了高亮扩散范围 | number \| (event:[Event](/api/event#事件对象属性)) => number | 0 | |
| [enable](#enable) | 是否启用点击元素的功能(可以通过函数的方式动态控制是否启用,例如只有节点被选中时才启用。) | boolean \| ((event: [Event](/api/event#事件对象属性)) => boolean) | true | |
| multiple | 是否允许多选 | boolean | false | |
| state | 当元素被选中时应用的状态 | string \| `selected` \| `active`\| `inactive`\| `disabled`\| `highlight` | `selected` | |
| [neighborState](#neighborstate) | 当有元素选中时,其相邻 n 度关系的元素应用的状态。n 的值由属性 degree 控制,例如 degree 为 1 时表示直接相邻的元素 | string \| `selected` \| `active`\| `inactive`\| `disabled`\| `highlight` | `selected` | |
| [unselectedState](#unselectedstate) | 当有元素被选中时,除了选中元素及其受影响的邻居元素外,其他所有元素应用的状态。 | string \| `selected` \| `active`\| `inactive`\| `disabled`\| `highlight` | | |
| onClick | 点击元素时的回调 | (event: [Event](/api/event#事件对象属性)) => void | | |
| trigger | 按下该快捷键配合鼠标点击进行多选 **按键参考:** _<a href="https://developer.mozilla.org/zh-CN/docs/Web/API/UI_Events/Keyboard_event_key_values" target="_blank" rel="noopener noreferrer">MDN Key Values</a>_ | string[] \| (`Control` \| `Shift`\| `Alt` \| `......`)[] | `['shift']` | |
| 配置项 | 说明 | 类型 | 默认值 | 必选 |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ | -------------- | ---- |
| type | 交互类型名称。此交互已内置,你可以通过 `type: 'click-select'` 来使用它。 | `click-select` \| string | `click-select` | ✓ |
| animation | 是否在元素状态切换时启用动画效果 | boolean | true | |
| [degree](#degree) | 控制了高亮扩散范围 | number \| (event:[Event](/api/event#事件对象属性)) => number | 0 | |
| [enable](#enable) | 是否启用点击元素的功能(可以通过函数的方式动态控制是否启用,例如只有节点被选中时才启用。) | boolean \| ((event: [Event](/api/event#事件对象属性)) => boolean) | true | |
| multiple | 是否允许多选 | boolean | false | |
| state | 当元素被选中时应用的状态 | string \| `selected` \| `active`\| `inactive`\| `disabled`\| `highlight` | `selected` | |
| [neighborState](#neighborstate) | 当有元素选中时,其相邻 n 度关系的元素应用的状态。n 的值由属性 degree 控制,例如 degree 为 1 时表示直接相邻的元素 | string \| `selected` \| `active`\| `inactive`\| `disabled`\| `highlight` | `selected` | |
| [unselectedState](#unselectedstate) | 当有元素被选中时,除了选中元素及其受影响的邻居元素外,其他所有元素应用的状态。 | string \| `selected` \| `active`\| `inactive`\| `disabled`\| `highlight` | | |
| onClick | 点击元素时的回调 | (event: [Event](/api/event#事件对象属性)) => void | | |
| trigger | 按下该快捷键配合鼠标点击进行多选**按键参考:** <a href="https://developer.mozilla.org/zh-CN/docs/Web/API/UI_Events/Keyboard_event_key_values" target="_blank" rel="noopener noreferrer">MDN Key Values</a> | string[] \| (`Control` \| `Shift`\| `Alt` \| `......`)[] | `['shift']` | |

### degree

Expand Down
20 changes: 10 additions & 10 deletions packages/site/docs/manual/behavior/build-in/DragCanvas.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ const graph = new Graph({

## 配置项

| 配置项 | 说明 | 类型 | 默认值 | 必选 |
| ----------- | ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ---- |
| type | 交互类型名称 | string | `drag-canvas` | ✓ |
| enable | 是否启用该交互 | boolean \| ((event: [Event](/api/event#事件对象属性) \| [KeyboardEvent](https://developer.mozilla.org/zh-CN/docs/Web/API/KeyboardEvent)) => boolean) | true | |
| animation | 拖拽动画配置,仅在使用按键移动时有效 | [ViewportAnimationEffectTiming](/api/graph/option#viewportanimationeffecttiming) | - | |
| direction | 允许的拖拽方向,[配置项](#direction) | `'x'` \| `'y'` \| `'both'` | `'both'` (不限制方向) | |
| range | 可拖拽的视口范围(以视口大小为单位),[配置项](#range) | number \| number[] | Infinity | |
| sensitivity | 触发一次按键移动的距离 | number | 10 | |
| trigger | 触发拖拽的键盘按键,[配置项](#trigger) | object | - | |
| onFinish | 拖拽完成时的回调函数 | () => void | - | |
| 配置项 | 说明 | 类型 | 默认值 | 必选 |
| ----------- | ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ---- |
| type | 交互类型名称 | string | `drag-canvas` | ✓ |
| enable | 是否启用该交互 | boolean \| ((event: [Event](/api/event#事件对象属性) \| [KeyboardEvent](https://developer.mozilla.org/zh-CN/docs/Web/API/KeyboardEvent)) => boolean) | `(event) => 'eventType' in event ? event.targetType === 'canvas': true`(仅在点击画布时启用) | |
| animation | 拖拽动画配置,仅在使用按键移动时有效 | [ViewportAnimationEffectTiming](/api/graph/option#viewportanimationeffecttiming) | - | |
| direction | 允许的拖拽方向,[配置项](#direction) | `'x'` \| `'y'` \| `'both'` | `'both'` (不限制方向) | |
| range | 可拖拽的视口范围(以视口大小为单位),[配置项](#range) | number \| number[] | Infinity | |
| sensitivity | 触发一次按键移动的距离 | number | 10 | |
| trigger | 触发拖拽的键盘按键,[配置项](#trigger) | object | - | |
| onFinish | 拖拽完成时的回调函数 | () => void | - | |

### Direction

Expand Down
Loading
Loading