Skip to content

Commit

Permalink
fix: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
yvonneyx committed Dec 12, 2024
1 parent f60ad7f commit aa66104
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 34 deletions.
2 changes: 1 addition & 1 deletion packages/graphs/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export { Dendrogram, type DendrogramOptions } from './dendrogram';
export { Fishbone, type FishboneOptions } from './fishbone';
export { FlowDirectionGraph, type FlowDirectionGraphOptions } from './flow-direction-graph';
export { FlowGraph, type FlowGraphOptions } from './flow-graph';
export { IndentedTree, type IndentedTreeOptions } from './indented-tree';
export { MindMap, type MindMapOptions } from './mind-map';
export { NetworkGraph, type NetworkGraphOptions } from './network-graph';
export { OrganizationChart, type OrganizationChartOptions } from './organization-chart';
export { Fishbone, type FishboneOptions } from './fishbone';
40 changes: 18 additions & 22 deletions packages/graphs/src/core/utils/tree.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
import { memoize } from 'lodash';
import { measureTextSize } from './measure-text';

export const getLinearTextNodeStyle = memoize(
(text: string, minWidth: number, maxWidth: number, depth: number = 0) => {
const font = {
fontWeight: depth === 0 ? 600 : 400,
fontSize: depth === 0 ? 24 : 16,
};
const offset = depth === 0 ? [64, 30] : [12, 12];
const size = measureTextSize(text, offset, font, minWidth, maxWidth);
return { font, size };
},
);
export const getLinearTextNodeStyle = memoize((text: string, minWidth: number, maxWidth: number, depth: number = 0) => {
const font = {
fontWeight: depth === 0 ? 600 : 400,
fontSize: depth === 0 ? 24 : 16,
};
const offset = depth === 0 ? [64, 30] : [12, 12];
const size = measureTextSize(text, offset, font, minWidth, maxWidth);
return { font, size };
});

export const getBoxedTextNodeStyle = memoize(
(text: string, minWidth: number, maxWidth: number, depth: number = 0) => {
const font = {
fontWeight: depth === 0 || depth === 1 ? 600 : 400,
fontSize: depth === 0 ? 24 : 16,
};
const offset = depth === 0 ? [64, 30] : [36, 24];
const size = measureTextSize(text, offset, font, minWidth, maxWidth);
return { font, size };
},
);
export const getBoxedTextNodeStyle = memoize((text: string, minWidth: number, maxWidth: number, depth: number = 0) => {
const font = {
fontWeight: depth === 0 || depth === 1 ? 600 : 400,
fontSize: depth === 0 ? 24 : 16,
};
const offset = depth === 0 ? [64, 30] : [36, 24];
const size = measureTextSize(text, offset, font, minWidth, maxWidth);
return { font, size };
});
4 changes: 2 additions & 2 deletions packages/graphs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ import './preset';

export {
Dendrogram,
Fishbone,
FlowDirectionGraph,
FlowGraph,
IndentedTree,
MindMap,
NetworkGraph,
OrganizationChart,
Fishbone,
} from './components';
export type {
DendrogramOptions,
FishboneOptions,
FlowDirectionGraphOptions,
FlowGraphOptions,
IndentedTreeOptions,
MindMapOptions,
NetworkGraphOptions,
OrganizationChartOptions,
FishboneOptions
} from './components';
export { CollapseExpandIcon, RCNode } from './core/base';
export type { OrganizationChartNodeProps, TextNodeProps } from './core/base/node';
Expand Down
15 changes: 7 additions & 8 deletions packages/graphs/tests/demos/fishbone-default.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Fishbone, FishboneOptions } from "@ant-design/graphs";
import { treeToGraphData } from "@antv/g6";
import React from "react";

import { Fishbone, FishboneOptions } from '@ant-design/graphs';
import { treeToGraphData } from '@antv/g6';
import React from 'react';

const data = {
id: 'Product Profitability Below Expectations',
Expand Down Expand Up @@ -57,7 +56,7 @@ export const FishboneDefault = () => {
const options: FishboneOptions = {
autoFit: 'view',
data: treeToGraphData(data),
type: 'decision'
}
return <Fishbone {...options} />
}
type: 'decision',
};
return <Fishbone {...options} />;
};
2 changes: 1 addition & 1 deletion packages/graphs/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default defineConfig({
resolve: {
alias: {
'@ant-design/graphs': path.resolve(__dirname, './src/index.ts'),
'@ant-design/graphs-util': path.resolve(__dirname, '../util/src/index.ts')
'@ant-design/graphs-util': path.resolve(__dirname, '../util/src/index.ts'),
},
},
});

0 comments on commit aa66104

Please sign in to comment.