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: add graphin props setting to sdk config #587

Open
wants to merge 1 commit into
base: master
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
2 changes: 1 addition & 1 deletion packages/gi-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/gi-sdk",
"version": "2.4.21",
"version": "2.4.22",
"description": "G6VP 核心画布渲染",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
12 changes: 5 additions & 7 deletions packages/gi-sdk/src/GISDK.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let updateHistoryTimer: number;
const GISDK = (props: Props) => {
const graphinRef = React.useRef<null | Graphin>(null);
// @ts-ignore
const { children, assets, id, services, config, locales } = props;
const { children, assets, id, services, config, locales, grapinProps } = props;
Copy link
Member

Choose a reason for hiding this comment

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

感觉不用新增一个 grapinProps 吧,和 layout 这类配置放一起就好

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

感觉不用新增一个 grapinProps 吧,和 layout 这类配置放一起就好

animate、style、containerStyle... 等等一堆配置,后边这样一个个加进来么?

const { language = 'zh-CN', ...localeMessages } = locales || {};

const GISDK_ID = React.useMemo(() => {
Expand Down Expand Up @@ -397,19 +397,17 @@ const GISDK = (props: Props) => {
<GraphInsightContext.Provider value={ContextValue}>
<GICC_LAYOUT_COMPONENT {...GICC_LAYOUT_PROPS}>
<Graphin
containerStyle={{ transform: 'scale(1)' }}
style={{ borderRadius: '8px', overflow: 'hidden' }}
enabledStack={true}
animate={true}
{...grapinProps}
ref={graphinRef}
containerId={`${GISDK_ID}-graphin-container`}
containerStyle={{ transform: 'scale(1)' }}
data={graphData}
layout={layout}
enabledStack={true}
theme={theme}
layoutCache={state.layoutCache}
style={{ borderRadius: '8px', overflow: 'hidden' }}
willUnmount={() => {
console.log('un mount....');
}}
>
<>
{HAS_GRAPH && <InitializerComponent {...InitializerProps} />}
Expand Down
3 changes: 2 additions & 1 deletion packages/gi-sdk/src/typing.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Combo } from '@antv/g6';
import type { GraphinContextType, GraphinData, IUserEdge, IUserNode, Layout } from '@antv/graphin';
import type { GraphinContextType, GraphinData, GraphinProps, IUserEdge, IUserNode, Layout } from '@antv/graphin';
import type { LANGUAGE_KEY_NAME } from './process/locale';
import type { GraphSchemaData, IGraphData } from './process/schema';
export type { GraphSchemaData };
Expand Down Expand Up @@ -102,6 +102,7 @@ export interface Props {
style?: React.CSSProperties;
className?: string;
children?: React.ReactChildren | JSX.Element | JSX.Element[];
grapinProps?: GraphinProps;
}

export type AssetType =
Expand Down
Loading