跳转到内容

pivotick v3.0.0


拓展 / GraphUI / PropertiesPanel

接口: PropertiesPanel ​

定义于:interfaces/GraphUI.ts:843

表示图形 UI 侧栏中属性面板的配置

定义如何计算和显示节点和边的属性。

默认值 ​

ts
All key/value pairs from node.getData() or edge.getData()

属性 ​

edgePropertiesMap() ​

edgePropertiesMap: (edge, ctx) => PropertyEntry[] | Promise<PropertyEntry[]>

定义于:interfaces/GraphUI.ts:867

计算要显示的边属性列表的函数。

可能是 async — 返回条目的承诺,面板显示一个占位符,直到解决。

参数 ​

edge ​

Edge

ctx ​

RenderContext

返回值 ​

PropertyEntry[] | Promise<PropertyEntry[]>

默认值 ​

ts
All key/value pairs from edge.getData()

enabled? ​

optional enabled: boolean

定义于:interfaces/GraphUI.ts:849

侧边栏是否显示属性面板。 false 删除它及其分隔符,留下标题、相邻面板和任何额外的面板。

默认值 ​

ts
true

nodePropertiesMap() ​

nodePropertiesMap: (node, ctx) => PropertyEntry[] | Promise<PropertyEntry[]>

定义于:interfaces/GraphUI.ts:858

计算要显示的节点属性列表的函数。

可能是 async — 返回条目的承诺,面板显示一个占位符,直到解决。

参数 ​

node ​

Node

ctx ​

RenderContext

返回值 ​

PropertyEntry[] | Promise<PropertyEntry[]>

默认值 ​

ts
All key/value pairs from node.getData()

render? ​

optional render: string | HTMLElement | (element, ctx) => FallbackRenderResult

定义于:interfaces/GraphUI.ts:884

属性面板的自定义渲染器。此内容将覆盖默认的侧边栏属性面板。

默认值 ​

ts
undefined

示例 ​

ts
(element) => `element id: ${element.id}`
ts
// A custom view for a lone node, the aggregated table for everything else.
(element) => (element instanceof Node) ? viewFor(element) : undefined

备注 ​

返回的 string 呈现为纯文本;返回 HTMLElement 来渲染 HTML。可能是async:槽显示一个占位符,直到它解析,并且选择移动后到达的结果被删除。

返回(或解析为)undefined,将选择返回到默认面板:一个元素的 nodePropertiesMap / edgePropertiesMap 行,多个元素的聚合表。返回 null 则不绘制任何内容。