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

feat(gi-sdk): basic graph application rendering using gi-sdk #540

Merged
merged 2 commits into from
Jul 25, 2024
Merged

Conversation

yvonneyx
Copy link
Contributor

整体效果如下:

Kapture 2024-07-23 at 20 32 17

资产需要注册后使用

registerWidget('custom-sidebar', CustomSidebar);

给资产提供的 API

  • useGISDK: 提供完整的 GISDK 上下文
  • useGraph: 获取 G6 图实例
    • const graph = useGraph();
  • useGlobalModel: 获取及更新全局自定义状态
    • const [globalModel, updateGlobalModel] = useGlobalModel()
  • useWidgets: 获取及更新组件配置
  • useEventSubscribe: 事件订阅
  • useEventPublish: 事件派发

packages/gi-sdk/public/main.tsx Show resolved Hide resolved
</Graphin>
</div>
<Panel>{snap.isReady && renderComponent('panel')}</Panel>
<Panel>{isReady && renderComponents('panel')}</Panel>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SDK 里是默认内置一个布局吗,可以实现自定义其他布局吗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

福老师初版实现是内置的布局,之前设计 spec 的时候有考虑过自定义布局吗?有的话,后面可以加这个 feature~

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

哦,咋们这次升级是为了解决啥,slot 的设计和设计 spec 不太一样 @hustcc,后面升级可能是 breakchange

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

经讨论,还是之前的spec设计更符合 sdk 的定位,下个 pr 进行修改~

/**
* The widgets related to the graph.
*/
widgets: WidgetItem[];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dataset 的设计,目前还是采用挂载到 window 的方案吗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看了下 dataset 的类型定义对应的是一套服务的配置参数,调用服务获取数据的逻辑打算放在上层应用,gisdk专注于渲染图应用。这样设计可行吗?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

数据的定义和获取,是业务测实现,但 SDK 依赖数据才能渲染出应用来。是不是业务侧定义获取数据的资产,spec 里面声明使用那个数据资产合适一些。

@yvonneyx yvonneyx changed the title feat(gi-sdk): use gisdk to render graph application feat(gi-sdk): basic graph application rendering using gi-sdk Jul 25, 2024
@yvonneyx yvonneyx merged commit e927ccb into v3 Jul 25, 2024
@yvonneyx yvonneyx deleted the sdk-v3 branch July 25, 2024 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants