From aa661049967c0eaa68980726141fb1723d041cc4 Mon Sep 17 00:00:00 2001 From: yvonneyx Date: Thu, 12 Dec 2024 11:29:04 +0800 Subject: [PATCH] fix: ci --- packages/graphs/src/components/index.ts | 2 +- packages/graphs/src/core/utils/tree.ts | 40 +++++++++---------- packages/graphs/src/index.ts | 4 +- .../graphs/tests/demos/fishbone-default.tsx | 15 ++++--- packages/graphs/vite.config.ts | 2 +- 5 files changed, 29 insertions(+), 34 deletions(-) diff --git a/packages/graphs/src/components/index.ts b/packages/graphs/src/components/index.ts index 389a08416..075b19029 100644 --- a/packages/graphs/src/components/index.ts +++ b/packages/graphs/src/components/index.ts @@ -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'; diff --git a/packages/graphs/src/core/utils/tree.ts b/packages/graphs/src/core/utils/tree.ts index 00975769c..fa546cdc4 100644 --- a/packages/graphs/src/core/utils/tree.ts +++ b/packages/graphs/src/core/utils/tree.ts @@ -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 }; +}); diff --git a/packages/graphs/src/index.ts b/packages/graphs/src/index.ts index 3ee89f462..7d4ad0453 100644 --- a/packages/graphs/src/index.ts +++ b/packages/graphs/src/index.ts @@ -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'; diff --git a/packages/graphs/tests/demos/fishbone-default.tsx b/packages/graphs/tests/demos/fishbone-default.tsx index f5eaa834e..d160be489 100644 --- a/packages/graphs/tests/demos/fishbone-default.tsx +++ b/packages/graphs/tests/demos/fishbone-default.tsx @@ -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', @@ -57,7 +56,7 @@ export const FishboneDefault = () => { const options: FishboneOptions = { autoFit: 'view', data: treeToGraphData(data), - type: 'decision' - } - return -} + type: 'decision', + }; + return ; +}; diff --git a/packages/graphs/vite.config.ts b/packages/graphs/vite.config.ts index 436bd43c4..80f073f47 100644 --- a/packages/graphs/vite.config.ts +++ b/packages/graphs/vite.config.ts @@ -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'), }, }, });