Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
topology-byfe
Advanced tools
yarn add topology-byfe
yarn
yarn start
yarn test
见demo
name | type | default | description |
---|---|---|---|
data | object | { nodes: []; lines: [] } | 数据 |
readOnly | bool | false | 只读模式,为true时不可编辑 |
autoLayout | bool | false | 自动布局,当数据中没有position属性时将自动计算布局。 |
renderTreeNode | (node,decorators) => ReactNode | - | 子节点render方法,接收节点数据,返回JSX。 |
getInstance | (instance: Topology) => void | - | 返回组件实例,用于调用组件内部的方法。 |
onChange | (data, changeType) => void | - | 数据发成改变时触发,changeType为改变的类型 |
onSelect | (data) => void | - | 选中数据时触发,返回当前选中的数据(包含节点、线段) |
sortChildren | (parent, children) => sortedChildren | - | 子节点排序回调,可选,默认无。 |
返回topology组件的实例,可通过实例调用组件内部的方法:
移动到中心,当所有节点都有位置数据(positions)时,移动的中心点为内容的中心,否则为画布的中心。
自动计算布局
renderTreeNode的第二个参数,包含以下装饰器函数:
anchorDecorator是一个高阶函数,经过 anchorDecorator 包装的控件将变成一个锚点。
anchorDecorator(options)(ReactNode)
name | type | default | description |
---|---|---|---|
anchorId | string | - | 锚点唯一id,如果不传将默认生成一个自增的id |
模板装饰器,用于包装模板组件
<TemplateWrapper generator={this.generatorNodeData}>
<div>模板节点</div>
</TemplateWrapper>
name | type | default | description |
---|---|---|---|
data | () => nodeData | - | 数据生成器,用于产生节点数据 |
FAQs
We found that topology-byfe demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.