跳转到内容

pivotick v3.0.0


拓展 / GraphUI / ExtraPanel

接口: ExtraPanel ​

定义于:interfaces/GraphUI.ts:993

图形 UI 侧栏中的附加面板。

title 和 render 都可以是:

  • 字符串或 HTMLElement 静态内容,或
  • 当前选择的函数(Node,Edge,用于多选的数组,或未选择任何内容时的null)-在每次选择更改时重新调用,除非ExtraPanel.reactive为false。

通过 UI.extraPanels 预先声明面板,或使用 graph.UIManager.addPanel() (返回一个处理程序)在图表生命周期中的任何点注册它们。

示例 ​

ts
{
    id: 'description',
    title: 'Description',
    render: (element): HTMLElement => {
        const node = element instanceof Node ? element : null
        const div = document.createElement('div')
        div.textContent = node?.getData().description ?? 'Empty node description'
        return div
    },
}

派生类型 ​

属性 ​

alwaysVisible? ​

optional alwaysVisible: boolean

定义于:interfaces/GraphUI.ts:1011

面板应该始终可见

默认值 ​

ts
false

id? ​

optional id: string

定义于:interfaces/GraphUI.ts:998

稳定标识符,用于对removePanel/refreshPanel中的面板进行寻址。省略时自动生成。


order? ​

optional order: number

定义于:interfaces/GraphUI.ts:1018

侧边栏中的显示顺序为升序。共享 order 的面板保持其注册顺序,因此 UI.extraPanels 从上到下读取,运行时面板附加在它们之后。

默认值 ​

ts
0

reactive? ​

optional reactive: boolean

定义于:interfaces/GraphUI.ts:1026

每当选择发生变化时,重新解析title和render。为构建成本高昂且不描述选择的面板设置 false:然后它渲染一次,并且只有显式 refreshPanel() 才能重建它。

默认值 ​

ts
true

render ​

render: ExtraPanelContent

定义于:interfaces/GraphUI.ts:1006

A string 呈现为纯文本;传递 HTMLElement 来渲染 HTML。


title? ​

optional title: ExtraPanelContent

定义于:interfaces/GraphUI.ts:1004

面板的标题行。 A string 呈现为纯文本;传递 HTMLElement 来渲染 HTML。对于根本没有标题的面板,省略它(或解析为空白)。